Upgrade citeproc-js to version 1.0.287
This commit is contained in:
parent
3b6c4f8c4a
commit
f68eb7c6f5
|
@ -178,12 +178,12 @@ var CSL = {
|
|||
PREFIX_PUNCTUATION: /[.;:]\s*$/,
|
||||
SUFFIX_PUNCTUATION: /^\s*[.;:,\(\)]/,
|
||||
NUMBER_REGEXP: /(?:^\d+|\d+$)/,
|
||||
NAME_INITIAL_REGEXP: /^([A-Z\u0080-\u017f\u0400-\u042f])([a-zA-Z\u0080-\u017f\u0400-\u052f]*|)/,
|
||||
ROMANESQUE_REGEXP: /[a-zA-Z\u0080-\u017f\u0400-\u052f\u0386-\u03fb\u1f00-\u1ffe]/,
|
||||
ROMANESQUE_NOT_REGEXP: /[^a-zA-Z\u0080-\u017f\u0400-\u052f\u0386-\u03fb\u1f00-\u1ffe]/g,
|
||||
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]+$/,
|
||||
NAME_INITIAL_REGEXP: /^([A-Z\u0080-\u017f\u0400-\u042f\u0600-\u06ff])([a-zA-Z\u0080-\u017f\u0400-\u052f\u0600-\u06ff]*|)/,
|
||||
ROMANESQUE_REGEXP: /[a-zA-Z\u0080-\u017f\u0400-\u052f\u0386-\u03fb\u1f00-\u1ffe\u0600-\u06ff\u200c\u200d\u200e\u202a-\u202e]/,
|
||||
ROMANESQUE_NOT_REGEXP: /[^a-zA-Z\u0080-\u017f\u0400-\u052f\u0386-\u03fb\u1f00-\u1ffe\u0600-\u06ff\u200c\u200d\u200e\u202a-\u202e]/g,
|
||||
STARTSWITH_ROMANESQUE_REGEXP: /^[&a-zA-Z\u0080-\u017f\u0400-\u052f\u0386-\u03fb\u1f00-\u1ffe\u0600-\u06ff\u200c\u200d\u200e\u202a-\u202e]/,
|
||||
ENDSWITH_ROMANESQUE_REGEXP: /[.;:&a-zA-Z\u0080-\u017f\u0400-\u052f\u0386-\u03fb\u1f00-\u1ffe\u0600-\u06ff\u200c\u200d\u200e\u202a-\u202e]$/,
|
||||
ALL_ROMANESQUE_REGEXP: /^[a-zA-Z\u0080-\u017f\u0400-\u052f\u0386-\u03fb\u1f00-\u1ffe\u0600-\u06ff\u200c\u200d\u200e\u202a-\u202e]+$/,
|
||||
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,
|
||||
|
@ -302,6 +302,7 @@ var CSL = {
|
|||
es: "es_ES",
|
||||
et: "et_EE",
|
||||
fa: "fa_FA",
|
||||
fi: "fi_FI",
|
||||
fr: "fr_FR",
|
||||
he: "he_IL",
|
||||
hu: "hu_HU",
|
||||
|
@ -2148,7 +2149,7 @@ CSL.DateParser = function () {
|
|||
};
|
||||
CSL.Engine = function (sys, style, lang, forceLang) {
|
||||
var attrs, langspec, localexml, locale;
|
||||
this.processor_version = "1.0.286";
|
||||
this.processor_version = "1.0.287";
|
||||
this.csl_version = "1.0";
|
||||
this.sys = sys;
|
||||
this.sys.xml = new CSL.System.Xml.Parsing();
|
||||
|
@ -2690,7 +2691,20 @@ CSL.Engine.prototype.setAbbreviations = function (arg) {
|
|||
if (this.sys.setAbbreviations) {
|
||||
this.sys.setAbbreviations(arg);
|
||||
}
|
||||
}
|
||||
};
|
||||
CSL.Engine.prototype.setEnglishLocaleEscapes = function (arg) {
|
||||
if ("string" === typeof arg) {
|
||||
arg = arg.split(/\s+,\s+/);
|
||||
}
|
||||
if (!arg || !arg.length) {
|
||||
arg = [];
|
||||
}
|
||||
for (var i = 0, ilen = arg.length; i < ilen; i += 1) {
|
||||
if (this.opt.english_locale_escapes.indexOf(arg[i]) === -1) {
|
||||
this.opt.english_locale_escapes.push(arg[i]);
|
||||
}
|
||||
}
|
||||
};
|
||||
CSL.Engine.Opt = function () {
|
||||
this.has_disambiguate = false;
|
||||
this.mode = "html";
|
||||
|
@ -2713,6 +2727,7 @@ CSL.Engine.Opt = function () {
|
|||
this.citation_number_slug = false;
|
||||
this.max_number_of_names = 0;
|
||||
this.trigraph = "Aaaa00:AaAa00:AaAA00:AAAA00";
|
||||
this.english_locale_escapes = [];
|
||||
this.development_extensions = {};
|
||||
this.development_extensions.field_hack = true;
|
||||
this.development_extensions.locator_date_and_revision = true;
|
||||
|
@ -4228,17 +4243,22 @@ CSL.Engine.prototype.localeSet = function (myxml, lang_in, lang_out) {
|
|||
}
|
||||
for (termname in this.locale[lang_out].terms) {
|
||||
if (this.locale[lang_out].terms.hasOwnProperty(termname)) {
|
||||
for (i = 0, ilen = 2; i < ilen; i += 1) {
|
||||
genderform = CSL.GENDERS[i];
|
||||
if (this.locale[lang_out].terms[termname][genderform]) {
|
||||
for (form in this.locale[lang_out].terms[termname]) {
|
||||
if (!this.locale[lang_out].terms[termname][genderform][form]) {
|
||||
this.locale[lang_out].terms[termname][genderform][form] = this.locale[lang_out].terms[termname][form];
|
||||
for (i = 0, ilen = 2; i < ilen; i += 1) {
|
||||
genderform = CSL.GENDERS[i];
|
||||
if (this.locale[lang_out].terms[termname][genderform]) {
|
||||
for (form in this.locale[lang_out].terms[termname]) {
|
||||
if (!this.locale[lang_out].terms[termname][genderform][form]) {
|
||||
this.locale[lang_out].terms[termname][genderform][form] = this.locale[lang_out].terms[termname][form];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (lang_out && lang_out.slice(0, 2) === "fr") {
|
||||
this.locale[lang_out].terms["page-range-delimiter"] = "-";
|
||||
} else {
|
||||
this.locale[lang_out].terms["page-range-delimiter"] = "\u2013";
|
||||
}
|
||||
nodes = this.sys.xml.getNodesByName(locale, 'style-options');
|
||||
for (pos = 0, len = this.sys.xml.numberofnodes(nodes); pos < len; pos += 1) {
|
||||
|
@ -7522,7 +7542,7 @@ CSL.Node.text = {
|
|||
func = function (state, Item, item) {
|
||||
if (item && item[this.variables[0]]) {
|
||||
var locator = "" + item[this.variables[0]];
|
||||
locator = locator.replace(/([^\\])--*/g,"$1\u2013");
|
||||
locator = locator.replace(/([^\\])--*/g,"$1"+state.getTerm("page-range-delimiter"));
|
||||
locator = locator.replace(/\\-/g,"-");
|
||||
state.output.append(locator, this, false, false, true);
|
||||
}
|
||||
|
@ -7544,7 +7564,7 @@ CSL.Node.text = {
|
|||
func = function (state, Item) {
|
||||
var value = state.getVariable(Item, "page", form);
|
||||
if (value) {
|
||||
value = value.replace(/([^\\])--*/g,"$1\u2013");
|
||||
value = value.replace(/([^\\])--*/g,"$1"+state.getTerm("page-range-delimiter"));
|
||||
value = value.replace(/\\-/g,"-");
|
||||
value = state.fun.page_mangler(value);
|
||||
state.output.append(value, this, false, false, true);
|
||||
|
@ -8367,18 +8387,22 @@ CSL.Attributes["@text-case"] = function (state, arg) {
|
|||
this.strings["text-case"] = arg;
|
||||
if (arg === "title") {
|
||||
var m = false;
|
||||
var default_locale = state.opt["default-locale"][0].slice(0, 2);
|
||||
if (Item.language) {
|
||||
m = Item.language.match(/^\s*([a-z]{2})(?:$|-| )/);
|
||||
}
|
||||
if (state.opt["default-locale"][0].slice(0, 2) === "en") {
|
||||
if (m && m[1] !== "en") {
|
||||
m = Item.language.match(/^\s*([A-Za-z]{2})(?:$|-| )/);
|
||||
if (!m) {
|
||||
this.strings["text-case"] = "passthrough";
|
||||
} else if (m[1].toLowerCase() !== "en") {
|
||||
this.strings["text-case"] = "passthrough";
|
||||
for (var i = 0, ilen = state.opt.english_locale_escapes.length; i < ilen; i += 1) {
|
||||
var escaper = state.opt.english_locale_escapes[i];
|
||||
if (m[1].slice(0, escaper.length).toLowerCase() === escaper) {
|
||||
this.strings["text-case"] = arg;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
} else if (default_locale !== "en") {
|
||||
this.strings["text-case"] = "passthrough";
|
||||
if (m && m[1] === "en") {
|
||||
this.strings["text-case"] = arg;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -10096,10 +10120,10 @@ CSL.Engine.prototype.processNumber = function (node, ItemObject, variable) {
|
|||
&& elements[i].match(/^[0-9]+/)
|
||||
&& parseInt(elements[i - 2]) < parseInt(elements[i].replace(/[^0-9].*/,""))) {
|
||||
var start = this.tmp.shadow_numbers[variable].values.slice(-2);
|
||||
middle[0][1] = "\u2013";
|
||||
middle[0][1] = this.getTerm("page-range-delimiter");
|
||||
if (this.opt["page-range-format"] ) {
|
||||
var newstr = this.fun.page_mangler(start[0][1] +"-"+elements[i]);
|
||||
newstr = newstr.split(/\u2013/);
|
||||
newstr = newstr.split(this.getTerm("page-range-delimiter"));
|
||||
elements[i] = newstr[1];
|
||||
}
|
||||
count = count + 1;
|
||||
|
|
Loading…
Reference in New Issue
Block a user