Skip to content

Instantly share code, notes, and snippets.

@aadimator
Last active October 5, 2022 06:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aadimator/060beb6b1c74e31823f7ff9588d0b244 to your computer and use it in GitHub Desktop.
Save aadimator/060beb6b1c74e31823f7ff9588d0b244 to your computer and use it in GitHub Desktop.
Tana Paste Translator
{
"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