[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
This commit is contained in:
aurimasv 2013-12-31 05:56:45 -06:00
parent b3da19e96d
commit 4bedb61aa2

View file

@ -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);