www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 4c6463413460fa03f814e0c66a5082b6cf45c294
parent 6591ad63af3ea85e025bcefd9e22c8299d5d6583
Author: Dan Stillman <dstillman@zotero.org>
Date:   Wed,  7 Sep 2016 18:36:24 -0400

Update citeproc-js to 1.1.121

Diffstat:
Mchrome/content/zotero/xpcom/citeproc.js | 33+++++++++++++++++++++------------
1 file changed, 21 insertions(+), 12 deletions(-)

diff --git a/chrome/content/zotero/xpcom/citeproc.js b/chrome/content/zotero/xpcom/citeproc.js @@ -23,7 +23,7 @@ * <http://www.gnu.org/licenses/> respectively. */ var CSL = { - PROCESSOR_VERSION: "1.1.119", + PROCESSOR_VERSION: "1.1.121", CONDITION_LEVEL_TOP: 1, CONDITION_LEVEL_BOTTOM: 2, PLAIN_HYPHEN_REGEX: /(?:[^\\]-|\u2013)/, @@ -7464,7 +7464,6 @@ CSL.Node.layout = { state.tmp.done_vars.push("first-reference-note-number"); } state.tmp.rendered_name = false; - state.tmp.name_node = {}; }; this.execs.push(func); func = function (state, Item) { @@ -10631,6 +10630,7 @@ CSL.Attributes["@variable"] = function (state, arg) { if (state.tmp.can_substitute.value() && state.tmp.area === "bibliography" && "string" === typeof Item[variable]) { + state.tmp.name_node.top = state.output.current.value(); state.tmp.rendered_name.push(Item[variable]); } } @@ -13193,15 +13193,19 @@ CSL.Util.substituteEnd = function (state, target) { choose_end = new CSL.Token("choose", CSL.END); CSL.Node.choose.build.call(choose_end, state, target); } - toplevel = "names" === this.name && state.build.substitute_level.value() === 0; - hasval = "string" === typeof state[state.build.area].opt["subsequent-author-substitute"]; - var subrule = state[state.build.area].opt["subsequent-author-substitute-rule"]; - if (toplevel && hasval) { + if ("names" === this.name || ("text" === this.name && this.variables_real !== "title")) { author_substitute = new CSL.Token("text", CSL.SINGLETON); func = function (state, Item) { + if (state.tmp.area !== "bibliography") return; + if ("string" !== typeof state.bibliography.opt["subsequent-author-substitute"]) return; + if (this.variables_real && !Item[this.variables_real]) return; + if (state.tmp.substituted_variable !== this.variables_real) { + return; + } + var subrule = state.bibliography.opt["subsequent-author-substitute-rule"]; var i, ilen; var printing = !state.tmp.suppress_decorations; - if (printing && state.tmp.area === "bibliography" && state.tmp.subsequent_author_substitute_ok) { + if (printing && state.tmp.subsequent_author_substitute_ok) { if (state.tmp.rendered_name) { if ("partial-each" === subrule || "partial-first" === subrule) { var dosub = true; @@ -13236,22 +13240,25 @@ CSL.Util.substituteEnd = function (state, target) { } else { var rendered_name = state.tmp.rendered_name.join(","); if (rendered_name) { - if (!rendered_name.localeCompare(state.tmp.last_rendered_name)) { + if (state.tmp.last_rendered_name && !rendered_name.localeCompare(state.tmp.last_rendered_name)) { str = new CSL.Blob(state[state.tmp.area].opt["subsequent-author-substitute"]); if (state.tmp.label_blob) { state.tmp.name_node.top.blobs = [str,state.tmp.label_blob]; + } else if (state.tmp.name_node.top.blobs.length) { + state.tmp.name_node.top.blobs[0].blobs = [str]; } else { state.tmp.name_node.top.blobs = [str]; } + state.tmp.substituted_variable = this.variables_real; } state.tmp.last_rendered_name = rendered_name; } } + state.tmp.subsequent_author_substitute_ok = false; } } }; - author_substitute.execs.push(func); - target.push(author_substitute); + this.execs.push(func); } if (("text" === this.name && !this.postponed_macro) || ["number", "date", "names"].indexOf(this.name) > -1) { func = function (state, Item) { @@ -15792,14 +15799,16 @@ CSL.Engine.prototype.retrieveAllStyleModules = function (jurisdictionList) { var ret = {}; var preferences = this.locale[this.opt.lang].opts["jurisdiction-preference"]; preferences = preferences ? preferences : []; - preferences = [null].concat(preferences); + preferences = [""].concat(preferences); for (var i=preferences.length-1;i>-1;i--) { var preference = preferences[i]; for (var j=0,jlen=jurisdictionList.length;j<jlen;j++) { var jurisdiction = jurisdictionList[j]; if (this.opt.jurisdictions_seen[jurisdiction]) continue; var res = this.sys.retrieveStyleModule(jurisdiction, preference); - this.opt.jurisdictions_seen[jurisdiction] = true; + if ((!res && !preference) || res) { + this.opt.jurisdictions_seen[jurisdiction] = true; + } if (!res) continue; ret[jurisdiction] = res; }