-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathZotero_to_Orgmode.js
75 lines (72 loc) · 1.92 KB
/
Zotero_to_Orgmode.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
{
"translatorID":"e5ac0e9f-192b-4b02-a5b1-492a50638c38",
"translatorType":2,
"label":"Zotero to Orgmode",
"creator":"Alexandre Giuliani",
"target":"org",
"minVersion":"1.0",
"maxVersion":"",
"priority":200,
"inRepository":false,
"lastUpdated":"2019-05-30 04:01:00"
}
function doExport() {
var item;
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1;
var yyyy = today.getFullYear();
var hh = today.getHours();
var nn = today.getMinutes();
if(dd<10)
{
dd='0'+dd;
}
if(mm<10)
{
mm='0'+mm;
}
today = yyyy+'-'+mm+'-'+dd + ' ' + hh + ':' + nn ;
while(item = Zotero.nextItem()) {
Zotero.write("** " + item.creators[0].lastName);
var date = Zotero.Utilities.strToDate(item.date);
if (date.year) {
Zotero.write(" | " + date.year);
}
if (item.title){
Zotero.write(" | "+ item.title);
}
if (item.journalAbbreviation){
Zotero.write(" | " + item.journalAbbreviation + "\n");
} else {
Zotero.write(" | " + item.publicationTitle);
}
Zotero.write(" [" + today + "] \n");
Zotero.write(
":PROPERTIES:"+ "\n" +
" :Custum_ID: " + item.citekey + "\n" +
" :TITLE: " + item.title + "\n" +
" :AUTHORS: "
);
for (var j in item.creators) {
Zotero.write(item.creators[j].lastName + ", ");
}
Zotero.write("\n :JOURNAL: " + item.publicationTitle + "\n" +
" :YEAR: " + date.year + "\n" +
" :VOLUME: " + item.volume + "\n" +
" :PAGES: " + item.pages + "\n" +
" :TYPE: " + item.itemType + "\n" +
" :DOI: " + "doi:"+ item.DOI + "\n" +
" :URI: " + item.uri + "\n" +
" :URL: " + item.url + "\n" +
" :ABSTRACT: "+ item.abstractNote + "\n" +
" :FILES: "
);
for (var i=0; i<item.attachments.length; i++){
if(item.attachments[i].mimeType.search(/pdf/i) != -1){
Zotero.write("file:" + item.attachments[i].path + " ; ");
}
}
Zotero.write("\n:END:\n");
}
}