addresses #427, Add abstract support to translators.
-translators may now attach abstracts simply by assigning a value to item.abstractNote -added abstract support to PubMed translator
This commit is contained in:
parent
148ddfaa45
commit
91492910ad
|
@ -1196,8 +1196,6 @@ Zotero.Translate.prototype._itemDone = function(item, attachedTo) {
|
|||
} else {
|
||||
Zotero.debug("discarded field "+i+" for item: field not valid for type "+type);
|
||||
}
|
||||
} else {
|
||||
Zotero.debug("discarded field "+i+" for item: field does not exist");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1223,6 +1221,11 @@ Zotero.Translate.prototype._itemDone = function(item, attachedTo) {
|
|||
}
|
||||
}
|
||||
|
||||
// handle abstract
|
||||
if(item.abstractNote) {
|
||||
Zotero.Notes.add(item.abstractNote, myID, true);
|
||||
}
|
||||
|
||||
// handle attachments
|
||||
if(item.attachments && Zotero.Prefs.get("automaticSnapshots")) {
|
||||
Zotero.debug("HANDLING ATTACHMENTS");
|
||||
|
@ -1850,6 +1853,23 @@ Zotero.Translate.prototype._exportGetItem = function() {
|
|||
}
|
||||
} else {
|
||||
var returnItemArray = returnItem.toArray();
|
||||
|
||||
// handle abstract as abstractNote
|
||||
if(returnItem.isRegularItem()) {
|
||||
var abstractID = returnItem.getAbstract();
|
||||
|
||||
if(abstractID) {
|
||||
// look for the abstract in the notes array and remove it
|
||||
for(var i in returnItemArray.notes) {
|
||||
if(returnItemArray.notes[i].itemID == abstractID) {
|
||||
returnItemArray.abstractNote = returnItemArray.notes[i].note;
|
||||
returnItemArray.notes.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// get attachments, although only urls will be passed if exportFileData
|
||||
// is off
|
||||
returnItemArray.attachments = new Array();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
-- 125
|
||||
-- 126
|
||||
|
||||
-- ***** BEGIN LICENSE BLOCK *****
|
||||
--
|
||||
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
-- Set the following timestamp to the most recent scraper update date
|
||||
REPLACE INTO "version" VALUES ('repository', STRFTIME('%s', '2006-12-13 00:19:00'));
|
||||
REPLACE INTO "version" VALUES ('repository', STRFTIME('%s', '2006-12-14 17:53:00'));
|
||||
|
||||
REPLACE INTO translators VALUES ('96b9f483-c44d-5784-cdad-ce21b984fe01', '1.0.0b3.r1', '', '2006-12-14 00:40:00', 1, 100, 4, 'Amazon.com', 'Sean Takats', '^https?://(?:www\.)?amazon',
|
||||
'function detectWeb(doc, url) {
|
||||
|
@ -2611,7 +2611,7 @@ REPLACE INTO translators VALUES ('c54d1932-73ce-dfd4-a943-109380e06574', '1.0.0b
|
|||
}
|
||||
}');
|
||||
|
||||
REPLACE INTO translators VALUES ('fcf41bed-0cbc-3704-85c7-8062a0068a7a', '1.0.0b3.r1', '', '2006-12-12 23:41:00', 1, 100, 12, 'NCBI PubMed', 'Simon Kornblith', '^http://www\.ncbi\.nlm\.nih\.gov/entrez/query\.fcgi\?.*db=PubMed',
|
||||
REPLACE INTO translators VALUES ('fcf41bed-0cbc-3704-85c7-8062a0068a7a', '1.0.0b3.r1', '', '2006-12-14 17:53:00', 1, 100, 12, 'NCBI PubMed', 'Simon Kornblith', '^http://www\.ncbi\.nlm\.nih\.gov/entrez/query\.fcgi\?.*db=PubMed',
|
||||
'function detectWeb(doc, url) {
|
||||
var namespace = doc.documentElement.namespaceURI;
|
||||
var nsResolver = namespace ? function(prefix) {
|
||||
|
@ -2728,6 +2728,8 @@ function detectSearch(item) {
|
|||
}
|
||||
}
|
||||
|
||||
newItem.abstractNote = article.Abstract.AbstractText.toString()
|
||||
|
||||
newItem.complete();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user