Last active
October 5, 2022 06:26
-
-
Save aadimator/060beb6b1c74e31823f7ff9588d0b244 to your computer and use it in GitHub Desktop.
Tana Paste Translator
This file contains hidden or 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": "dda092d2-a257-46af-b9a3-2f04a55cb04f", | |
"label": "Tana Metadata Export", | |
"creator": "Stian Håklev based on Joel Chan's work", | |
"target": "md", | |
"minVersion": "2.0", | |
"maxVersion": "", | |
"priority": 200, | |
"inRepository": true, | |
"translatorType": 2, | |
"lastUpdated": "2022-10-04 16:29:05" | |
} | |
function doExport() { | |
Zotero.write('%%tana%%\n'); | |
var item; | |
while (item = Zotero.nextItem()) { | |
// ref | |
Zotero.write('- ' + item.title + ' #[[Academic Paper]]\n'); | |
// author | |
Zotero.write(' - Author:: \n'); | |
// write authors as indented nodes | |
for (author in item.creators){ | |
Zotero.write(' - [[' + (item.creators[author].firstName||'') + ' ' + (item.creators[author].lastName||'') + ']]\n'); | |
} | |
Zotero.write('\n'); | |
// year | |
var date = Zotero.Utilities.strToDate(item.date); | |
var dateS = (date.year) ? date.year : item.date; | |
Zotero.write(' - Year:: ') | |
Zotero.write(('[[' + dateS + ']] '||'') + '\n') | |
// citekey | |
Zotero.write(' - Citation Key:: ') | |
Zotero.write((item.citekey ||'')+ '\n') | |
// publication | |
Zotero.write(' - Published by:: ') | |
Zotero.write((item.publisher ||'')+ '\n') | |
// zotero link | |
var library_id = item.libraryID ? item.libraryID : 0; | |
var itemLink = 'zotero://select/items/' + library_id + '_' + item.key; | |
Zotero.write(' - Zotero:: ') | |
Zotero.write('[Zotero Link](' + itemLink + ')\n') | |
// url with citation | |
Zotero.write(' - Link:: ' + (item.url||'') + '\n') | |
Zotero.write(' - Abstract:: '+ (item.abstractNote || '')+ '\n') | |
} | |
}/** BEGIN TEST CASES **/ | |
var testCases = [ | |
] | |
/** END TEST CASES **/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment