summaryrefslogtreecommitdiff
path: root/publications.js
diff options
context:
space:
mode:
Diffstat (limited to 'publications.js')
-rw-r--r--publications.js28
1 files changed, 16 insertions, 12 deletions
diff --git a/publications.js b/publications.js
index 98867f8..22a0b59 100644
--- a/publications.js
+++ b/publications.js
@@ -20,30 +20,34 @@
*/
function escapeXml(str) {
return String(str)
- .replace(/&/g, '&')
- .replace(/</g, '&lt;')
- .replace(/>/g, '&gt;')
- .replace(/"/g, '&quot;')
- .replace(/'/g, '&apos;');
+ .replace(/&/g, "&amp;")
+ .replace(/</g, "&lt;")
+ .replace(/>/g, "&gt;")
+ .replace(/"/g, "&quot;")
+ .replace(/'/g, "&apos;");
}
async function renderPublications() {
- const list = document.querySelector('#recent-publications ul');
+ const list = document.querySelector("#recent-publications ul");
try {
- const res = await fetch('/publications.json');
+ const res = await fetch("/publications.json");
const posts = await res.json();
if (posts.length === 0) {
- list.innerHTML = '<li>No publications yet.</li>';
+ list.innerHTML = "<li>No publications yet.</li>";
return;
}
- list.innerHTML = posts.map(p => `
+ list.innerHTML = posts
+ .map(
+ (p) => `
<li>
<a href="${escapeXml(p.url)}">${escapeXml(p.title.trim())}</a>
- ${p.date ? `<div>${escapeXml(new Date(p.date).toLocaleDateString('en-US', { month: 'long', day: 'numeric', year: 'numeric' }))}</div>` : ''}
+ ${p.date ? `<div>${escapeXml(new Date(p.date).toLocaleDateString("en-US", { month: "long", day: "numeric", year: "numeric" }))}</div>` : ""}
</li>
- `).join('');
+ `,
+ )
+ .join("");
} catch (err) {
- console.error('Failed to load publications:', err);
+ console.error("Failed to load publications:", err);
list.innerHTML = "<li>Couldn't load publications right now.</li>";
}
}