-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathzotero-translator-tana.js
52 lines (43 loc) · 1.54 KB
/
zotero-translator-tana.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
{
"translatorID":"dda092d2-a257-46af-b9a3-2f04a55cb04f",
"translatorType":2,
"label":"Tana Metadata Export",
"creator":"Stian Håklev based on Joel Chan's work",
"target":"md",
"minVersion":"2.0",
"maxVersion":"",
"priority":200,
"inRepository":false,
"lastUpdated":"2022-09-07 - 10:15"
}
function doExport() {
Zotero.write('%%tana%%\n');
var item;
while (item = Zotero.nextItem()) {
// ref
Zotero.write('- ' + item.title + ' #publication\n');
// author
Zotero.write(' - Authored by:: \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')
// publication
Zotero.write(' - Publication:: ')
Zotero.write((item.publicationTitle ||'')+ '\n')
// zotero link
var library_id = item.libraryID ? item.libraryID : 0;
var itemLink = 'zotero://select/items/' + library_id + '_' + item.key;
Zotero.write(' - Zotero link:: ')
Zotero.write('[Zotero Link](' + itemLink + ')\n')
// url with citation
Zotero.write(' - URL:: ' + (item.url||'') + '\n')
Zotero.write(' - Abstract:: '+ (item.abstractNote || '')+ '\n')
}
}