update to citeproc-js 1.0.105
From 1.0.100: Allow institutional names to collapse correctly when cite collapsing options are in effect. Add an option to identify Vietnamese names and format them correctly (i.e. always family name first). There is a small possibility of false positives, so the option is off by default. See the processor manual for details: http://gsl-nagoya-u.net/http/pub/citeproc-doc.html From 1.0.101: Add sortkeys array to skeleton items received during restoreProcessorState() if it is undefined. Avoids a processor crash on the first Zotero 2.1 connection to a Zotero 2.0.9 document. From 1.0.102: When rendering non-ranged cites collapsed with collapse="year- suffix", and the year suffix is implicit (not being rendered through a cs:text node with variable="year-suffix"), add the necessary splice delimiter details to the number object. Protect against undefined name.multi.main when checking headline names for a name tag. From 1.0.103: Add a reference to item data in registry objects. Provide a registry method getSortedRegistryObjects() to return current bibliography data. Document new registry method in processor manual. From 1.0.104: Make restoreProcessorState() notice that the sequence of citations has changed, and assign fresh citation IDs to duplicate citations in the input. From 1.0.105: Assure that all ids passed into an array or as a straight variable are stringified. Loosen condition statements where appropriate to treat numeric IDs of string and numeric type as equivalent.
This commit is contained in:
parent
ab07d02de0
commit
0a4fe5725e
1 changed files with 174 additions and 111 deletions
|
@ -99,7 +99,7 @@ var CSL = {
|
|||
DATE_PARTS: ["year", "month", "day"],
|
||||
DATE_PARTS_ALL: ["year", "month", "day", "season"],
|
||||
DATE_PARTS_INTERNAL: ["year", "month", "day", "year_end", "month_end", "day_end"],
|
||||
NAME_PARTS: ["family", "given", "dropping-particle", "non-dropping-particle", "suffix"],
|
||||
NAME_PARTS: ["family", "given", "dropping-particle", "non-dropping-particle", "suffix", "literal"],
|
||||
DECORABLE_NAME_PARTS: ["given", "family", "suffix"],
|
||||
DISAMBIGUATE_OPTIONS: [
|
||||
"disambiguate-add-names",
|
||||
|
@ -140,6 +140,8 @@ var CSL = {
|
|||
STARTSWITH_ROMANESQUE_REGEXP: /^[&a-zA-Z\u0080-\u017f\u0400-\u052f\u0386-\u03fb\u1f00-\u1ffe]/,
|
||||
ENDSWITH_ROMANESQUE_REGEXP: /[&a-zA-Z\u0080-\u017f\u0400-\u052f\u0386-\u03fb\u1f00-\u1ffe]$/,
|
||||
ALL_ROMANESQUE_REGEXP: /^[a-zA-Z\u0080-\u017f\u0400-\u052f\u0386-\u03fb\u1f00-\u1ffe]+$/,
|
||||
VIETNAMESE_SPECIALS: /[\u00c0-\u00c3\u00c8-\u00ca\u00cc\u00cd\u00d2-\u00d5\u00d9\u00da\u00dd\u00e0-\u00e3\u00e8-\u00ea\u00ec\u00ed\u00f2-\u00f5\u00f9\u00fa\u00fd\u0101\u0103\u0110\u0111\u0128\u0129\u0168\u0169\u01a0\u01a1\u01af\u01b0\u1ea0-\u1ef9]/,
|
||||
VIETNAMESE_NAMES: /^(?:(?:[.AaBbCcDdEeGgHhIiKkLlMmNnOoPpQqRrSsTtUuVvXxYy \u00c0-\u00c3\u00c8-\u00ca\u00cc\u00cd\u00d2-\u00d5\u00d9\u00da\u00dd\u00e0-\u00e3\u00e8-\u00ea\u00ec\u00ed\u00f2-\u00f5\u00f9\u00fa\u00fd\u0101\u0103\u0110\u0111\u0128\u0129\u0168\u0169\u01a0\u01a1\u01af\u01b0\u1ea0-\u1ef9]{2,6})(\s+|$))+$/,
|
||||
NOTE_FIELDS_REGEXP: /{:[-a-z]+:[^}]+}/g,
|
||||
NOTE_FIELD_REGEXP: /{:([-a-z]+):([^}]+)}/,
|
||||
DISPLAY_CLASSES: ["block", "left-margin", "right-inline", "indent"],
|
||||
|
@ -1220,7 +1222,7 @@ CSL.compareAmbigConfig = function(a, b) {
|
|||
}
|
||||
return 0;
|
||||
};
|
||||
CSL.cloneAmbigConfig = function (config, oldconfig, itemID, tainters) {
|
||||
CSL.cloneAmbigConfig = function (config, oldconfig, tainters) {
|
||||
var ret, param, pos, ppos, len, llen;
|
||||
ret = {};
|
||||
ret.names = [];
|
||||
|
@ -1725,7 +1727,7 @@ CSL.DateParser = function (txt) {
|
|||
};
|
||||
CSL.Engine = function (sys, style, lang, forceLang) {
|
||||
var attrs, langspec, localexml, locale;
|
||||
this.processor_version = "1.0.99";
|
||||
this.processor_version = "1.0.105";
|
||||
this.csl_version = "1.0";
|
||||
this.sys = sys;
|
||||
this.sys.xml = new CSL.System.Xml.Parsing();
|
||||
|
@ -2017,13 +2019,13 @@ CSL.Engine.prototype.retrieveItems = function (ids) {
|
|||
ret = [];
|
||||
len = ids.length;
|
||||
for (pos = 0; pos < len; pos += 1) {
|
||||
ret.push(this.retrieveItem(ids[pos]));
|
||||
ret.push(this.retrieveItem("" + ids[pos]));
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
CSL.Engine.prototype.retrieveItem = function (id) {
|
||||
var Item, m, pos, len, mm;
|
||||
Item = this.sys.retrieveItem(id);
|
||||
Item = this.sys.retrieveItem("" + id);
|
||||
if (Item.note) {
|
||||
m = CSL.NOTE_FIELDS_REGEXP.exec(Item.note);
|
||||
if (m) {
|
||||
|
@ -2131,6 +2133,13 @@ CSL.Engine.prototype.setOriginalCreatorNameFormatOption = function (arg) {
|
|||
this.opt["locale-use-original-name-format"] = false;
|
||||
}
|
||||
};
|
||||
CSL.Engine.prototype.setAutoVietnameseNamesOption = function (arg) {
|
||||
if (arg) {
|
||||
this.opt["auto-vietnamese-names"] = true;
|
||||
} else {
|
||||
this.opt["auto-vietnamese-names"] = false;
|
||||
}
|
||||
};
|
||||
CSL.Engine.Opt = function () {
|
||||
this.has_disambiguate = false;
|
||||
this.mode = "html";
|
||||
|
@ -2280,7 +2289,7 @@ CSL.Engine.prototype.setCitationId = function (citation, force) {
|
|||
id += -1;
|
||||
}
|
||||
}
|
||||
ret = id;
|
||||
ret = "" + id;
|
||||
}
|
||||
this.registry.citationreg.citationById[citation.citationID] = citation;
|
||||
return ret;
|
||||
|
@ -2292,30 +2301,61 @@ CSL.Engine.prototype.restoreProcessorState = function (citations) {
|
|||
if (!citations) {
|
||||
citations = [];
|
||||
}
|
||||
var indexNumbers = [];
|
||||
var citationIds = {};
|
||||
for (var i = 0, ilen = citations.length; i < ilen; i += 1) {
|
||||
if (citationIds[citations[i].citationID]) {
|
||||
this.setCitationId(citations[i], true);
|
||||
}
|
||||
citationIds[citations[i].citationID] = true;
|
||||
indexNumbers.push(citations[i].properties.index);
|
||||
}
|
||||
var oldCitations = citations.slice();
|
||||
oldCitations.sort(
|
||||
function (a,b) {
|
||||
if (a.properties.index < b.properties.index) {
|
||||
return -1;
|
||||
} else if (a.properties.index > b.properties.index) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
);
|
||||
for (var i = 0, ilen = oldCitations.length; i < ilen; i += 1) {
|
||||
oldCitations[i].properties.index = i;
|
||||
}
|
||||
for (var i = 0, ilen = oldCitations.length; i < ilen; i += 1) {
|
||||
sortedItems = [];
|
||||
for (var j = 0, jlen = citations[i].citationItems.length; j < jlen; j += 1) {
|
||||
item = citations[i].citationItems[j];
|
||||
Item = this.retrieveItem(item.id);
|
||||
for (var j = 0, jlen = oldCitations[i].citationItems.length; j < jlen; j += 1) {
|
||||
item = oldCitations[i].citationItems[j];
|
||||
if ("undefined" === typeof item.sortkeys) {
|
||||
item.sortkeys = [];
|
||||
}
|
||||
Item = this.retrieveItem("" + item.id);
|
||||
newitem = [Item, item];
|
||||
sortedItems.push(newitem);
|
||||
citations[i].citationItems[j].item = Item;
|
||||
itemList.push(item.id);
|
||||
oldCitations[i].citationItems[j].item = Item;
|
||||
itemList.push("" + item.id);
|
||||
}
|
||||
if (!citations[i].properties.unsorted) {
|
||||
if (!oldCitations[i].properties.unsorted) {
|
||||
sortedItems.sort(this.citation.srt.compareCompositeKeys);
|
||||
}
|
||||
citations[i].sortedItems = sortedItems;
|
||||
this.registry.citationreg.citationById[citations[i].citationID] = citations[i];
|
||||
citationList.push([citations[i].citationID, citations[i].properties.noteIndex]);
|
||||
oldCitations[i].sortedItems = sortedItems;
|
||||
this.registry.citationreg.citationById[oldCitations[i].citationID] = oldCitations[i];
|
||||
}
|
||||
this.updateItems(itemList);
|
||||
for (var i = 0, ilen = citations.length; i < ilen; i += 1) {
|
||||
citationList.push(["" + citations[i].citationID, citations[i].properties.noteIndex]);
|
||||
}
|
||||
var ret = [];
|
||||
if (citations && citations.length) {
|
||||
this.processCitationCluster(citations[0], [], citationList.slice(1));
|
||||
ret = this.processCitationCluster(citations[0], [], citationList.slice(1));
|
||||
} else {
|
||||
this.registry = new CSL.Registry(this);
|
||||
this.tmp = new CSL.Engine.Tmp();
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
CSL.Engine.prototype.updateItems = function (idList, nosort) {
|
||||
var debug = false;
|
||||
|
@ -2490,25 +2530,25 @@ CSL.getBibliographyEntries = function (bibsection) {
|
|||
bib_entry = new CSL.Token("group", CSL.START);
|
||||
bib_entry.decorations = [["@bibliography", "entry"]].concat(this[this.build.area].opt.layout_decorations);
|
||||
this.output.startTag("bib_entry", bib_entry);
|
||||
sortedItems = [[{id: item.id}, item]];
|
||||
sortedItems = [[{id: "" + item.id}, item]];
|
||||
entry_item_ids = [];
|
||||
if (this.registry.registry[item.id].master) {
|
||||
collapse_parallel = true;
|
||||
this.parallel.StartCitation(sortedItems);
|
||||
this.output.queue[0].strings.delimiter = ", ";
|
||||
entry_item_ids.push(CSL.getCite.call(this, item));
|
||||
entry_item_ids.push("" + CSL.getCite.call(this, item));
|
||||
skips[item.id] = true;
|
||||
siblings = this.registry.registry[item.id].siblings;
|
||||
for (ppos = 0, llen = siblings.length; ppos < llen; ppos += 1) {
|
||||
i = this.registry.registry[item.id].siblings[ppos];
|
||||
eyetem = this.retrieveItem(i);
|
||||
entry_item_ids.push(CSL.getCite.call(this, eyetem));
|
||||
entry_item_ids.push("" + CSL.getCite.call(this, eyetem));
|
||||
skips[eyetem.id] = true;
|
||||
}
|
||||
this.parallel.ComposeSet();
|
||||
this.parallel.PruneOutputQueue();
|
||||
} else if (!this.registry.registry[item.id].siblings) {
|
||||
entry_item_ids.push(CSL.getCite.call(this, item));
|
||||
entry_item_ids.push("" + CSL.getCite.call(this, item));
|
||||
}
|
||||
entry_item_data.push("");
|
||||
this.tmp.bibliography_pos += 1;
|
||||
|
@ -2559,7 +2599,7 @@ CSL.Engine.prototype.appendCitationCluster = function (citation) {
|
|||
len = this.registry.citationreg.citationByIndex.length;
|
||||
for (pos = 0; pos < len; pos += 1) {
|
||||
c = this.registry.citationreg.citationByIndex[pos];
|
||||
citationsPre.push([c.citationID, c.properties.noteIndex]);
|
||||
citationsPre.push(["" + c.citationID, c.properties.noteIndex]);
|
||||
}
|
||||
return this.processCitationCluster(citation, citationsPre, [])[1];
|
||||
};
|
||||
|
@ -2573,14 +2613,14 @@ CSL.Engine.prototype.processCitationCluster = function (citation, citationsPre,
|
|||
if (flag === CSL.PREVIEW) {
|
||||
var oldCitationList = this.registry.citationreg.citationByIndex.slice();
|
||||
var oldItemList = this.registry.reflist.slice();
|
||||
var newCitationList = citationsPre.concat([[citation.citationID, citation.properties.noteIndex]]).concat(citationsPost);
|
||||
var newCitationList = citationsPre.concat([["" + citation.citationID, citation.properties.noteIndex]]).concat(citationsPost);
|
||||
var newItemIds = {};
|
||||
var newItemIdsList = [];
|
||||
for (pos = 0, len = newCitationList.length; pos < len; pos += 1) {
|
||||
c = this.registry.citationreg.citationById[newCitationList[pos][0]];
|
||||
for (ppos = 0, llen = c.citationItems.length; ppos < llen; ppos += 1) {
|
||||
newItemIds[c.citationItems[ppos].id] = true;
|
||||
newItemIdsList.push(c.citationItems[ppos].id);
|
||||
newItemIdsList.push("" + c.citationItems[ppos].id);
|
||||
}
|
||||
}
|
||||
var oldAmbigs = {};
|
||||
|
@ -2602,7 +2642,7 @@ CSL.Engine.prototype.processCitationCluster = function (citation, citationsPre,
|
|||
len = citation.citationItems.length;
|
||||
for (pos = 0; pos < len; pos += 1) {
|
||||
item = citation.citationItems[pos];
|
||||
Item = this.retrieveItem(item.id);
|
||||
Item = this.retrieveItem("" + item.id);
|
||||
newitem = [Item, item];
|
||||
sortedItems.push(newitem);
|
||||
citation.citationItems[pos].item = Item;
|
||||
|
@ -2646,7 +2686,7 @@ CSL.Engine.prototype.processCitationCluster = function (citation, citationsPre,
|
|||
item = citationByIndex[pos].sortedItems[ppos];
|
||||
if (!this.registry.citationreg.citationsByItemId[item[1].id]) {
|
||||
this.registry.citationreg.citationsByItemId[item[1].id] = [];
|
||||
update_items.push(item[1].id);
|
||||
update_items.push("" + item[1].id);
|
||||
}
|
||||
if (this.registry.citationreg.citationsByItemId[item[1].id].indexOf(citationByIndex[pos]) === -1) {
|
||||
this.registry.citationreg.citationsByItemId[item[1].id].push(citationByIndex[pos]);
|
||||
|
@ -2678,7 +2718,7 @@ CSL.Engine.prototype.processCitationCluster = function (citation, citationsPre,
|
|||
for (pppos = 0; pppos < lllen; pppos += 1) {
|
||||
item = citations[ppos].sortedItems[pppos];
|
||||
if (flag === CSL.PREVIEW) {
|
||||
if (onecitation.citationID !== citation.citationID) {
|
||||
if (onecitation.citationID != citation.citationID) {
|
||||
if ("undefined" === typeof first_ref[item[1].id]) {
|
||||
first_ref[item[1].id] = onecitation.properties.noteIndex;
|
||||
last_ref[item[1].id] = onecitation.properties.noteIndex;
|
||||
|
@ -2704,13 +2744,13 @@ CSL.Engine.prototype.processCitationCluster = function (citation, citationsPre,
|
|||
if (ppos > 0 && parseInt(pppos, 10) === 0) {
|
||||
items = citations[(ppos - 1)].sortedItems;
|
||||
useme = false;
|
||||
if ((citations[(ppos - 1)].sortedItems[0][1].id == item[1].id && citations[ppos - 1].properties.noteIndex >= (citations[ppos].properties.noteIndex - 1)) || citations[(ppos - 1)].sortedItems[0][1].id == this.registry.registry[item[1].id].parallel) {
|
||||
if ((citations[(ppos - 1)].sortedItems[0][1].id == item[1].id && citations[ppos - 1].properties.noteIndex >= (citations[ppos].properties.noteIndex - 1)) || citations[(ppos - 1)].sortedItems[0][1].id == this.registry.registry[item[1].id].parallel) {
|
||||
useme = true;
|
||||
}
|
||||
llllen = items.slice(1).length;
|
||||
for (ppppos = 0; ppppos < llllen; ppppos += 1) {
|
||||
i = items.slice(1)[ppppos];
|
||||
if (!this.registry.registry[i[1].id].parallel || this.registry.registry[i[1].id].parallel === this.registry.registry[i[1].id]) {
|
||||
if (!this.registry.registry[i[1].id].parallel || this.registry.registry[i[1].id].parallel == this.registry.registry[i[1].id]) {
|
||||
useme = false;
|
||||
}
|
||||
}
|
||||
|
@ -2719,7 +2759,7 @@ CSL.Engine.prototype.processCitationCluster = function (citation, citationsPre,
|
|||
} else {
|
||||
suprame = true;
|
||||
}
|
||||
} else if (pppos > 0 && onecitation.sortedItems[(pppos - 1)][1].id === item[1].id) {
|
||||
} else if (pppos > 0 && onecitation.sortedItems[(pppos - 1)][1].id == item[1].id) {
|
||||
ibidme = true;
|
||||
} else {
|
||||
suprame = true;
|
||||
|
@ -2752,19 +2792,19 @@ CSL.Engine.prototype.processCitationCluster = function (citation, citationsPre,
|
|||
}
|
||||
if (suprame) {
|
||||
item[1].position = CSL.POSITION_SUBSEQUENT;
|
||||
if (first_ref[item[1].id] !== onecitation.properties.noteIndex) {
|
||||
if (first_ref[item[1].id] != onecitation.properties.noteIndex) {
|
||||
item[1]["first-reference-note-number"] = first_ref[item[1].id];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (onecitation.properties.noteIndex) {
|
||||
note_distance = onecitation.properties.noteIndex - last_ref[item[1].id];
|
||||
note_distance = parseInt(onecitation.properties.noteIndex, 10) - parseInt(last_ref[item[1].id], 10);
|
||||
if (note_distance <= this.citation.opt["near-note-distance"]) {
|
||||
item[1]["near-note"] = true;
|
||||
}
|
||||
last_ref[item[1].id] = onecitation.properties.noteIndex;
|
||||
}
|
||||
if (onecitation.citationID !== citation.citationID) {
|
||||
if (onecitation.citationID != citation.citationID) {
|
||||
llllen = CSL.POSITION_TEST_VARS.length;
|
||||
for (ppppos = 0; ppppos < llllen; ppppos += 1) {
|
||||
param = CSL.POSITION_TEST_VARS[ppppos];
|
||||
|
@ -2804,7 +2844,7 @@ CSL.Engine.prototype.processCitationCluster = function (citation, citationsPre,
|
|||
}
|
||||
oldItemIds = [];
|
||||
for (pos = 0, len = oldItemList.length; pos < len; pos += 1) {
|
||||
oldItemIds.push(oldItemList[pos].id);
|
||||
oldItemIds.push("" + oldItemList[pos].id);
|
||||
}
|
||||
this.updateItems(oldItemIds);
|
||||
for (key in oldAmbigs) {
|
||||
|
@ -2813,13 +2853,13 @@ CSL.Engine.prototype.processCitationCluster = function (citation, citationsPre,
|
|||
} else {
|
||||
for (key in this.tmp.taintedCitationIDs) {
|
||||
if (this.tmp.taintedCitationIDs.hasOwnProperty(key)) {
|
||||
if (key === citation.citationID) {
|
||||
if (key == citation.citationID) {
|
||||
continue;
|
||||
}
|
||||
var mycitation = this.registry.citationreg.citationById[key];
|
||||
this.tmp.citation_pos = mycitation.properties.index;
|
||||
this.tmp.citation_note_index = mycitation.properties.noteIndex;
|
||||
this.tmp.citation_id = mycitation.citationID;
|
||||
this.tmp.citation_id = "" + mycitation.citationID;
|
||||
obj = [];
|
||||
obj.push(mycitation.properties.index);
|
||||
obj.push(this.process_CitationCluster.call(this, mycitation.sortedItems));
|
||||
|
@ -2831,7 +2871,7 @@ CSL.Engine.prototype.processCitationCluster = function (citation, citationsPre,
|
|||
this.tmp.taintedCitationIDs = false;
|
||||
this.tmp.citation_pos = citation.properties.index;
|
||||
this.tmp.citation_note_index = citation.properties.noteIndex;
|
||||
this.tmp.citation_id = citation.citationID;
|
||||
this.tmp.citation_id = "" + citation.citationID;
|
||||
obj = [];
|
||||
obj.push(citationsPre.length);
|
||||
obj.push(this.process_CitationCluster.call(this, sortedItems));
|
||||
|
@ -2861,7 +2901,7 @@ CSL.Engine.prototype.makeCitationCluster = function (rawList) {
|
|||
len = rawList.length;
|
||||
for (pos = 0; pos < len; pos += 1) {
|
||||
item = rawList[pos];
|
||||
Item = this.retrieveItem(item.id);
|
||||
Item = this.retrieveItem("" + item.id);
|
||||
newitem = [Item, item];
|
||||
inputList.push(newitem);
|
||||
}
|
||||
|
@ -2932,17 +2972,17 @@ CSL.getCitationCluster = function (inputList, citationID) {
|
|||
last_collapsed = this.tmp.have_collapsed;
|
||||
params = {};
|
||||
if (pos > 0) {
|
||||
CSL.getCite.call(this, Item, item, inputList[(pos - 1)][1].id);
|
||||
CSL.getCite.call(this, Item, item, "" + inputList[(pos - 1)][1].id);
|
||||
} else {
|
||||
this.tmp.term_predecessor = false;
|
||||
CSL.getCite.call(this, Item, item);
|
||||
}
|
||||
if (!this.tmp.cite_renders_content) {
|
||||
error_object = {
|
||||
citationID: this.tmp.citation_id,
|
||||
citationID: "" + this.tmp.citation_id,
|
||||
index: this.tmp.citation_pos,
|
||||
noteIndex: this.tmp.citation_note_index,
|
||||
itemID: Item.id,
|
||||
itemID: "" + Item.id,
|
||||
citationItems_pos: pos,
|
||||
error_code: CSL.ERROR_NO_RENDERED_FORM
|
||||
};
|
||||
|
@ -3078,13 +3118,13 @@ CSL.getCite = function (Item, item, prevItemID) {
|
|||
if (this.tmp.area === "bibliography") {
|
||||
error_object = {
|
||||
index: this.tmp.bibliography_pos,
|
||||
itemID: Item.id,
|
||||
itemID: "" + Item.id,
|
||||
error_code: CSL.ERROR_NO_RENDERED_FORM
|
||||
};
|
||||
this.tmp.bibliography_errors.push(error_object);
|
||||
}
|
||||
}
|
||||
return Item.id;
|
||||
return "" + Item.id;
|
||||
};
|
||||
CSL.citeStart = function (Item) {
|
||||
this.tmp.lastchr = "";
|
||||
|
@ -3588,6 +3628,12 @@ CSL.Node["date-part"] = {
|
|||
number = new CSL.NumericBlob(num, this);
|
||||
formatter = new CSL.Util.Suffixator(CSL.SUFFIX_CHARS);
|
||||
number.setFormatter(formatter);
|
||||
if (state[state.tmp.area].opt.collapse === "year-suffix-ranged") {
|
||||
number.range_prefix = "-";
|
||||
}
|
||||
if (state[state.tmp.area].opt["year-suffix-delimiter"]) {
|
||||
number.successor_prefix = state[state.build.area].opt["year-suffix-delimiter"];
|
||||
}
|
||||
state.output.append(number, "literal");
|
||||
}
|
||||
}
|
||||
|
@ -3911,9 +3957,8 @@ CSL.Node.key = {
|
|||
if ("undefined" === typeof dp) {
|
||||
dp = {};
|
||||
}
|
||||
len = CSL.DATE_PARTS_INTERNAL.length;
|
||||
for (pos = 0; pos < len; pos += 1) {
|
||||
elem = CSL.DATE_PARTS_INTERNAL[pos];
|
||||
for (var i = 0, ilen = CSL.DATE_PARTS_INTERNAL.length; i < ilen; i += 1) {
|
||||
elem = CSL.DATE_PARTS_INTERNAL[i];
|
||||
value = 0;
|
||||
e = elem;
|
||||
if (e.slice(-4) === "_end") {
|
||||
|
@ -3956,11 +4001,10 @@ CSL.Node.key = {
|
|||
tlen = target.length;
|
||||
keypos = false;
|
||||
CSL.expandMacro.call(state, token);
|
||||
len = target.slice(tlen).length;
|
||||
for (pos = 0; pos < len; pos += 1) {
|
||||
tok = target.slice(tlen)[pos];
|
||||
for (var i = 0, ilen = target.slice(tlen).length; i < ilen; i += 1) {
|
||||
tok = target.slice(tlen)[i];
|
||||
if (tok && tok.name === "text" && tok.dateparts) {
|
||||
keypos = pos;
|
||||
keypos = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -4361,7 +4405,7 @@ CSL.Node.names = {
|
|||
}
|
||||
lllen = lllst.length;
|
||||
for (pppos = 0; pppos < lllen; pppos += 1) {
|
||||
name = {literal: lllst[pppos]};
|
||||
name = {literal: lllst[pppos], family:'', given:''};
|
||||
nameset.names.push(name);
|
||||
}
|
||||
tnamesets.push(nameset);
|
||||
|
@ -4731,7 +4775,7 @@ CSL.Node.names = {
|
|||
local_count += display_names.length;
|
||||
llen = nameset.names.length;
|
||||
for (ppos = 0; ppos < llen; ppos += 1) {
|
||||
state.registry.namereg.addname(Item.id, nameset.names[ppos], ppos);
|
||||
state.registry.namereg.addname("" + Item.id, nameset.names[ppos], ppos);
|
||||
chk = state.tmp.disambig_settings.givens[state.tmp.nameset_counter];
|
||||
if ("undefined" === typeof chk) {
|
||||
state.tmp.disambig_settings.givens.push([]);
|
||||
|
@ -4740,12 +4784,12 @@ CSL.Node.names = {
|
|||
if ("undefined" === typeof chk) {
|
||||
myform = state.output.getToken("name").strings.form;
|
||||
myinitials = this.strings["initialize-with"];
|
||||
param = state.registry.namereg.evalname(Item.id, nameset.names[ppos], ppos, 0, myform, myinitials);
|
||||
param = state.registry.namereg.evalname("" + Item.id, nameset.names[ppos], ppos, 0, myform, myinitials);
|
||||
state.tmp.disambig_settings.givens[state.tmp.nameset_counter].push(param);
|
||||
}
|
||||
myform = state.output.getToken("name").strings.form;
|
||||
myinitials = this.strings["initialize-with"];
|
||||
paramx = state.registry.namereg.evalname(Item.id, nameset.names[ppos], ppos, 0, myform, myinitials);
|
||||
paramx = state.registry.namereg.evalname("" + Item.id, nameset.names[ppos], ppos, 0, myform, myinitials);
|
||||
if (state.tmp.sort_key_flag) {
|
||||
state.tmp.disambig_settings.givens[state.tmp.nameset_counter][ppos] = 2;
|
||||
param = 2;
|
||||
|
@ -4758,7 +4802,7 @@ CSL.Node.names = {
|
|||
}
|
||||
param = val;
|
||||
if (state.opt["disambiguate-add-givenname"]) {
|
||||
param = state.registry.namereg.evalname(Item.id, nameset.names[ppos], ppos, param, state.output.getToken("name").strings.form, this.strings["initialize-with"]);
|
||||
param = state.registry.namereg.evalname("" + Item.id, nameset.names[ppos], ppos, param, state.output.getToken("name").strings.form, this.strings["initialize-with"]);
|
||||
}
|
||||
} else {
|
||||
param = paramx;
|
||||
|
@ -5054,7 +5098,7 @@ CSL.Node.text = {
|
|||
this.successor_prefix = state[state.build.area].opt.layout_delimiter;
|
||||
this.splice_prefix = state[state.build.area].opt.layout_delimiter;
|
||||
func = function (state, Item, item) {
|
||||
id = Item.id;
|
||||
id = "" + Item.id;
|
||||
if (!state.tmp.just_looking) {
|
||||
if (item && item["author-only"]) {
|
||||
state.tmp.element_trace.replace("do-not-suppress-me");
|
||||
|
@ -6209,6 +6253,23 @@ CSL.Transform = function (state) {
|
|||
}
|
||||
}
|
||||
this.output = output;
|
||||
function getStaticOrder (name, refresh) {
|
||||
var static_ordering_val = false;
|
||||
if (!refresh && name["static-ordering"]) {
|
||||
static_ordering_val = true;
|
||||
} else if (!(name.family.replace('"', '', 'g') + name.given).match(CSL.ROMANESQUE_REGEXP)) {
|
||||
static_ordering_val = true;
|
||||
} else if (name.multi && name.multi.main && name.multi.main.slice(0,2) == 'vn') {
|
||||
static_ordering_val = true;
|
||||
} else {
|
||||
if (state.opt['auto-vietnamese-names']
|
||||
&& (CSL.VIETNAMESE_NAMES.exec(name.family + " " + name.given)
|
||||
&& CSL.VIETNAMESE_SPECIALS.exec(name.family + name.given))) {
|
||||
static_ordering_val = true;
|
||||
}
|
||||
}
|
||||
return static_ordering_val;
|
||||
}
|
||||
function name (state, name, langTags) {
|
||||
var i, ret, optLangTag, ilen, key, langTag;
|
||||
if (state.tmp.area.slice(-5) === "_sort") {
|
||||
|
@ -6223,15 +6284,10 @@ CSL.Transform = function (state) {
|
|||
if (!name.given) {
|
||||
name.given = "";
|
||||
}
|
||||
var static_ordering_val = false;
|
||||
var static_ordering_freshcheck = false;
|
||||
var block_initialize = false;
|
||||
var transliterated = false;
|
||||
if (name["static-ordering"]) {
|
||||
static_ordering_val = true;
|
||||
} else if (!(name.family.replace('"', '', 'g') + name.given).match(CSL.ROMANESQUE_REGEXP)) {
|
||||
static_ordering_val = true;
|
||||
}
|
||||
var static_ordering_val = getStaticOrder(name);
|
||||
if (langTags && name.multi) {
|
||||
for (i = 0, ilen = langTags.length; i < ilen; i += 1) {
|
||||
langTag = langTags[i];
|
||||
|
@ -6262,7 +6318,7 @@ CSL.Transform = function (state) {
|
|||
block_initialize:block_initialize
|
||||
}
|
||||
if (static_ordering_freshcheck &&
|
||||
(name.family.replace('"','','g') + name.given).match(CSL.ROMANESQUE_REGEXP)) {
|
||||
!getStaticOrder(name, true)) {
|
||||
name["static-ordering"] = false;
|
||||
}
|
||||
if (state.opt["parse-names"]
|
||||
|
@ -6311,7 +6367,7 @@ CSL.Parallel.prototype.StartCitation = function (sortedItems, out) {
|
|||
CSL.Parallel.prototype.StartCite = function (Item, item, prevItemID) {
|
||||
var position, len, pos, x, curr, master, last_id, prev_locator, curr_locator, is_master, parallel;
|
||||
if (this.use_parallels) {
|
||||
if (this.sets.value().length && this.sets.value()[0].itemId === Item.id) {
|
||||
if (this.sets.value().length && this.sets.value()[0].itemId == Item.id) {
|
||||
this.ComposeSet();
|
||||
}
|
||||
this.sortedItemsPos += 1;
|
||||
|
@ -6338,18 +6394,18 @@ CSL.Parallel.prototype.StartCite = function (Item, item, prevItemID) {
|
|||
this.cite.back_forceme = [];
|
||||
this.cite.position = position;
|
||||
this.cite.Item = Item;
|
||||
this.cite.itemId = Item.id;
|
||||
this.cite.prevItemID = prevItemID;
|
||||
this.cite.itemId = "" + Item.id;
|
||||
this.cite.prevItemID = "" + prevItemID;
|
||||
this.target = "front";
|
||||
if (this.sortedItems && this.sortedItemsPos > 0 && this.sortedItemsPos < this.sortedItems.length) {
|
||||
curr = this.sortedItems[this.sortedItemsPos][1];
|
||||
last_id = this.sortedItems[(this.sortedItemsPos - 1)][1].id;
|
||||
last_id = "" + this.sortedItems[(this.sortedItemsPos - 1)][1].id;
|
||||
master = this.state.registry.registry[last_id].parallel;
|
||||
prev_locator = false;
|
||||
if (master === curr.id) {
|
||||
if (master == curr.id) {
|
||||
len = this.sortedItemsPos - 1;
|
||||
for (pos = len; pos > -1; pos += -1) {
|
||||
if (this.sortedItems[pos][1].id === Item.id) {
|
||||
if (this.sortedItems[pos][1].id == Item.id) {
|
||||
prev_locator = this.sortedItems[pos][1].locator;
|
||||
break;
|
||||
}
|
||||
|
@ -7050,7 +7106,7 @@ CSL.Util.Names.compareNamesets = function (base_nameset, nameset) {
|
|||
llen = CSL.NAME_PARTS.length;
|
||||
for (ppos = 0; ppos < llen; ppos += 1) {
|
||||
part = CSL.NAME_PARTS[ppos];
|
||||
if (!base_nameset.names[pos] || base_nameset.names[pos][part] !== name[part]) {
|
||||
if (!base_nameset.names[pos] || base_nameset.names[pos][part] != name[part]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -8319,9 +8375,15 @@ CSL.Registry = function (state) {
|
|||
this.sorter = new CSL.Registry.Comparifier(state, "bibliography_sort");
|
||||
this.getSortedIds = function () {
|
||||
ret = [];
|
||||
len = this.reflist.length;
|
||||
for (pos = 0; pos < len; pos += 1) {
|
||||
ret.push(this.reflist[pos].id);
|
||||
for (i = 0, ilen = this.reflist.length; i < ilen; i += 1) {
|
||||
ret.push("" + this.reflist[i].id);
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
this.getSortedRegistryItems = function () {
|
||||
ret = [];
|
||||
for (i = 0, ilen = this.reflist.length; i < ilen; i += 1) {
|
||||
ret.push(this.reflist[i]);
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
@ -8371,7 +8433,7 @@ CSL.Registry.prototype.dodeletes = function (myhash) {
|
|||
}
|
||||
len = this.ambigcites[ambig].length;
|
||||
for (pos = 0; pos < len; pos += 1) {
|
||||
id = this.ambigcites[ambig][pos];
|
||||
id = "" + this.ambigcites[ambig][pos];
|
||||
this.refreshes[id] = true;
|
||||
}
|
||||
delete this.registry[key];
|
||||
|
@ -8392,13 +8454,14 @@ CSL.Registry.prototype.doinserts = function (mylist) {
|
|||
akey = CSL.getAmbiguousCite.call(this.state, Item);
|
||||
this.akeys[akey] = true;
|
||||
newitem = {
|
||||
"id": item,
|
||||
"id": "" + item,
|
||||
"seq": 0,
|
||||
"offset": 0,
|
||||
"sortkeys": false,
|
||||
"ambig": false,
|
||||
"rendered": false,
|
||||
"disambig": false
|
||||
"disambig": false,
|
||||
"ref": Item
|
||||
};
|
||||
this.registry[item] = newitem;
|
||||
abase = CSL.getAmbigConfig.call(this.state);
|
||||
|
@ -8469,7 +8532,7 @@ CSL.Registry.prototype.renumber = function () {
|
|||
for (pos = 0; pos < len; pos += 1) {
|
||||
item = this.reflist[pos];
|
||||
item.seq = (pos + 1);
|
||||
if (this.state.tmp.taintedItemIDs && item.seq !== this.oldseq[item.id]) {
|
||||
if (this.state.tmp.taintedItemIDs && item.seq != this.oldseq[item.id]) {
|
||||
if (this.state.opt.update_mode === CSL.NUMERIC) {
|
||||
this.state.tmp.taintedItemIDs[item.id] = true;
|
||||
}
|
||||
|
@ -8542,7 +8605,7 @@ CSL.Registry.prototype.registerAmbigToken = function (akey, id, ambig_config, ta
|
|||
this.registry[id].ambig = akey;
|
||||
var dome = false;
|
||||
if (tainters) {
|
||||
this.registry[id].disambig = CSL.cloneAmbigConfig.call(this.state, ambig_config, this.registry[id].disambig, id, tainters);
|
||||
this.registry[id].disambig = CSL.cloneAmbigConfig.call(this.state, ambig_config, this.registry[id].disambig, tainters);
|
||||
} else {
|
||||
this.registry[id].disambig = CSL.cloneAmbigConfig(ambig_config);
|
||||
}
|
||||
|
@ -8590,13 +8653,13 @@ CSL.Registry.NameReg = function (state) {
|
|||
}
|
||||
ikey = CSL.Util.Names.initializeWith(state, skey, "%s");
|
||||
if (state.opt["givenname-disambiguation-rule"] === "by-cite") {
|
||||
pkey = itemid + pkey;
|
||||
pkey = "" + itemid + pkey;
|
||||
}
|
||||
};
|
||||
evalname = function (item_id, nameobj, namenum, request_base, form, initials) {
|
||||
var pos, len, items, param;
|
||||
var nameobj = state.transform.name(state, nameobj, state.opt["locale-pri"]);
|
||||
set_keys(this.state, item_id, nameobj);
|
||||
set_keys(this.state, "" + item_id, nameobj);
|
||||
if ("undefined" === typeof this.namereg[pkey] || "undefined" === typeof this.namereg[pkey].ikey[ikey]) {
|
||||
return request_base;
|
||||
}
|
||||
|
@ -8633,7 +8696,7 @@ CSL.Registry.NameReg = function (state) {
|
|||
}
|
||||
}
|
||||
if (param === 0) {
|
||||
pos = this.namereg[pkey].ikey[ikey].items.indexOf(item_id);
|
||||
pos = this.namereg[pkey].ikey[ikey].items.indexOf("" + item_id);
|
||||
items = this.namereg[pkey].ikey[ikey].items;
|
||||
if (pos > -1) {
|
||||
items = items.slice(0, pos).concat(items.slice(pos + 1));
|
||||
|
@ -8641,7 +8704,7 @@ CSL.Registry.NameReg = function (state) {
|
|||
for (pos = 0, len = items.length; pos < len; pos += 1) {
|
||||
this.state.tmp.taintedItemIDs[items[pos]] = true;
|
||||
}
|
||||
pos = this.namereg[pkey].ikey[ikey].skey[skey].items.indexOf(item_id);
|
||||
pos = this.namereg[pkey].ikey[ikey].skey[skey].items.indexOf("" + item_id);
|
||||
items = this.namereg[pkey].ikey[ikey].skey[skey].items;
|
||||
if (pos > -1) {
|
||||
items = items.slice(0, pos).concat(items.slice(pos + 1));
|
||||
|
@ -8649,11 +8712,11 @@ CSL.Registry.NameReg = function (state) {
|
|||
for (pos = 0, len = items.length; pos < len; pos += 1) {
|
||||
this.state.tmp.taintedItemIDs[items[pos]] = true;
|
||||
}
|
||||
if (this.namereg[pkey].items.indexOf(item_id) === -1) {
|
||||
this.namereg[pkey].items.push(item_id);
|
||||
if (this.namereg[pkey].items.indexOf("" + item_id) === -1) {
|
||||
this.namereg[pkey].items.push("" + item_id);
|
||||
}
|
||||
} else if (param === 1) {
|
||||
pos = this.namereg[pkey].items.indexOf(item_id);
|
||||
pos = this.namereg[pkey].items.indexOf("" + item_id);
|
||||
items = this.namereg[pkey].items;
|
||||
if (pos > -1) {
|
||||
items = items.slice(0, pos).concat(items.slice(pos + 1));
|
||||
|
@ -8661,7 +8724,7 @@ CSL.Registry.NameReg = function (state) {
|
|||
for (pos = 0, len = items.length; pos < len; pos += 1) {
|
||||
this.state.tmp.taintedItemIDs[items[pos]] = true;
|
||||
}
|
||||
pos = this.namereg[pkey].ikey[ikey].skey[skey].items.indexOf(item_id);
|
||||
pos = this.namereg[pkey].ikey[ikey].skey[skey].items.indexOf("" + item_id);
|
||||
items = this.namereg[pkey].ikey[ikey].skey[skey].items;
|
||||
if (pos > -1) {
|
||||
items = items.slice(0, pos).concat(items.slice(pos + 1));
|
||||
|
@ -8669,11 +8732,11 @@ CSL.Registry.NameReg = function (state) {
|
|||
for (pos = 0, len = items.length; pos < len; pos += 1) {
|
||||
this.state.tmp.taintedItemIDs[items[pos]] = true;
|
||||
}
|
||||
if (this.namereg[pkey].ikey[ikey].items.indexOf(item_id) === -1) {
|
||||
this.namereg[pkey].ikey[ikey].items.push(item_id);
|
||||
if (this.namereg[pkey].ikey[ikey].items.indexOf("" + item_id) === -1) {
|
||||
this.namereg[pkey].ikey[ikey].items.push("" + item_id);
|
||||
}
|
||||
} else if (param === 2) {
|
||||
pos = this.namereg[pkey].items.indexOf(item_id);
|
||||
pos = this.namereg[pkey].items.indexOf("" + item_id);
|
||||
items = this.namereg[pkey].items;
|
||||
if (pos > -1) {
|
||||
items = items.slice(0, pos).concat(items.slice(pos + 1));
|
||||
|
@ -8681,7 +8744,7 @@ CSL.Registry.NameReg = function (state) {
|
|||
for (pos = 0, len = items.length; pos < len; pos += 1) {
|
||||
this.state.tmp.taintedItemIDs[items[pos]] = true;
|
||||
}
|
||||
pos = this.namereg[pkey].ikey[ikey].items.indexOf(item_id);
|
||||
pos = this.namereg[pkey].ikey[ikey].items.indexOf("" + item_id);
|
||||
items = this.namereg[pkey].ikey[ikey].items;
|
||||
if (pos > -1) {
|
||||
items = items.slice(0, pos).concat(items.slice(pos + 1));
|
||||
|
@ -8689,8 +8752,8 @@ CSL.Registry.NameReg = function (state) {
|
|||
for (pos = 0, len = items.length; pos < len; pos += 1) {
|
||||
this.state.tmp.taintedItemIDs[items[pos]] = true;
|
||||
}
|
||||
if (this.namereg[pkey].ikey[ikey].skey[skey].items.indexOf(item_id) === -1) {
|
||||
this.namereg[pkey].ikey[ikey].skey[skey].items.push(item_id);
|
||||
if (this.namereg[pkey].ikey[ikey].skey[skey].items.indexOf("" + item_id) === -1) {
|
||||
this.namereg[pkey].ikey[ikey].skey[skey].items.push("" + item_id);
|
||||
}
|
||||
}
|
||||
return param;
|
||||
|
@ -8698,12 +8761,12 @@ CSL.Registry.NameReg = function (state) {
|
|||
delitems = function (ids) {
|
||||
var i, item, pos, len, posA, posB, id, fullkey, llen, ppos, otherid;
|
||||
if ("string" === typeof ids || "number" === typeof ids) {
|
||||
ids = [ids];
|
||||
ids = ["" + ids];
|
||||
}
|
||||
ret = {};
|
||||
len = ids.length;
|
||||
for (pos = 0; pos < len; pos += 1) {
|
||||
id = ids[pos];
|
||||
id = "" + ids[pos];
|
||||
if (!this.nameind[id]) {
|
||||
continue;
|
||||
}
|
||||
|
@ -8720,7 +8783,7 @@ CSL.Registry.NameReg = function (state) {
|
|||
items = this.namereg[pkey].items;
|
||||
if (skey) {
|
||||
myitems = this.namereg[pkey].ikey[ikey].skey[skey].items;
|
||||
posB = myitems.indexOf(id);
|
||||
posB = myitems.indexOf("" + id);
|
||||
if (posB > -1) {
|
||||
this.namereg[pkey].ikey[ikey].skey[skey].items = myitems.slice(0, posB).concat(myitems.slice([(posB + 1)]));
|
||||
}
|
||||
|
@ -8733,7 +8796,7 @@ CSL.Registry.NameReg = function (state) {
|
|||
}
|
||||
}
|
||||
if (ikey) {
|
||||
posB = this.namereg[pkey].ikey[ikey].items.indexOf(id);
|
||||
posB = this.namereg[pkey].ikey[ikey].items.indexOf("" + id);
|
||||
if (posB > -1) {
|
||||
items = this.namereg[pkey].ikey[ikey].items.slice();
|
||||
this.namereg[pkey].ikey[ikey].items = items.slice(0, posB).concat(items.slice([posB + 1]));
|
||||
|
@ -8747,7 +8810,7 @@ CSL.Registry.NameReg = function (state) {
|
|||
}
|
||||
}
|
||||
if (pkey) {
|
||||
posB = this.namereg[pkey].items.indexOf(id);
|
||||
posB = this.namereg[pkey].items.indexOf("" + id);
|
||||
if (posB > -1) {
|
||||
items = this.namereg[pkey].items.slice();
|
||||
this.namereg[pkey].items = items.slice(0, posB).concat(items.slice([posB + 1], items.length));
|
||||
|
@ -8769,7 +8832,7 @@ CSL.Registry.NameReg = function (state) {
|
|||
};
|
||||
addname = function (item_id, nameobj, pos) {
|
||||
var nameobj = state.transform.name(state, nameobj, state.opt["locale-pri"]);
|
||||
set_keys(this.state, item_id, nameobj);
|
||||
set_keys(this.state, "" + item_id, nameobj);
|
||||
if (pkey) {
|
||||
if ("undefined" === typeof this.namereg[pkey]) {
|
||||
this.namereg[pkey] = {};
|
||||
|
@ -8874,9 +8937,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.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.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];
|
||||
|
@ -8884,14 +8947,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.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.state.registry.registerAmbigToken(this.akey, "" + this.partners[pos].id, this.base);
|
||||
}
|
||||
if (ismax) {
|
||||
this.lists[this.listpos] = [this.base, this.nonpartners];
|
||||
|
@ -8905,9 +8968,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.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.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];
|
||||
|
@ -8915,7 +8978,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.state.registry.registerAmbigToken(this.akey, "" + this.nonpartners[0].id, this.base);
|
||||
} else {
|
||||
this.lists.push([this.base, this.nonpartners]);
|
||||
}
|
||||
|
@ -8923,7 +8986,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.state.registry.registerAmbigToken(this.akey, "" + this.partners[pos].id, this.base);
|
||||
}
|
||||
if (ismax) {
|
||||
this.lists[this.listpos] = [this.base, this.nonpartners];
|
||||
|
@ -8936,9 +8999,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.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.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];
|
||||
|
@ -8958,9 +9021,9 @@ CSL.Disambiguation.prototype.disYears = function () {
|
|||
tokens.sort(this.state.registry.sorter.compareKeys);
|
||||
for (pos = 0, len = tokens.length; pos < len; pos += 1) {
|
||||
if (pos === 0) {
|
||||
this.state.registry.registerAmbigToken(this.akey, tokens[pos].id, this.base, this.scanlist);
|
||||
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);
|
||||
this.state.registry.registerAmbigToken(this.akey, "" + tokens[pos].id, this.base);
|
||||
}
|
||||
tokens[pos].disambig.year_suffix = ""+pos;
|
||||
}
|
||||
|
@ -9061,7 +9124,7 @@ CSL.Disambiguation.prototype.initVars = function (akey) {
|
|||
myIds = this.ambigcites[akey];
|
||||
if (myIds && myIds.length > 1) {
|
||||
for (pos = 0, len = myIds.length; pos < len; pos += 1) {
|
||||
myItems.push(this.state.retrieveItem(myIds[pos]));
|
||||
myItems.push(this.state.retrieveItem("" + myIds[pos]));
|
||||
}
|
||||
this.lists.push([this.base, myItems]);
|
||||
}
|
||||
|
@ -9117,4 +9180,4 @@ CSL.Disambiguation.prototype.decrementNames = function () {
|
|||
CSL.Registry.CitationReg = function (state) {
|
||||
this.citationById = {};
|
||||
this.citationByIndex = [];
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue