Update citeproc-js to 1.1.133

This commit is contained in:
Dan Stillman 2016-09-22 00:19:02 -04:00
parent 610dce7c1f
commit 015a13716f

View file

@ -23,7 +23,7 @@
* <http://www.gnu.org/licenses/> respectively. * <http://www.gnu.org/licenses/> respectively.
*/ */
var CSL = { var CSL = {
PROCESSOR_VERSION: "1.1.131", PROCESSOR_VERSION: "1.1.133",
CONDITION_LEVEL_TOP: 1, CONDITION_LEVEL_TOP: 1,
CONDITION_LEVEL_BOTTOM: 2, CONDITION_LEVEL_BOTTOM: 2,
PLAIN_HYPHEN_REGEX: /(?:[^\\]-|\u2013)/, PLAIN_HYPHEN_REGEX: /(?:[^\\]-|\u2013)/,
@ -238,42 +238,47 @@ var CSL = {
elems.push(m[i]); elems.push(m[i]);
} }
elems.push(splt[splt.length-1]) elems.push(splt[splt.length-1])
var names = {}; for (var i=1,ilen=elems.length;i<ilen;i += 2) {
for (var i=1,ilen=elems.length;i<ilen;i+=2) { elems[i] = '\n' + elems[i].slice(2,-1).trim() + '\n';
var mm = elems[i].match(CSL.NOTE_FIELD_REGEXP); }
var key = mm[1]; elems = elems.join('').split('\n');
var val = mm[2].replace(/^\s+/, "").replace(/\s+$/, ""); } else {
if (!Item[key]) { elems = Item.note.split('\n');
if (!validFieldsForType || validFieldsForType[key]) { }
if (CSL.DATE_VARIABLES.indexOf(key) > -1) { var names = {};
Item[key] = {raw: val}; for (var i=0,ilen=elems.length;i<ilen;i++) {
elems[i] = ""; var line = elems[i];
} else { var mm = line.match(CSL.NOTE_FIELD_REGEXP);
Item[key] = val; if (!mm) continue;
} var key = mm[1];
} else if (CSL.NAME_VARIABLES.indexOf(key) > -1) { var val = mm[2].replace(/^\s+/, "").replace(/\s+$/, "");
if (!names[key]) { if (!Item[key]) {
names[key] = []; if (CSL.DATE_VARIABLES.indexOf(key) > -1) {
} Item[key] = {raw: val};
var lst = val.split(/\s*\|\|\s*/); } else if (CSL.NAME_VARIABLES.indexOf(key) > -1) {
if (lst.length === 1) { if (!names[key]) {
names[key].push({literal:lst[0]}); names[key] = [];
} else if (lst.length === 2) {
var name = {family:lst[0],given:lst[1]};
CSL.parseParticles(name);
names[key].push(name);
}
elems[i] = "";
} }
var lst = val.split(/\s*\|\|\s*/);
if (lst.length === 1) {
names[key].push({literal:lst[0]});
} else if (lst.length === 2) {
var name = {family:lst[0],given:lst[1]};
CSL.parseParticles(name);
names[key].push(name);
}
} else {
Item[key] = val;
} }
if (name === "type") { elems[i] = "";
Item.type = val;
}
Item.note = elems.join("");
} }
for (var key in names) { if (name === "type") {
Item[key] = names[key]; Item.type = val;
} }
Item.note = elems.join("");
}
for (var key in names) {
Item[key] = names[key];
} }
}, },
GENDERS: ["masculine", "feminine"], GENDERS: ["masculine", "feminine"],
@ -365,7 +370,7 @@ var CSL = {
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_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+|$))+$/, 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]+|[A-Z]+):[^\}]+\}/g, NOTE_FIELDS_REGEXP: /\{:(?:[\-_a-z]+|[A-Z]+):[^\}]+\}/g,
NOTE_FIELD_REGEXP: /\{:([\-_a-z]+|[A-Z]+):\s*([^\}]+)\}/, NOTE_FIELD_REGEXP: /^([\-_a-z]+|[A-Z]+):\s*([^\}]+)$/,
DISPLAY_CLASSES: ["block", "left-margin", "right-inline", "indent"], DISPLAY_CLASSES: ["block", "left-margin", "right-inline", "indent"],
NAME_VARIABLES: [ NAME_VARIABLES: [
"author", "author",