From 44f4bb35b0057eca28ea7d7d93d765b9608d607d Mon Sep 17 00:00:00 2001 From: Magdalena Szweda Date: Sun, 4 Oct 2026 10:45:22 +0200 Subject: lotta fucking stuff --- publications.js | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'publications.js') 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, '>') - .replace(/"/g, '"') - .replace(/'/g, '''); + .replace(/&/g, "&") + .replace(//g, ">") + .replace(/"/g, """) + .replace(/'/g, "'"); } 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 = '
  • No publications yet.
  • '; + list.innerHTML = "
  • No publications yet.
  • "; return; } - list.innerHTML = posts.map(p => ` + list.innerHTML = posts + .map( + (p) => `
  • ${escapeXml(p.title.trim())} - ${p.date ? `
    ${escapeXml(new Date(p.date).toLocaleDateString('en-US', { month: 'long', day: 'numeric', year: 'numeric' }))}
    ` : ''} + ${p.date ? `
    ${escapeXml(new Date(p.date).toLocaleDateString("en-US", { month: "long", day: "numeric", year: "numeric" }))}
    ` : ""}
  • - `).join(''); + `, + ) + .join(""); } catch (err) { - console.error('Failed to load publications:', err); + console.error("Failed to load publications:", err); list.innerHTML = "
  • Couldn't load publications right now.
  • "; } } -- cgit v1.2.3