commit 90922843b05927de889c295b3a0307b98db385fe
parent 62f0953988c6ec5d4cea0d00f9395f7587e1ac09
Author: Simon Kornblith <simon@simonster.com>
Date: Fri, 15 Oct 2010 23:21:21 +0000
update to citeproc-js 1.0.66
from Frank's announcement:
Adjustment to the conditions controlling the tainting of entries
carrying year-suffix values.
Avoid redundant application of year-suffix values during
disambiguation.
Provide a default "institution" format blob on the output queue, to
avoid a processor crash with lone institutional author names.
Diffstat:
1 file changed, 30 insertions(+), 18 deletions(-)
diff --git a/chrome/content/zotero/xpcom/citeproc.js b/chrome/content/zotero/xpcom/citeproc.js
@@ -1144,7 +1144,7 @@ CSL.cloneAmbigConfig = function (config, oldconfig, itemID, tainters) {
param = [];
llen = config.givens[pos].length;
for (ppos = 0; ppos < llen; ppos += 1) {
- if (oldconfig && oldconfig.givens[pos] && oldconfig.givens[pos][ppos] !== config.givens[pos][ppos]) {
+ if (oldconfig && oldconfig.givens[pos][ppos] !== config.givens[pos][ppos]) {
for (ppos = 0, llen = tainters.length; ppos < llen; ppos += 1) {
this.tmp.taintedItemIDs[tainters[ppos].id] = true;
}
@@ -1154,11 +1154,16 @@ CSL.cloneAmbigConfig = function (config, oldconfig, itemID, tainters) {
}
ret.givens.push(param);
}
- if (oldconfig && oldconfig.year_suffix !== config.year_suffix) {
- for (pos = 0, len = tainters.length; pos < len; pos += 1) {
- this.tmp.taintedItemIDs[tainters[pos].id] = true;
+ if (tainters && tainters.length > 1) {
+ if (tainters.length == 2 || (oldconfig && oldconfig.year_suffix !== config.year_suffix)) {
+ for (pos = 0, len = tainters.length; pos < len; pos += 1) {
+ var oldYS = this.registry.registry[tainters[pos].id].disambig.year_suffix;
+ if (tainters && (false === oldYS || oldYS !== pos)) {
+ this.tmp.taintedItemIDs[tainters[pos].id] = true;
+ }
+ }
+ oldconfig = false;
}
- oldconfig = false;
}
ret.year_suffix = config.year_suffix;
ret.disambiguate = config.disambiguate;
@@ -1515,7 +1520,7 @@ CSL.dateParser = function (txt) {
};
CSL.Engine = function (sys, style, lang, xmlmode) {
var attrs, langspec, localexml, locale;
- this.processor_version = "1.0.65";
+ this.processor_version = "1.0.66";
this.csl_version = "1.0";
this.sys = sys;
this.sys.xml = new CSL.System.Xml.Parsing();
@@ -4142,6 +4147,9 @@ CSL.Node.names = {
}
}
}
+ if (!state.output.getToken("institution")) {
+ state.output.addToken("institution");
+ }
len = namesets.length;
for (pos = 0; pos < len; pos += 1) {
nameset = namesets[pos];
@@ -7785,7 +7793,7 @@ CSL.Registry.prototype.registerAmbigToken = function (akey, id, ambig_config, ta
}
this.registry[id].ambig = akey;
var dome = false;
- if (this.state.tmp.taintedItemIDs) {
+ if (tainters) {
this.registry[id].disambig = CSL.cloneAmbigConfig.call(this.state, ambig_config, this.registry[id].disambig, id, tainters);
} else {
this.registry[id].disambig = CSL.cloneAmbigConfig(ambig_config);
@@ -8112,9 +8120,9 @@ CSL.Disambiguation.prototype.evalScan = function (ismax) {
CSL.Disambiguation.prototype.disNames = function (ismax) {
var pos, len;
if (this.clashes[1] === 0) {
- this.state.registry.registerAmbigToken(this.akey, this.partners[0].id, this.base, this.scanlist);
+ this.state.registry.registerAmbigToken(this.akey, this.partners[0].id, this.base);
if (this.nonpartners.length === 1) {
- this.state.registry.registerAmbigToken(this.akey, this.nonpartners[0].id, this.base, this.scanlist);
+ this.state.registry.registerAmbigToken(this.akey, this.nonpartners[0].id, this.base);
this.lists[this.listpos] = [this.base,[]];
} else {
this.lists[this.listpos] = [this.base, this.nonpartners];
@@ -8122,14 +8130,14 @@ CSL.Disambiguation.prototype.disNames = function (ismax) {
} else if (this.clashes[1] < this.clashes[0]) {
this.lists[this.listpos] = [this.base, this.partners];
if (this.nonpartners.length === 1) {
- this.state.registry.registerAmbigToken(this.akey, this.nonpartners[0].id, this.base, this.scanlist);
+ this.state.registry.registerAmbigToken(this.akey, this.nonpartners[0].id, this.base);
} else {
this.lists.push([this.base, this.nonpartners]);
}
} else {
if (ismax || this.advance_mode) {
for (pos = 0, len = this.partners.length; pos < len; pos += 1) {
- this.state.registry.registerAmbigToken(this.akey, this.partners[pos].id, this.base, this.scanlist);
+ this.state.registry.registerAmbigToken(this.akey, this.partners[pos].id, this.base);
}
if (ismax) {
this.lists[this.listpos] = [this.base, this.nonpartners];
@@ -8143,9 +8151,9 @@ CSL.Disambiguation.prototype.disGivens = function (ismax) {
var pos, len;
if (this.clashes[1] === 0) {
this.base = this.decrementNames();
- this.state.registry.registerAmbigToken(this.akey, this.partners[0].id, this.base, this.scanlist);
+ this.state.registry.registerAmbigToken(this.akey, this.partners[0].id, this.base);
if (this.nonpartners.length === 1) {
- this.state.registry.registerAmbigToken(this.akey, this.nonpartners[0].id, this.base, this.scanlist);
+ this.state.registry.registerAmbigToken(this.akey, this.nonpartners[0].id, this.base);
this.lists[this.listpos] = [this.base,[]];
} else {
this.lists[this.listpos] = [this.base, this.nonpartners];
@@ -8153,7 +8161,7 @@ CSL.Disambiguation.prototype.disGivens = function (ismax) {
} else if (this.clashes[1] < this.clashes[0]) {
this.lists[this.listpos] = [this.base, this.partners];
if (this.nonpartners.length === 1) {
- this.state.registry.registerAmbigToken(this.akey, this.nonpartners[0].id, this.base, this.scanlist);
+ this.state.registry.registerAmbigToken(this.akey, this.nonpartners[0].id, this.base);
} else {
this.lists.push([this.base, this.nonpartners]);
}
@@ -8161,7 +8169,7 @@ CSL.Disambiguation.prototype.disGivens = function (ismax) {
this.base = CSL.cloneAmbigConfig(this.oldbase);
if (ismax || this.advance_mode) {
for (pos = 0, len = this.partners.length; pos < len; pos += 1) {
- this.state.registry.registerAmbigToken(this.akey, this.partners[pos].id, this.base, this.scanlist);
+ this.state.registry.registerAmbigToken(this.akey, this.partners[pos].id, this.base);
}
if (ismax) {
this.lists[this.listpos] = [this.base, this.nonpartners];
@@ -8174,9 +8182,9 @@ CSL.Disambiguation.prototype.disGivens = function (ismax) {
CSL.Disambiguation.prototype.disExtraText = function () {
var pos, len;
if (this.clashes[1] === 0) {
- this.state.registry.registerAmbigToken(this.akey, this.partners[0].id, this.base, this.scanlist);
+ this.state.registry.registerAmbigToken(this.akey, this.partners[0].id, this.base);
if (this.nonpartners.length === 1) {
- this.state.registry.registerAmbigToken(this.akey, this.nonpartners[0].id, this.base, this.scanlist);
+ this.state.registry.registerAmbigToken(this.akey, this.nonpartners[0].id, this.base);
this.lists[this.listpos] = [this.base,[]];
} else {
this.lists[this.listpos] = [this.base, this.nonpartners];
@@ -8195,7 +8203,11 @@ CSL.Disambiguation.prototype.disYears = function () {
}
tokens.sort(this.state.registry.sorter.compareKeys);
for (pos = 0, len = tokens.length; pos < len; pos += 1) {
- this.state.registry.registerAmbigToken(this.akey, tokens[pos].id, this.base, this.scanlist);
+ if (pos === 0) {
+ this.state.registry.registerAmbigToken(this.akey, tokens[pos].id, this.base, this.scanlist);
+ } else {
+ this.state.registry.registerAmbigToken(this.akey, tokens[pos].id, this.base);
+ }
tokens[pos].disambig.year_suffix = ""+pos;
}
this.lists[this.listpos] = [this.base, []];