From 03e99dc48b51b0f31b8ac95052d5ef162088c59e Mon Sep 17 00:00:00 2001 From: Silent Date: Fri, 20 Nov 2020 16:35:31 +0100 Subject: [PATCH] Fixed Issue with Date --- Markdown Item URI with Citekey.js | 57 ++++++++++++++++--------------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/Markdown Item URI with Citekey.js b/Markdown Item URI with Citekey.js index e69caea..6673230 100644 --- a/Markdown Item URI with Citekey.js +++ b/Markdown Item URI with Citekey.js @@ -1,29 +1,30 @@ { - "translatorID":"8dbf9b92-f796-4153-8f2e-ac6c157500dc", - "translatorType":2, - "label":"Markdown Item URI", - "creator":"Silent", - "target":"markdown", - "minVersion":"2.0", - "maxVersion":"", - "priority":200, - "inRepository":false, - "lastUpdated":"2020-10-15", - "local": "" -} - - - function doExport() { - var item; - while(item = Zotero.nextItem()) { - var date = Zotero.Utilities.strToDate(item.date).year; - var year = date && !isNaN(date) ? date + ". " : (typeof item.date == 'undefined'? "" : item.date + ". "); - var library_id = item.libraryID ? item.libraryID : ""; - var author_lastname = item.creators[0].lastName ? item.creators[0].lastName + ". " : ""; - var title = item.title ? "*" + item.title + "*" : ""; - var key = item.key; - - Zotero.write(`[${author_lastname}${year}${title}](zotero://select/items/${library_id}_${key})`) - } - } - + "translatorID":"d90fd4af-9eeb-4232-9feb-8fd05bcf6f8b", + "translatorType":2, + "label":"Markdown Item URI with Citekey", + "creator":"Silent", + "target":"markdown", + "minVersion":"2.0", + "maxVersion":"", + "priority":200, + "inRepository":false, + "lastUpdated":"2020-10-14" + } + + + + function doExport() { + var item; + while(item = Zotero.nextItem()) { + var date = Zotero.Utilities.strToDate(item.date).year; + + var year = date && !isNaN(date) ? date + ". " : (typeof item.date == 'undefined'? "" : item.date + ". "); + var library_id = item.libraryID ? item.libraryID : ""; + var author_lastname = item.creators[0].lastName ? item.creators[0].lastName + ". " : ""; + var title = item.title ? "*" + item.title + "*" : ""; + var key = item.key; + var citekey = item.citationKey ? `[[${item.citationKey}]]` : ""; + + Zotero.write(`[${author_lastname}${year}${title}](zotero://select/items/${library_id}_${key})${citekey}`); + } + }