{ "translatorID": "18dd188a-9afc-4cd6-8775-1980c3ce0fbf", "label": "Simple Evernote Export", "creator": "Volodymir Skipa", "target": "enex", "minVersion": "2.1.9", "maxVersion": "", "priority": 50, "displayOptions": { "exportNotes": true }, "inRepository": false, "translatorType": 2, "lastUpdated":"2019-10-11 07:30:00" } /* Evernote Export Translator Copyright (C) 2012 Volodymir Skipa This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ function doExport() { Zotero.setCharacterSet("utf-8"); var evernoteString = "\n\n\n"; var item; // eslint-disable-next-line no-cond-assign while (item = Zotero.nextItem()) { var itemString = "\n"; var title = item.title || "[Untitled]"; // encode brackets <> title = title.replace(//g, '>'); // title cannot be longer than 255 if (title.length > 252) { title = title.substr(0, 252) + "..."; } itemString += " " + title + "\n"; itemString += " \n"; itemString += " \n"; itemString += " \n"; /** NOTES **/ if (item.notes && item.notes.length > 0 && Zotero.getOption("exportNotes")) { for (let i in item.notes) { // delete all class and id attributes, because these will // otherwise create an error when importing in Evernote let noteContent = item.notes[i].note .replace(/(<[^>]*) class="[^"]+"([^>]*>)/g, "$1$2") .replace(/(<[^>]*) id="[^"]+"([^>]*>)/g, "$1$2"); // delete elements like html, body, head which might create // another problem when importing in Evernote noteContent = noteContent.replace(/<\/?(html|head|body)[^>]*>/g, ''); itemString += "
" + noteContent + "
\n"; } } itemString += "
]]>\n"; itemString += "
\n"; var dateCreated = item.dateAdded.replace(/[-:]/g, "").replace(" ", "T") + "Z"; itemString += " " + dateCreated + "\n"; var dateUpdated = item.dateModified.replace(/[-:]/g, "").replace(" ", "T") + "Z"; itemString += " " + dateUpdated + "\n"; /** TAGS **/ for (var j in item.tags) { let tag = item.tags[j].tag; // comma is not allowed in tags tag = tag.replace(/\s*,\s*/g, ' / '); // encode brackets <> tag = tag.replace(//g, '>'); // in Evernote tags must be smaller than 100 characters if (tag.length > 95) { tag = tag.substr(0, 95) + "..."; } itemString += " " + tag + "\n"; } itemString += " \n"; itemString += " web.clip\n"; itemString += " " + item.url + "\n"; itemString += " \n"; itemString += "
\n"; // replace "&" with "&" itemString = itemString.replace(/&/g, "&"); evernoteString += itemString; } Zotero.write(evernoteString); Zotero.write("
\n"); }