Skip to content

Commit 805f6d0

Browse files
committed
add webpage and tables for the code release
1 parent b3471c5 commit 805f6d0

5 files changed

Lines changed: 409 additions & 0 deletions

File tree

assets/css/style.css

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
body {
2+
font-family: Arial, sans-serif;
3+
background-color: #F2F2F2;
4+
padding: 20px;
5+
}
6+
7+
h2 {
8+
text-align: center;
9+
margin-top: 250px;
10+
margin-bottom: 250px;
11+
}
12+
13+
p {
14+
text-align: center;
15+
font-size: 18px;
16+
margin-bottom: 50px;
17+
}
18+
19+
button {
20+
display: block;
21+
margin: 0 auto;
22+
background-color: #7fcf69;
23+
color: #eff4ef;
24+
padding: 10px 20px;
25+
border: none;
26+
border-radius: 10px;
27+
cursor: pointer;
28+
text-align: center;
29+
justify-content: center;
30+
margin-bottom: 40px;
31+
}
32+
33+
button:hover {
34+
background-color: #7fcf69;
35+
}
36+
37+
.pr-button {
38+
display: inline-block;
39+
padding: 5px 10px;
40+
font-size: small;
41+
background-color: #7bc567;
42+
color: #fff;
43+
border: none;
44+
border-radius: 8px;
45+
text-align: right;
46+
text-decoration: none;
47+
cursor: pointer;
48+
margin-bottom: 10px;
49+
}
50+
51+
.pr-button:hover {
52+
background-color: #7fcf80;
53+
}
54+
55+
.pr-button:focus {
56+
outline: none;
57+
}
58+
59+
select {
60+
display: block;
61+
margin: 0 auto;
62+
font-size: 16px;
63+
padding: 5px;
64+
margin-bottom: 40px;
65+
}
66+
67+
table {
68+
font-family: Arial, sans-serif;
69+
font-size: 14px;
70+
border-collapse: collapse;
71+
margin: 0 auto;
72+
margin-bottom: 40px;
73+
}
74+
75+
th, td {
76+
padding: 10px;
77+
border: 1px solid #ddd;
78+
}
79+
80+
th {
81+
background-color: #7fcf69;
82+
font-weight: bold;
83+
text-align: center;
84+
}
85+
86+
tr:hover {
87+
background-color: #f5f5f5;
88+
}
89+
90+
.dropdowns-container {
91+
display: flex;
92+
justify-content: center;
93+
align-items: center;
94+
margin-bottom: 40px;
95+
}
96+
97+
.dropdown-container {
98+
display: flex;
99+
align-items: center;
100+
margin-right: 20px;
101+
}
102+
103+
.dropdown-container label {
104+
margin-right: 5px;
105+
}
106+
107+
#btn {
108+
margin-top: 30px;
109+
border-radius: 20px;
110+
}
111+
112+
.tab-container {
113+
border: 1px solid #ccc;
114+
border-radius: 5px;
115+
}
116+
117+
.tab-header {
118+
display: flex;
119+
justify-content: space-between;
120+
align-items: center;
121+
padding: 10px;
122+
border-bottom: 1px solid #ccc;
123+
}
124+
125+
.center {
126+
display: flex;
127+
justify-content: center;
128+
align-items: center;
129+
}
130+
131+
.markdown-body {
132+
box-sizing: border-box;
133+
min-width: 200px;
134+
max-width: 980px;
135+
margin: 0 auto;
136+
padding: 45px;
137+
text-align: left;
138+
}
139+
140+
#back-to-top-button {
141+
display: none;
142+
position: fixed;
143+
bottom: 20px;
144+
right: 20px;
145+
padding: 10px 20px;
146+
background-color: #555;
147+
color: #fff;
148+
border: none;
149+
border-radius: 4px;
150+
cursor: pointer;
151+
}
152+
153+
#back-to-top-button:hover {
154+
background-color: #333;
155+
}
156+
157+
.sortable-header {
158+
cursor: pointer;
159+
}

assets/js/readme.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Function to convert the markdown README.md file into html and render it as one tab
2+
fetch('README.md')
3+
.then(response => response.text())
4+
.then(text => {
5+
const md = window.markdownit();
6+
const result = md.render(text);
7+
document.querySelector('.markdown-body').innerHTML = result;
8+
});

assets/js/scrollToTop.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Function to scroll to the top of the page for long tables
2+
function scrollToTop() {
3+
document.body.scrollTo({ top: 0, behavior: 'smooth' });
4+
}
5+
6+
// Show or hide the "Back to Top" button based on scroll position
7+
let backToTopButton = document.getElementById("back-to-top-button");
8+
9+
window.addEventListener("scroll", () => {
10+
if (window.scrollY > 300) { // over 300 pixels, show the button
11+
backToTopButton.style.display = "block";
12+
} else {
13+
backToTopButton.style.display = "none";
14+
}
15+
});

