Update to citeproc-js 1.0.18

From Frank's announcement:
This release fixes a small issue in disambiguation, which could cause
initials or full given names to be retained where they are not
necessary to achieve disambiguation, under certain fairly rare
conditions.

This also includes a very small change to the regexp used to identify
numeric content in numeric fields, support for RTF and plain text
output (courtesy of Simon), and a modification to the ./test.py
script, adding a -E option that dumps a version of the processor with
embedded E4X support, suitable for drop-in inclusion in current Zotero
2.1.
This commit is contained in:
Simon Kornblith 2010-06-01 06:47:02 +00:00
parent 97d5483f80
commit 0aee953bf6

View File

@ -87,7 +87,7 @@ var CSL = {
STRICT: 1,
PREFIX_PUNCTUATION: /[.;:]\s*$/,
SUFFIX_PUNCTUATION: /^\s*[.;:,\(\)]/,
NUMBER_REGEXP: /(?:^\d+|\d+$|\d{3,})/, // avoid evaluating "F.2d" as numeric
NUMBER_REGEXP: /(?:^\d+|\d+$)/,
QUOTED_REGEXP_START: /^"/,
QUOTED_REGEXP_END: /^"$/,
NAME_INITIAL_REGEXP: /^([A-Z\u0080-\u017f\u0400-\u042f])([a-zA-Z\u0080-\u017f\u0400-\u052f]*|)/,
@ -1384,7 +1384,7 @@ CSL.dateParser = function (txt) {
};
CSL.Engine = function (sys, style, lang, xmlmode) {
var attrs, langspec, localexml, locale;
this.processor_version = "1.0.17";
this.processor_version = "1.0.18";
this.csl_version = "1.0";
this.sys = sys;
this.sys.xml = new CSL.System.Xml.Parsing();
@ -7493,7 +7493,7 @@ CSL.Registry.NameReg = function (state) {
};
var debug = false;
CSL.Registry.prototype.disambiguateCites = function (state, akey, modes, candidate_list) {
var ambigs, reg_token, keypos, id_vals, a, base, token, pos, len, tokens, str, maxvals, minval, testpartner, otherstr, base_return, ret, id, key;
var ambigs, reg_token, keypos, id_vals, a, base, token, pos, len, tokens, str, maxvals, minval, testpartner, otherstr, base_return, ret, id, key, givensbase, remainder, last_remainder;
if (!candidate_list) {
ambigs = this.ambigcites[akey].slice();
this.ambigcites[akey] = [];
@ -7526,6 +7526,12 @@ CSL.Registry.prototype.disambiguateCites = function (state, akey, modes, candida
maxvals = CSL.getMaxVals.call(state);
minval = CSL.getMinVal.call(state);
base = CSL.getAmbigConfig.call(state);
givensbase = [];
for (pos = 0, len = base.givens.length; pos < len; pos += 1) {
givensbase.push(base.givens[pos].slice());
}
remainder = tokens.length;
last_remainder = this.checkerator.seen.length;
while (CSL.runCheckerator.call(this.checkerator)) {
token = this.checkerator.tokens[this.checkerator.pos];
if (this.ambigcites[akey].indexOf(token.id) > -1) {
@ -7558,7 +7564,13 @@ CSL.Registry.prototype.disambiguateCites = function (state, akey, modes, candida
}
}
if (CSL.evaluateCheckeratorClashes.call(this.checkerator)) {
base_return = CSL.decrementCheckeratorNames.call(this, state, base);
remainder = tokens.length - this.checkerator.seen.length;
if (remainder === 1 && last_remainder === 0) {
base_return = CSL.decrementCheckeratorGivenNames.call(this, state, base, givensbase, token.id);
} else {
base_return = CSL.decrementCheckeratorNames.call(this, state, base, givensbase);
}
last_remainder = remainder;
this.registerAmbigToken(akey, token.id, base_return);
this.checkerator.seen.push(token.id);
continue;
@ -7763,7 +7775,17 @@ CSL.incrementCheckeratorAmbigLevel = function () {
}
}
};
CSL.decrementCheckeratorNames = function (state, base) {
CSL.decrementCheckeratorGivenNames = function (state, base, givensbase, id) {
var base_return, ids, pos, len;
ids = this.checkerator.ids;
this.checkerator.ids = ids.slice(0,ids.indexOf(id)).concat(ids.slice(ids.indexOf(id) + 1));
base_return = CSL.cloneAmbigConfig(base);
for (pos = 0, len = base_return.givens.length; pos < len; pos += 1) {
base_return.givens[pos] = givensbase.slice();
}
return base_return;
};
CSL.decrementCheckeratorNames = function (state, base, givensbase) {
var base_return, do_me, i, j, pos, len, ppos, llen;
base_return = CSL.cloneAmbigConfig(base);
do_me = false;
@ -7771,8 +7793,8 @@ CSL.decrementCheckeratorNames = function (state, base) {
for (pos = len; pos > -1; pos += -1) {
llen = base_return.givens[pos].length - 1;
for (ppos = llen; ppos > -1; ppos += -1) {
if (base_return.givens[pos][ppos] === 2) {
do_me = true;
if (base_return.givens[pos][ppos] > givensbase[pos][ppos]) {
do_me = true;
}
}
}
@ -7781,7 +7803,7 @@ CSL.decrementCheckeratorNames = function (state, base) {
for (pos = len; pos > -1; pos += -1) {
llen = base_return.givens[pos].length - 1;
for (ppos = llen; ppos > -1; ppos += -1) {
if (base_return.givens[pos][ppos] === 2) {
if (base_return.givens[pos][ppos] > givensbase[pos][ppos]) {
i = -1;
break;
}
@ -7826,4 +7848,4 @@ CSL.getModes = function () {
CSL.Registry.CitationReg = function (state) {
this.citationById = {};
this.citationByIndex = [];
};
};