Upgrade citeproc-js to version 1.0.297

This commit is contained in:
Frank 2012-03-02 10:57:50 +08:00 committed by Simon Kornblith
parent 8b157709bd
commit 74af1fbb8c

View file

@ -2153,7 +2153,7 @@ CSL.DateParser = function () {
}; };
CSL.Engine = function (sys, style, lang, forceLang) { CSL.Engine = function (sys, style, lang, forceLang) {
var attrs, langspec, localexml, locale; var attrs, langspec, localexml, locale;
this.processor_version = "1.0.296"; this.processor_version = "1.0.297";
this.csl_version = "1.0"; this.csl_version = "1.0";
this.sys = sys; this.sys = sys;
this.sys.xml = new CSL.System.Xml.Parsing(); this.sys.xml = new CSL.System.Xml.Parsing();
@ -2163,6 +2163,7 @@ CSL.Engine = function (sys, style, lang, forceLang) {
if (CSL.getAbbreviation) { if (CSL.getAbbreviation) {
this.sys.getAbbreviation = CSL.getAbbreviation; this.sys.getAbbreviation = CSL.getAbbreviation;
} }
this.sys.AbbreviationSegments = CSL.AbbreviationSegments;
this.parallel = new CSL.Parallel(this); this.parallel = new CSL.Parallel(this);
this.transform = new CSL.Transform(this); this.transform = new CSL.Transform(this);
this.setParseNames = function (val) { this.setParseNames = function (val) {
@ -2337,10 +2338,12 @@ CSL.Engine.prototype.getTerm = function (term, form, plural, gender, mode) {
if (!ret && term === "range-delimiter") { if (!ret && term === "range-delimiter") {
ret = "\u2013"; ret = "\u2013";
} }
if (typeof ret === "undefined" && mode === CSL.STRICT) { if (typeof ret === "undefined") {
throw "Error in getTerm: term \"" + term + "\" does not exist."; if (mode === CSL.STRICT) {
} else if (mode === CSL.TOLERANT) { throw "Error in getTerm: term \"" + term + "\" does not exist.";
ret = false; } else if (mode === CSL.TOLERANT) {
ret = "";
}
} }
if (ret) { if (ret) {
this.tmp.cite_renders_content = true; this.tmp.cite_renders_content = true;
@ -5465,7 +5468,7 @@ CSL.NameOutput.prototype._buildLabel = function (term, plural, position) {
var ret = false; var ret = false;
var node = this.label[position]; var node = this.label[position];
if (node) { if (node) {
ret = CSL.castLabel(this.state, node, term, plural); ret = CSL.castLabel(this.state, node, term, plural, CSL.TOLERANT);
} }
return ret; return ret;
}; };
@ -6836,7 +6839,7 @@ CSL.evaluateLabel = function (node, state, Item, item) {
plural = state.tmp.shadow_numbers[myterm].plural; plural = state.tmp.shadow_numbers[myterm].plural;
} }
} }
return CSL.castLabel(state, node, myterm, plural); return CSL.castLabel(state, node, myterm, plural, CSL.TOLERANT);
}; };
CSL.evaluateStringPluralism = function (str) { CSL.evaluateStringPluralism = function (str) {
if (str) { if (str) {
@ -7594,15 +7597,15 @@ CSL.Node.text = {
} }
}; };
} else if (this.variables_real[0] === "hereinafter") { } else if (this.variables_real[0] === "hereinafter") {
if (state.sys.getAbbreviation) { func = function (state, Item) {
func = function (state, Item) { var hereinafter_info = state.transform.getHereinafter(Item);
var hereinafter_info = state.transform.getHereinafter(Item); if (state.transform.abbrevs[hereinafter_info[0]]) {
var value = state.transform.abbrevs[hereinafter_info[0]].hereinafter[hereinafter_info[1]]; var value = state.transform.abbrevs[hereinafter_info[0]].hereinafter[hereinafter_info[1]];
if (value) { if (value) {
state.tmp.group_context.value()[2] = true; state.tmp.group_context.value()[2] = true;
state.output.append(value, this); state.output.append(value, this);
} }
}; }
} }
} else if (this.variables_real[0] === "URL") { } else if (this.variables_real[0] === "URL") {
func = function (state, Item) { func = function (state, Item) {
@ -8622,7 +8625,7 @@ CSL.Util.Match = function () {
CSL.Transform = function (state) { CSL.Transform = function (state) {
var debug = false, abbreviations, token, fieldname, abbrev_family, opt; var debug = false, abbreviations, token, fieldname, abbrev_family, opt;
this.abbrevs = {}; this.abbrevs = {};
this.abbrevs["default"] = new CSL.AbbreviationSegments(); this.abbrevs["default"] = new state.sys.AbbreviationSegments();
function init(mytoken, myfieldname, myabbrev_family) { function init(mytoken, myfieldname, myabbrev_family) {
token = mytoken; token = mytoken;
fieldname = myfieldname; fieldname = myfieldname;
@ -8721,7 +8724,7 @@ CSL.Transform = function (state) {
} }
if (!orig) { if (!orig) {
if (!this.abbrevs[jurisdiction]) { if (!this.abbrevs[jurisdiction]) {
this.abbrevs[jurisdiction] = new CSL.AbbreviationSegments(); this.abbrevs[jurisdiction] = new state.sys..AbbreviationSegments();
} }
return jurisdiction; return jurisdiction;
} }
@ -8735,7 +8738,7 @@ CSL.Transform = function (state) {
} }
for (var i=tryList.length - 1; i > -1; i += -1) { for (var i=tryList.length - 1; i > -1; i += -1) {
if (!this.abbrevs[tryList[i]]) { if (!this.abbrevs[tryList[i]]) {
this.abbrevs[tryList[i]] = new CSL.AbbreviationSegments(); this.abbrevs[tryList[i]] = new state.sys.AbbreviationSegments();
} }
if (!this.abbrevs[tryList[i]][category][orig]) { if (!this.abbrevs[tryList[i]][category][orig]) {
state.sys.getAbbreviation(state.opt.styleID, this.abbrevs, tryList[i], category, orig); state.sys.getAbbreviation(state.opt.styleID, this.abbrevs, tryList[i], category, orig);