commit 18bd1855dc44de9172aa2a3558e108e61fd943d7
parent f6c56b6b1f41c35909c52aef4fd2db404b6edb24
Author: Avram Lyon <ajlyon@gmail.com>
Date: Fri, 1 Jul 2011 19:00:26 +0000
Trans: Fixing abstract handling for JSTOR and SSRN, per http://forums.zotero.org/discussion/18599/
Diffstat:
2 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/translators/JSTOR.js b/translators/JSTOR.js
@@ -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 **/
-\ No newline at end of file
+/** END TEST CASES **/
diff --git a/translators/SSRN.js b/translators/SSRN.js
@@ -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();
-}
-\ No newline at end of file
+}