From f133be72b65c2f685fac8574bf38c2549343214a Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Sun, 7 Aug 2022 21:34:20 +0200 Subject: Load publications from publications.json --- index.html | 14 ++++------- publications.json | 61 ++++++++++++++++++++++++++++++++++++++++++++++++ webserver.js | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 135 insertions(+), 10 deletions(-) create mode 100644 publications.json diff --git a/index.html b/index.html index bc52009..fe0e403 100644 --- a/index.html +++ b/index.html @@ -38,15 +38,11 @@ div.main-content{

I've also written some notes at some point.

- -

Academic publications

- +
For a list of my academic publications, click here. + +
diff --git a/publications.json b/publications.json new file mode 100644 index 0000000..aa30f17 --- /dev/null +++ b/publications.json @@ -0,0 +1,61 @@ +{ + "authors": { + "tom": "Tom Smeding", + "matthijs": "Matthijs Vákár" + }, + "pubs": [ + { + "year": 2022, + "month": 7, + "authors": ["tom", "matthijs"], + "title": "Efficient Dual-Numbers Reverse AD via Well-Known Program Transformations", + "preprint": "submitted to POPL", + "links": [ + {"type": "arxiv", "id": "2207.03418"}, + {"type": "code", "url": "https://github.com/tomsmeding/ad-dualrev-th"} + ] + }, + { + "year": 2022, + "month": 6, + "authors": ["matthijs", "tom"], + "title": "CHAD: Combinatory Homomorphic Automatic Differentiation", + "preprint": "to be published in TOPLAS", + "links": [ + {"type": "arxiv", "id": "2103.15776"}, + {"type": "code", "url": "https://github.com/VMatthijs/CHAD"} + ] + }, + { + "year": 2022, + "month": 5, + "authors": ["tom", "matthijs"], + "title": "Dual-Numbers Reverse AD, Efficiently", + "preprint": true, + "links": [ + {"type": "arxiv", "id": "2205.11368"}, + {"type": "code", "url": "https://github.com/tomsmeding/ad-dualrev-th"} + ] + }, + { + "year": 2021, + "authors": ["tom"], + "title": "Reverse Automatic Differentiation for Accelerate", + "note": "Master thesis at Utrecht University. Supervisors: Trevor McDonell, Matthijs Vákár.", + "links": [ + {"type": "pdf", "url": "https://studenttheses.uu.nl/bitstream/handle/20.500.12932/38958/report.pdf?sequence=1&isAllowed=y"}, + {"type": "code", "url": "https://github.com/tomsmeding/accelerate/tree/no-explode"} + ] + }, + { + "year": 2018, + "authors": ["tom"], + "title": "Fast Large-Integer Matrix Multiplication", + "note": "Bachelor thesis at Leiden University. Supervisors: Peter Bruin, Kristian Rietveld.", + "links": [ + {"type": "pdf", "url": "https://www.universiteitleiden.nl/binaries/content/assets/science/mi/scripties/bachelor/2017-2018/smeding-bsc-scriptie.pdf"}, + {"type": "code", "url": "https://github.com/tomsmeding/bachelor-thesis"} + ] + } + ] +} diff --git a/webserver.js b/webserver.js index f867c74..6b3a172 100755 --- a/webserver.js +++ b/webserver.js @@ -92,6 +92,68 @@ for (let i = 0; i < module_list.length; i++) { } +function padLeft(s, len, fill) { + let prefix = ""; + const num = len - s.length; + for (let i = 0; i < num; i++) prefix += fill; + return prefix + s; +} + +function buildPublicationsHTML(info) { + let res = ""; + for (const obj of info.pubs) { + if (res.length != 0) res += "\n\t\t\t"; + + res += "
  • "; + res += obj.year; + if ("month" in obj) res += "-" + padLeft(obj.month + "", 2, "0") + res += " "; + res += obj.authors.map(key => key in info.authors ? info.authors[key] : key).join(", "); + res += ": “" + obj.title + "”."; + if ("preprint" in obj) { + res += " Preprint"; + if (typeof obj.preprint == "string") res += ", " + obj.preprint; + res += "."; + } + if ("note" in obj) res += " " + obj.note; + if ("links" in obj && obj.links.length > 0) { + res += " ["; + const anchors = []; + for (const link of obj.links) { + let name, url; + switch (link.type) { + case "arxiv": + name = "arxiv"; + url = "https://arxiv.org/abs/" + link.id; + break + + case "code": + name = "code"; + url = link.url; + break; + + case "pdf": + name = "PDF"; + url = link.url; + break; + + default: + throw new Error("Unknown publication link type " + link.type); + } + anchors.push("" + name + ""); + } + res += anchors.join(", "); + res += "]" + } + res += "
  • "; + } + + return res; +} + +const publicationsHTML = buildPublicationsHTML(JSON.parse(fs.readFileSync(cmn.serverdir + "/publications.json"))); + + function anyComponentHidden(fname) { return fname[0] == "." || fname.indexOf("/.") != -1; } @@ -153,7 +215,11 @@ function makeUrlSafe(req, sliceLength) { app.get("/", function (req, res) { - res.sendFile(cmn.serverdir + "/index.html"); + // res.sendFile(cmn.serverdir + "/index.html"); + res.send( + String(fs.readFileSync(cmn.serverdir + "/index.html")) + .replace(/.*/, publicationsHTML) + ); // res.send( // String(fs.readFileSync(cmn.serverdir + "/index.html")) // .replace(//, whatpulse["keys"]) @@ -244,3 +310,5 @@ const server = httpServer.listen(PORT, function () { const port = server.address().port; console.log("Server listening at http://" + host + ":" + port); }); + +// vim: set sw=4 ts=4 noet: -- cgit v1.2.3-70-g09d2