commit 4bedb61aa219b0add29e1c5b8fdc445fd8f918d4
parent b3da19e96df1b0e0f0db49984dc897051db9037c
Author: aurimasv <aurimas.dev@gmail.com>
Date: Tue, 31 Dec 2013 05:56:45 -0600
[Retrieve Metadata] Look for JSTOR stable URLs and convert to DOIs
Thanks to myqlarson for the suggestion. See https://forums.zotero.org/discussion/29354/1/query-limit-reached/#Item_42
Diffstat:
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/chrome/content/zotero/recognizePDF.js b/chrome/content/zotero/recognizePDF.js
@@ -75,10 +75,21 @@ var Zotero_RecognizePDF = new function() {
return _extractText(file, MAX_PAGES).then(function(lines) {
// Look for DOI - Use only first 80 lines to avoid catching article references
var allText = lines.join("\n"),
- doi = Zotero.Utilities.cleanDOI(lines.slice(0,80).join('\n')),
+ firstChunk = lines.slice(0,80).join('\n'),
+ doi = Zotero.Utilities.cleanDOI(firstChunk),
promise;
Zotero.debug(allText);
+ if(!doi) {
+ // Look for a JSTOR stable URL, which can be converted to a DOI by prepending 10.2307
+ doi = firstChunk.match(/www.\jstor\.org\/stable\/(\S+)/i);
+ if(doi) {
+ doi = Zotero.Utilities.cleanDOI(
+ doi[1].indexOf('10.') == 0 ? doi[1] : '10.2307/' + doi[1]
+ );
+ }
+ }
+
if(doi) {
// Look up DOI
Zotero.debug("RecognizePDF: Found DOI: "+doi);