assets/js/table.js

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
// Function to convert JSON data to HTML table
2+
function convert() {
3+
// reinitialize the table every time
4+
let container = document.getElementById("container");
5+
if (container.hasChildNodes()) {
6+
container.removeChild(container.firstChild);
7+
}
8+
9+
let conferenceSelect = document.getElementById("conference-select");
10+
let conference = conferenceSelect.options[conferenceSelect.selectedIndex].value;
11+
let yearSelect = document.getElementById("year-select");
12+
let year = yearSelect.options[yearSelect.selectedIndex].value;
13+
let jsonFile = conference + "/" + year + "_DATA.json";
14+
15+
// Ignore these columns to render the table
16+
let coltoIgnore = ["Keywords or Approach", "Conference", "Year", "Benchmark Setup", "Experimental Results", "Keywords", "Benchmarks", "Number", "Unnamed: 11"];
17+
18+
// Fetch the JSON data from the file
19+
fetch(jsonFile)
20+
.then(response => response.json())
21+
.then(data => {
22+
// Create the table element
23+
let table = document.createElement("table");
24+
25+
let jsonData = JSON.parse(data);
26+
27+
// Get the keys (column names) of the first object in the JSON data
28+
let cols = Object.keys(jsonData);
29+
30+
// Create the header element
31+
let thead = document.createElement("thead");
32+
let tr = document.createElement("tr");
33+
34+
// Loop through the column names and create header cells
35+
for (let i = 0; i < cols.length; i++) {
36+
if (coltoIgnore.includes(cols[i])) {
37+
continue;
38+
}
39+
let th = document.createElement("th");
40+
th.innerText = cols[i]; // Set the column name as the text of the header cell
41+
tr.appendChild(th); // Append the header cell to the header row
42+
};
43+
44+
thead.appendChild(tr); // Append the header row to the header
45+
table.appendChild(thead); // Append the header to the table
46+
47+
// Loop through the JSON data and create table rows
48+
col0 = jsonData[cols[0]];
49+
len = Object.keys(col0).length;
50+
51+
// add the data to the table
52+
for (let i = 0; i < len; i++) {
53+
let tr = document.createElement("tr"); // Create a new row
54+
for (let j = 1; j < cols.length; j++) { // number of columns
55+
if (coltoIgnore.includes(cols[j])) {
56+
continue;
57+
}
58+
let td = document.createElement("td"); // Create a new data cell
59+
let th = document.createElement("th");
60+
let value = jsonData[cols[j]][i];
61+
62+
if (cols[j] == "Code Link" || cols[j] == "Github") {
63+
if (value == -1) {
64+
value = "N/A";
65+
} else if (typeof value === 'string') {
66+
value = value.replace(/['"]+/g, ''); // Remove quotation marks from strings
67+
68+
if (cols[j] == "Github") { // for NeurIPS github links
69+
const regex = /\[(.*?)\]/; // Remove [] around github links
70+
const match = value.match(regex);
71+
if (match) {
72+
value = match[1]; // Extract the link without the square brackets
73+
}
74+
}
75+
const githubRegex = /(https?:\/\/(?:www\.)?github\.com\/[^\s]+)/g; // Extract GitHub links
76+
const githubMatches = value.match(githubRegex);
77+
if (githubMatches) {
78+
value = githubMatches.join(", "); // Join multiple GitHub links with a comma
79+
} else {
80+
value = "N/A"; // If no GitHub links found, set to "N/A"
81+
}
82+
}
83+
84+
// Create a container element to hold both the button and the code link
85+
let container = document.createElement("div");
86+
87+
// Button for PR
88+
const button = document.createElement("button");
89+
button.innerText = "Edit";
90+
button.classList.add("pr-button");
91+
button.addEventListener("click", () => {
92+
// Open a Pull Request for adding/correcting the code link
93+
const repoUrl = "https://github.com/utiasDSL/code-release";
94+
const pullRequestUrl = `${repoUrl}/pull/new`;
95+
const title = encodeURIComponent("Code Link Correction");
96+
const body = encodeURIComponent(`Please add/correct the code link for paper: ${jsonData[cols[0]][i]}`);
97+
const link = encodeURIComponent(value);
98+
const url = `${pullRequestUrl}?title=${title}&body=${body}&link=${link}`;
99+
window.open(url, "_blank");
100+
});
101+
102+
container.appendChild(button); // Add the button to the container
103+
container.appendChild(document.createElement("br")); // Add a line break
104+
105+
if (value != null && value.includes("github")) {
106+
const githubLinks = value.split(", ");
107+
for (let i = 0; i < githubLinks.length; i++) {
108+
// Remove trailing punctuationas or signs from the github link, if present
109+
githubLinks[i] = githubLinks[i].replace(/()[.,!?;]+$/, '');
110+
}
111+
112+
const uniqueLinks = new Set(githubLinks); // remove repetitve links
113+
uniqueLinks.forEach(link => {
114+
const codeLink = document.createElement("a");
115+
if (link.includes("github")) {
116+
codeLink.href = link;
117+
codeLink.textContent = link;
118+
} else {
119+
codeLink.textContent = "N/A";
120+
}
121+
codeLink.target = "_blank";
122+
container.appendChild(codeLink); // Add the code link to the container
123+
container.appendChild(document.createTextNode(" ")); // Add a space between the links
124+
});
125+
126+
}
127+
128+
td.appendChild(container); // Add the container to the cell
129+
130+
} else if (cols[j] == "Authors") { // remove quotation marks around authors and separate them with a comma
131+
if (value == -1) {
132+
value = "N/A";
133+
}
134+
value = value.replace(/'/g, ',');
135+
value = value.replace(/(^,)|(,$)/g, '');
136+
value = value.replace(/^,\s*/gm, '');
137+
td.textContent = value;
138+
139+
} else {
140+
if (value == -1) {
141+
value = "N/A";
142+
}
143+
td.textContent = value;
144+
}
145+
146+
tr.appendChild(td); // Add the cell to the row
147+
}
148+
table.appendChild(tr); // Add the row to the table
149+
}
150+
table.style.textAlign = "center";
151+
container.appendChild(table) // Append the table to the container element
152+
});
153+
}

0 commit comments

Comments
 (0)