Trans: Fixing abstract handling for JSTOR and SSRN, per http://forums.zotero.org/discussion/18599/

This commit is contained in:
Avram Lyon 2011-07-01 19:00:26 +00:00
parent f6c56b6b1f
commit 18bd1855dc
2 changed files with 5 additions and 5 deletions

View file

@ -124,7 +124,7 @@ function doWeb(doc, url) {
if(item.notes && item.notes[0]) {
// For some reason JSTOR exports abstract with 'AB' tag istead of 'N1'
item.abstractNote = item.notes[0].note;
item.abstractNote = item.abstractNote.replace(/^<p>ABSTRACT /,'').replace(/<\/p>$/,'');
item.abstractNote = item.abstractNote.replace(/^<p>(ABSTRACT )?/,'').replace(/<\/p>$/,'');
delete item.notes;
item.notes = undefined;
}
@ -252,4 +252,4 @@ var testCases = [
]
}
]
/** END TEST CASES **/
/** END TEST CASES **/

View file

@ -8,7 +8,7 @@
"maxVersion":"",
"priority":100,
"inRepository":true,
"lastUpdated":"2009-01-28 18:10:00"
"lastUpdated":"2011-07-01 18:10:00"
}
function detectWeb(doc, url) {
@ -83,7 +83,7 @@ function doWeb(doc, url) {
var aut = Zotero.Utilities.capitalizeTitle(Zotero.Utilities.trimInternal(author.textContent));
item.creators.push(Zotero.Utilities.cleanAuthor(aut, "author"));
}
item.abstractNote = Zotero.Utilities.trimInternal(doc.evaluate('//div[@id="innerWhite"]/font[1]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent).substr(10);
item.abstractNote = Zotero.Utilities.trimInternal(doc.evaluate('//div[@id="innerWhite"]/font[1]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent).replace(/^abstract/i,'');
var tags = doc.evaluate('//font[contains(./b/text(), "Key")]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
if (tags) {
item.tags = Zotero.Utilities.trimInternal(tags.textContent).substr(10).split(/,\s+/);
@ -109,4 +109,4 @@ function doWeb(doc, url) {
}
}, function() {Zotero.done();});
Zotero.wait();
}
}