update to citeproc-js 1.0.172
This commit is contained in:
parent
1c9fa59936
commit
d5fb8358fb
|
@ -134,6 +134,7 @@ var CSL = {
|
|||
PARALLEL_COLLAPSING_MID_VARSET: ["volume", "container-title", "section"],
|
||||
LOOSE: 0,
|
||||
STRICT: 1,
|
||||
TOLERANT: 2,
|
||||
PREFIX_PUNCTUATION: /[.;:]\s*$/,
|
||||
SUFFIX_PUNCTUATION: /^\s*[.;:,\(\)]/,
|
||||
NUMBER_REGEXP: /(?:^\d+|\d+$)/,
|
||||
|
@ -472,22 +473,22 @@ CSL_E4X.prototype.addInstitutionNodes = function(myxml) {
|
|||
use-last="1"/>
|
||||
institution_part = <institution-part name="long"/>;
|
||||
node.name += institution_long;
|
||||
for each (var attr in CSL.INSTITUTION_KEYS) {
|
||||
if (node.name.@[attr].toString()) {
|
||||
node.institution.@[attr] = node.name.@[attr].toString();
|
||||
}
|
||||
}
|
||||
node.institution.@delimiter = node.name.@delimiter.toString();
|
||||
if (node.name.@and.toXMLString()) {
|
||||
node.institution.@and = "text";
|
||||
}
|
||||
node.institution[0].appendChild(institution_part)
|
||||
node.institution[0].appendChild(institution_part);
|
||||
for each (var attr in CSL.INSTITUTION_KEYS) {
|
||||
if (node.name.@[attr].toString()) {
|
||||
node.institution['institution-part'][0].@[attr] = node.name.@[attr].toString();
|
||||
}
|
||||
}
|
||||
for each (var namepartnode in node.name['name-part']) {
|
||||
if (namepartnode.@name.toString() === 'family') {
|
||||
for each (var attr in CSL.INSTITUTION_KEYS) {
|
||||
if (namepartnode.@[attr].toString()) {
|
||||
if (namepartnode.@[attr].toString()) {
|
||||
node.institution['institution-part'][0].@[attr] = namepartnode.@[attr].toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -547,7 +548,12 @@ CSL.Output.Queue = function (state) {
|
|||
this.current = new CSL.Stack(this.queue);
|
||||
};
|
||||
CSL.Output.Queue.prototype.pop = function () {
|
||||
return this.current.value().blobs.pop();
|
||||
var drip = this.current.value();
|
||||
if (drip.length) {
|
||||
return drip.pop();
|
||||
} else {
|
||||
return drip.blobs.pop();
|
||||
}
|
||||
};
|
||||
CSL.Output.Queue.prototype.getToken = function (name) {
|
||||
var ret = this.formats.value()[name];
|
||||
|
@ -880,7 +886,12 @@ CSL.Output.Queue.prototype.renderBlobs = function (blobs, delim) {
|
|||
}
|
||||
} else if (blob.status !== CSL.SUPPRESS) {
|
||||
str = blob.formatter.format(blob.num, blob.gender);
|
||||
var strlen = str.length;
|
||||
var strlen = str.replace(/<[^>]*>/g, "").length;
|
||||
this.append(str, "empty", true);
|
||||
var str_blob = this.pop();
|
||||
var count_offset_characters = state.tmp.count_offset_characters;
|
||||
var str = this.string(state, [str_blob], false);
|
||||
state.tmp.count_offset_characters = count_offset_characters;
|
||||
if (blob.strings["text-case"]) {
|
||||
str = CSL.Output.Formatters[blob.strings["text-case"]](this.state, str);
|
||||
}
|
||||
|
@ -1843,7 +1854,7 @@ CSL.DateParser = function () {
|
|||
};
|
||||
CSL.Engine = function (sys, style, lang, forceLang) {
|
||||
var attrs, langspec, localexml, locale;
|
||||
this.processor_version = "1.0.169";
|
||||
this.processor_version = "1.0.172";
|
||||
this.csl_version = "1.0";
|
||||
this.sys = sys;
|
||||
this.sys.xml = new CSL.System.Xml.Parsing();
|
||||
|
@ -2015,14 +2026,16 @@ CSL.Engine.prototype.getNavi.prototype.getkids = function () {
|
|||
CSL.Engine.prototype.getNavi.prototype.getNodeListValue = function () {
|
||||
return this.nodeList[this.depth][1];
|
||||
};
|
||||
CSL.Engine.prototype.getTerm = function (term, form, plural, gender, loose) {
|
||||
CSL.Engine.prototype.getTerm = function (term, form, plural, gender, mode) {
|
||||
if (term && term.match(/[A-Z]/) && term === term.toUpperCase()) {
|
||||
CSL.debug("Warning: term key is in uppercase form: "+term);
|
||||
term = term.toLowerCase();
|
||||
}
|
||||
var ret = CSL.Engine.getField(CSL.LOOSE, this.locale[this.opt.lang].terms, term, form, plural, gender);
|
||||
if (typeof ret === "undefined") {
|
||||
ret = CSL.Engine.getField(CSL.STRICT, this.locale[this.opt.lang].terms, term, form, plural, gender);
|
||||
if (typeof ret === "undefined" && mode === CSL.STRICT) {
|
||||
throw "Error in getTerm: term \"" + term + "\" does not exist.";
|
||||
} else if (mode === CSL.TOLERANT) {
|
||||
ret = false;
|
||||
}
|
||||
if (ret) {
|
||||
this.tmp.cite_renders_content = true;
|
||||
|
@ -2181,7 +2194,7 @@ CSL.Engine.prototype.dateParseArray = function (date_obj) {
|
|||
}
|
||||
} else if (date_obj.hasOwnProperty(field)) {
|
||||
if (field === "literal" && "object" === typeof date_obj.literal && "string" === typeof date_obj.literal.part) {
|
||||
CSL.error("CSL: fixing up weird literal date value");
|
||||
CSL.debug("Warning: fixing up weird literal date value");
|
||||
ret.literal = date_obj.literal.part;
|
||||
} else {
|
||||
ret[field] = date_obj[field];
|
||||
|
@ -3489,7 +3502,7 @@ CSL.localeResolve = function (langstr) {
|
|||
langlst = langstr.split(/[\-_]/);
|
||||
ret.base = CSL.LANG_BASES[langlst[0]];
|
||||
if ("undefined" === typeof ret.base) {
|
||||
CSL.error("unknown locale "+langstr+", setting to en-US");
|
||||
CSL.debug("Warning: unknown locale "+langstr+", setting to en-US");
|
||||
return {base:"en-US", best:"en-US", bare:"en"};
|
||||
}
|
||||
if (langlst.length === 1 || langlst[1] === "x") {
|
||||
|
@ -3984,7 +3997,6 @@ CSL.Node["else"] = {
|
|||
};
|
||||
CSL.Node["#comment"] = {
|
||||
build: function (state, target) {
|
||||
CSL.debug("CSL processor warning: comment node reached");
|
||||
}
|
||||
};
|
||||
CSL.Node["et-al"] = {
|
||||
|
@ -5586,10 +5598,6 @@ CSL.NameOutput.prototype._getLongStyle = function (v, i) {
|
|||
if (!long_style) {
|
||||
long_style = new CSL.Token();
|
||||
}
|
||||
if (!long_style.decorations) {
|
||||
long_style.decorations = [];
|
||||
}
|
||||
long_style.decorations = this.institution.decorations.concat(long_style.decorations);
|
||||
return long_style;
|
||||
};
|
||||
CSL.NameOutput.prototype._getShortStyle = function () {
|
||||
|
@ -5599,10 +5607,6 @@ CSL.NameOutput.prototype._getShortStyle = function () {
|
|||
} else {
|
||||
short_style = new CSL.Token();
|
||||
}
|
||||
if (!short_style.decorations) {
|
||||
short_style.decorations = [];
|
||||
}
|
||||
short_style.decorations = this.institution.decorations.concat(short_style.decorations);
|
||||
return short_style;
|
||||
};
|
||||
CSL.NameOutput.prototype._parseName = function (name) {
|
||||
|
@ -5729,8 +5733,8 @@ CSL.evaluateStringPluralism = function (str) {
|
|||
return 0;
|
||||
}
|
||||
};
|
||||
CSL.castLabel = function (state, node, term, plural) {
|
||||
var ret = state.getTerm(term, node.strings.form, plural);
|
||||
CSL.castLabel = function (state, node, term, plural, mode) {
|
||||
var ret = state.getTerm(term, node.strings.form, plural, false, mode);
|
||||
if (node.strings["strip-periods"]) {
|
||||
ret = ret.replace(/\./g, "");
|
||||
}
|
||||
|
@ -6386,8 +6390,8 @@ CSL.Node.text = {
|
|||
func = function (state, Item) {
|
||||
var idx, value;
|
||||
value = state.getVariable(Item, "page", form);
|
||||
value = value.replace("\u2013", "-", "g");
|
||||
if (value) {
|
||||
value = value.replace("\u2013", "-", "g");
|
||||
idx = value.indexOf("-");
|
||||
if (idx > -1) {
|
||||
value = value.slice(0, idx);
|
||||
|
@ -10142,3 +10146,4 @@ CSL.Registry.CitationReg = function (state) {
|
|||
this.citationByIndex = [];
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user