Trans: Change DOI to disallow ampersands
This commit is contained in:
parent
3e49b5b632
commit
03af0aab6d
1 changed files with 9 additions and 2 deletions
|
@ -16,7 +16,14 @@ var selectArray = {};
|
||||||
|
|
||||||
// builds a list of DOIs
|
// builds a list of DOIs
|
||||||
function getDOIs(doc) {
|
function getDOIs(doc) {
|
||||||
const DOIre = /\b(10\.[\w.]+\/[^\s]+)\.?\b/igm;
|
// TODO Detect DOIs more correctly.
|
||||||
|
// The actual rules for DOIs are very lax-- but we're more strict.
|
||||||
|
// Specifically, we should allow space characters, and all Unicode
|
||||||
|
// characters except for control characters. Here, we're cheating
|
||||||
|
// by not allowing ampersands, to fix an issue with getting DOIs
|
||||||
|
// out of URLs.
|
||||||
|
// Description at: http://www.doi.org/handbook_2000/appendix_1.html#A1-4
|
||||||
|
const DOIre = /\b(10\.[\w.]+\/[^\s&]+)\.?\b/igm;
|
||||||
const DOIXPath = "//text()[contains(., '10.')]";
|
const DOIXPath = "//text()[contains(., '10.')]";
|
||||||
|
|
||||||
DOIre.lastMatch = 0;
|
DOIre.lastMatch = 0;
|
||||||
|
@ -100,4 +107,4 @@ function doWeb(doc, url) {
|
||||||
// retrieve full items asynchronously
|
// retrieve full items asynchronously
|
||||||
Zotero.wait();
|
Zotero.wait();
|
||||||
retrieveNextDOI(DOIs, doc);
|
retrieveNextDOI(DOIs, doc);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue