update to citeproc-js 1.0.65
From Frank's release notes: citeproc-js 1.0.64: This release just pulls through the actual changes described in 1.0.62 and 1.0.63. Apologies for any confusion this caused. citeproc-js 1.0.65: Do not needlessly circumvent name disambiguation logic. Reverses a patch introduced in the 1.0.61 through 1.0.64 series of changes. Apply the concise and correct fix for the undefined-in-name bug previously addressed by the 1.0.61 through 1.0.64 series of releases. Just replacing an undefined variable with an empty string does the trick. Force an initialized name that lacks an explicit string value on initialize-with to full form, but only when using the by-cite disambiguation rule. Permit update of year-suffix when it is added, in addition to when it exists and then changes. Protect against an undefined value in updateItems(), which can apparently sometimes occur in the course of word processor plugin transactions. Map page-first variable to page when snooping for a value. Prevents a lone page-first cs:text node within a cs:group from being suppressed for lack of output. Repair recently amended appendCitationCluster() command to return a list of paired values, in accordance with the processor manual. Extend restoreProcessorState() to work with an empty argument, for resetting the processor to a pristine state (for use case suggested by Carles Pina).
This commit is contained in:
parent
fae0f684c1
commit
98ef051951
|
@ -1132,7 +1132,7 @@ CSL.cloneAmbigConfig = function (config, oldconfig, itemID, tainters) {
|
|||
ret.disambiguate = false;
|
||||
for (pos = 0, len = config.names.length; pos < len; pos += 1) {
|
||||
param = config.names[pos];
|
||||
if (oldconfig && oldconfig.names[pos] !== param) {
|
||||
if (oldconfig && (!oldconfig.names[pos] || oldconfig.names[pos] !== param)) {
|
||||
for (ppos = 0, llen = tainters.length; ppos < llen; ppos += 1) {
|
||||
this.tmp.taintedItemIDs[tainters[ppos].id] = true;
|
||||
}
|
||||
|
@ -1515,7 +1515,7 @@ CSL.dateParser = function (txt) {
|
|||
};
|
||||
CSL.Engine = function (sys, style, lang, xmlmode) {
|
||||
var attrs, langspec, localexml, locale;
|
||||
this.processor_version = "1.0.61";
|
||||
this.processor_version = "1.0.65";
|
||||
this.csl_version = "1.0";
|
||||
this.sys = sys;
|
||||
this.sys.xml = new CSL.System.Xml.Parsing();
|
||||
|
@ -2132,6 +2132,9 @@ CSL.Engine.prototype.restoreProcessorState = function (citations) {
|
|||
var pos, len, ppos, llen, item, Item, newitem, citationList, itemList, sortedItems;
|
||||
citationList = [];
|
||||
itemList = [];
|
||||
if (!citations) {
|
||||
citations = [];
|
||||
}
|
||||
for (pos = 0, len = citations.length; pos < len; pos += 1) {
|
||||
sortedItems = [];
|
||||
for (ppos = 0, len = citations[pos].citationItems.length; ppos < llen; ppos += 1) {
|
||||
|
@ -2152,6 +2155,9 @@ CSL.Engine.prototype.restoreProcessorState = function (citations) {
|
|||
this.updateItems(itemList);
|
||||
if (citations && citations.length) {
|
||||
this.processCitationCluster(citations[0], [], citationList.slice(1));
|
||||
} else {
|
||||
this.registry = new CSL.Registry(this);
|
||||
this.tmp = new CSL.Engine.Tmp();
|
||||
}
|
||||
};
|
||||
CSL.Engine.prototype.updateItems = function (idList, nosort) {
|
||||
|
@ -4356,7 +4362,9 @@ CSL.Node.names = {
|
|||
param = 2;
|
||||
} else if (state.tmp.disambig_request) {
|
||||
val = state.tmp.disambig_settings.givens[state.tmp.nameset_counter][ppos];
|
||||
if (val === 1 && "undefined" === typeof this.strings["initialize-with"]) {
|
||||
if (val === 1 &&
|
||||
state.opt["givenname-disambiguation-rule"] === "by-cite" &&
|
||||
"undefined" === typeof this.strings["initialize-with"]) {
|
||||
val = 2;
|
||||
}
|
||||
param = val;
|
||||
|
@ -4893,6 +4901,8 @@ CSL.Attributes["@variable"] = function (state, arg) {
|
|||
variable = "shortTitle";
|
||||
} else if (variable === "container-title") {
|
||||
variable = "journalAbbreviation";
|
||||
} else if (variable === "page-first") {
|
||||
variable = "page";
|
||||
}
|
||||
}
|
||||
if (CSL.DATE_VARIABLES.indexOf(variable) > -1) {
|
||||
|
@ -6375,6 +6385,9 @@ CSL.Util.Names.initializeWith = function (state, name, terminator) {
|
|||
if (!name) {
|
||||
return "";
|
||||
}
|
||||
if (!terminator) {
|
||||
terminator = "";
|
||||
}
|
||||
namelist = name;
|
||||
if (state.opt["initialize-with-hyphen"] === false) {
|
||||
namelist = namelist.replace(/\-/g, " ");
|
||||
|
@ -7822,9 +7835,6 @@ CSL.Registry.NameReg = function (state) {
|
|||
};
|
||||
evalname = function (item_id, nameobj, namenum, request_base, form, initials) {
|
||||
var pos, len, items, param;
|
||||
if ((!form || 'long' == form) && 'string' !== typeof initials) {
|
||||
return 2;
|
||||
}
|
||||
set_keys(this.state, item_id, nameobj);
|
||||
if ("undefined" === typeof this.namereg[pkey] || "undefined" === typeof this.namereg[pkey].ikey[ikey]) {
|
||||
return request_base;
|
||||
|
@ -8283,7 +8293,7 @@ CSL.Disambiguation.prototype.initVars = function (akey) {
|
|||
this.akey = akey;
|
||||
myItems = [];
|
||||
myIds = this.ambigcites[akey];
|
||||
if (myIds.length > 1) {
|
||||
if (myIds && myIds.length > 1) {
|
||||
for (pos = 0, len = myIds.length; pos < len; pos += 1) {
|
||||
myItems.push(this.state.retrieveItem(myIds[pos]));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user