From 4bedb61aa219b0add29e1c5b8fdc445fd8f918d4 Mon Sep 17 00:00:00 2001 From: aurimasv Date: Tue, 31 Dec 2013 05:56:45 -0600 Subject: [PATCH] [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 --- chrome/content/zotero/recognizePDF.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/recognizePDF.js b/chrome/content/zotero/recognizePDF.js index 92e7297b8e..4358c36c95 100644 --- 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);