Created
April 28, 2023 16:07
-
-
Save flrntdfr/59a34f619531be92739b1c6dde4076a0 to your computer and use it in GitHub Desktop.
Custom Zotero Exporter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"translatorID": "2340c575-cc2e-47de-aa7a-062f3a91c641", | |
"label": "du4 URI Export", | |
"creator": "Florent Dufour", | |
"target": "html", | |
"minVersion": "5.0", | |
"maxVersion": "", | |
"priority": 100, | |
"inRepository": true, | |
"translatorType": 2, | |
"lastUpdated": "2023-04-28 16:04:36" | |
} | |
function doExport() { | |
var item; | |
while(item = Zotero.nextItem()) { | |
// Collect Zotero URI | |
var library_id = item.libraryID ? item.libraryID : 0; | |
var item_key = item.key; | |
// Collect anchor text | |
var author = item.creators[0].lastName; | |
if (item.creators.length>2){ | |
author += " et al."; | |
} | |
var year = Zotero.Utilities.strToDate(item.date).year; | |
// Zotero Write | |
Zotero.write("<a href=\"zotero://select/items/" + library_id + "_" + item_key + "\">"); | |
Zotero.write(author) | |
if(year){ | |
Zotero.write(" (" + year + ")") | |
} | |
Zotero.write("</a>") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment