diff --git a/chrome/content/zotero/xpcom/citeproc.js b/chrome/content/zotero/xpcom/citeproc.js
index bb82594c56..92da7b98eb 100644
--- a/chrome/content/zotero/xpcom/citeproc.js
+++ b/chrome/content/zotero/xpcom/citeproc.js
@@ -23,7 +23,7 @@
* respectively.
*/
var CSL = {
- PROCESSOR_VERSION: "1.1.121",
+ PROCESSOR_VERSION: "1.1.130",
CONDITION_LEVEL_TOP: 1,
CONDITION_LEVEL_BOTTOM: 2,
PLAIN_HYPHEN_REGEX: /(?:[^\\]-|\u2013)/,
@@ -776,7 +776,6 @@ var CSL = {
};
if (typeof require !== "undefined" && typeof module !== 'undefined' && "exports" in module) {
var CSL_IS_NODEJS = true;
- var CSL_NODEJS = require("./csl_nodejs_jsdom").CSL_NODEJS_JSDOM;
exports.CSL = CSL;
}
CSL.TERMINAL_PUNCTUATION_REGEXP = new RegExp("^([" + CSL.TERMINAL_PUNCTUATION.slice(0, -1).join("") + "])(.*)");
@@ -2729,6 +2728,11 @@ CSL.Engine.prototype.retrieveItems = function (ids) {
CSL.ITERATION = 0;
CSL.Engine.prototype.retrieveItem = function (id) {
var Item, m, pos, len, mm;
+ if (!this.tmp.loadedItemIDs[id]) {
+ this.tmp.loadedItemIDs[id] = true;
+ } else {
+ return this.registry.refhash[id];
+ }
if (this.opt.development_extensions.normalize_lang_keys_to_lowercase &&
"boolean" === typeof this.opt.development_extensions.normalize_lang_keys_to_lowercase) {
for (var i=0,ilen=this.opt["default-locale"].length; i 1
- && "string" === typeof addtoret.slice(-1)[0]
- && "string" !== typeof addtoret.slice(-2)[0]) {
- addtoret[addtoret.length-1] = (blobjr.strings.delimiter + addtoret.slice(-1)[0]);
+ if ("string" !== addtoret && addtoret.length > 1 && blobjr.strings.delimiter) {
+ var numberSeen = false;
+ for (var j=0,jlen=addtoret.length;j 1 && this.citation_sort.tokens.length > 0) {
for (i = 0, ilen = sortedItems.length; i < ilen; i += 1) {
@@ -5040,7 +5053,7 @@ CSL.Engine.prototype.processCitationCluster = function (citation, citationsPre,
for (i = 0, ilen = oldItemList.length; i < ilen; i += 1) {
oldItemIds.push("" + oldItemList[i].id);
}
- this.updateItems(oldItemIds);
+ this.updateItems(oldItemIds, null, null, true);
for (key in oldAmbigs) {
if (oldAmbigs.hasOwnProperty(key)) {
this.registry.registry[key].disambig = oldAmbigs[key];
@@ -5499,6 +5512,7 @@ CSL.getCite = function (Item, item, prevItemID, blockShadowNumberReset) {
this.parallel.StartCite(Item, item, prevItemID);
CSL.citeStart.call(this, Item, item, blockShadowNumberReset);
next = 0;
+ this.tmp.name_node = {};
this.nameOutput = new CSL.NameOutput(this, Item, item);
while (next < this[this.tmp.area].tokens.length) {
next = CSL.tokenExec.call(this, this[this.tmp.area].tokens[next], Item, item);
@@ -5987,14 +6001,17 @@ CSL.Engine.prototype.restoreProcessorState = function (citations) {
}
return ret;
};
-CSL.Engine.prototype.updateItems = function (idList, nosort, rerun_ambigs) {
+CSL.Engine.prototype.updateItems = function (idList, nosort, rerun_ambigs, implicitUpdate) {
var debug = false;
var oldArea = this.tmp.area;
var oldRoot = this.tmp.root;
var oldExtension = this.tmp.extension;
this.tmp.area = "citation";
- this.tmp.root = "citation"
- this.tmp.extension = ""
+ this.tmp.root = "citation";
+ this.tmp.extension = "";
+ if (!implicitUpdate) {
+ this.tmp.loadedItemIDs = {};
+ }
this.registry.init(idList);
if (rerun_ambigs) {
for (var ambig in this.registry.ambigcites) {
@@ -6024,6 +6041,7 @@ CSL.Engine.prototype.updateUncitedItems = function (idList, nosort) {
this.tmp.area = "citation";
this.tmp.root = "citation"
this.tmp.extension = ""
+ this.tmp.loadedItemIDs = {};
if (!idList) {
idList = [];
}
@@ -6069,7 +6087,6 @@ CSL.localeResolve = function (langstr, defaultLocale) {
langlst = langstr.split(/[\-_]/);
ret.base = CSL.LANG_BASES[langlst[0]];
if ("undefined" === typeof ret.base) {
- CSL.debug("Warning: unknown locale "+langstr+", setting fallback to "+defaultLocale);
return {base:defaultLocale, best:langstr, bare:langlst[0]};
}
if (langlst.length === 1) {
@@ -6341,6 +6358,42 @@ CSL.Engine.prototype.localeSet = function (myxml, lang_in, lang_out) {
}
}
};
+CSL.getLocaleNames = function (myxml, preferredLocale) {
+ var stylexml = CSL.setupXml(myxml);
+ function extendLocaleList(localeList, locale) {
+ var forms = ["base", "best"];
+ if (locale) {
+ normalizedLocale = CSL.localeResolve(locale);
+ for (var i=0,ilen=forms.length;i -1) {
myabbrev_family = "number";
}
+ if (myabbrev_family === "jurisdiction") {
+ if (state.opt.suppressedJurisdictions[Item.jurisdiction]) {
+ return "";
+ }
+ }
if (["publisher-place", "event-place", "jurisdiction", "archive-place", "language-name", "language-name-original"].indexOf(myabbrev_family) > -1) {
myabbrev_family = "place";
}
@@ -12554,6 +12612,15 @@ CSL.Util.fixDateNode = function (parent, pos, node) {
this.cslXml.deleteNodeByNameAttribute(datexml, 'day');
} else if ("year-month" === this.cslXml.getAttributeValue(node, "date-parts")) {
this.cslXml.deleteNodeByNameAttribute(datexml, 'day');
+ } else if ("month-day" === this.cslXml.getAttributeValue(node, "date-parts")) {
+ var childNodes = this.cslXml.children(datexml);
+ for (var i=1,ilen=childNodes.length;i0;j--) {
+ if (lst[j-1] && (!lst[j].match(/^[0-9]+([-,:a-zA-Z]*)$/) || !lst[j-1].match(/^[0-9]+([-,:a-zA-Z]*)$/))) {
+ lst[j-1] = lst[j-1] + m[j-1] + lst[j];
+ lst = lst.slice(0,j).concat(lst.slice(j+1))
+ m = m.slice(0,j-1).concat(m.slice(j))
+ }
+ }
+ if (m.length > 0 && i === 0) {
var slug = m[0].trim();
if (!CSL.STATUTE_SUBDIV_STRINGS[slug]
|| !me.getTerm(CSL.STATUTE_SUBDIV_STRINGS[slug])
@@ -13759,12 +13833,16 @@ CSL.Engine.prototype.processNumber = function (node, ItemObject, variable, type)
manglePageNumbers(values, values.length-1, currentInfo);
}
}
- function setVariableParams(obj, values) {
+ function setVariableParams(shadow_numbers, variable, values) {
+ var obj = shadow_numbers[variable];
if (values.length) {
obj.numeric = values[0].numeric;
obj.collapsible = values[0].collapsible;
obj.plural = values[0].plural;
obj.label = CSL.STATUTE_SUBDIV_STRINGS[values[0].label];
+ if (variable === "number" && obj.label === "issue" && me.getTerm("number")) {
+ obj.label = "number";
+ }
}
}
if (node && this.tmp.shadow_numbers[variable] && this.tmp.shadow_numbers[variable].values.length) {
@@ -13814,7 +13892,7 @@ CSL.Engine.prototype.processNumber = function (node, ItemObject, variable, type)
fixRanges(values);
this.tmp.shadow_numbers[variable].masterStyling = setStyling(values)
}
- setVariableParams(this.tmp.shadow_numbers[variable], values);
+ setVariableParams(this.tmp.shadow_numbers, variable, values);
}
};
CSL.Util.outputNumericField = function(state, varname, itemID) {
@@ -14825,6 +14903,7 @@ CSL.Registry = function (state) {
this.state = state;
this.registry = {};
this.reflist = [];
+ this.refhash = {};
this.namereg = new CSL.Registry.NameReg(state);
this.citationreg = new CSL.Registry.CitationReg(state);
this.authorstrings = {};
@@ -14959,6 +15038,7 @@ CSL.Registry.prototype.dodeletes = function (myhash) {
}
}
delete this.registry[key];
+ delete this.refhash[key];
this.return_data.bibchange = true;
}
}