From bc04e18abaece7ccd8cacd1851353c87339c01cc Mon Sep 17 00:00:00 2001 From: Christopher Olah Date: Fri, 13 Jan 2017 13:11:07 -0800 Subject: [PATCH] update url links for arxiv papers --- components/citation.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/components/citation.js b/components/citation.js index 0873ce0..954052a 100644 --- a/components/citation.js +++ b/components/citation.js @@ -114,12 +114,20 @@ export default function(dom, data) { function link_string(ent){ if ("url" in ent){ - if (ent.url.slice(-4) == ".pdf"){ + var url = ent.url; + var arxiv_match = (/arxiv\.org\/abs\/([0-9\.]*)/).exec(url); + if (arxiv_match != null){ + console.log(url); + url = `http://arxiv.org/pdf/${arxiv_match[1]}.pdf`; + console.log(url); + } + + if (url.slice(-4) == ".pdf"){ var label = "PDF"; - } else if (ent.url.slice(-5) == ".html") { + } else if (url.slice(-5) == ".html") { var label = "HTML"; } - return `  [${label||"link"}]`; + return `  [${label||"link"}]`; }/* else if ("doi" in ent){ return `  [DOI]`; }*/ else {