Update to citeproc-js 1.0.353
This commit is contained in:
parent
73761723c0
commit
a31e5f7704
1 changed files with 66 additions and 49 deletions
|
@ -57,7 +57,7 @@ if (!Array.indexOf) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
var CSL = {
|
var CSL = {
|
||||||
PROCESSOR_VERSION: "1.0.351",
|
PROCESSOR_VERSION: "1.0.353",
|
||||||
STATUTE_SUBDIV_GROUPED_REGEX: /((?:^| )(?:art|ch|Ch|subch|p|pp|para|subpara|pt|r|sec|subsec|Sec|sch|tit)\.)/g,
|
STATUTE_SUBDIV_GROUPED_REGEX: /((?:^| )(?:art|ch|Ch|subch|p|pp|para|subpara|pt|r|sec|subsec|Sec|sch|tit)\.)/g,
|
||||||
STATUTE_SUBDIV_PLAIN_REGEX: /(?:(?:^| )(?:art|ch|Ch|subch|p|pp|para|subpara|pt|r|sec|subsec|Sec|sch|tit)\.)/,
|
STATUTE_SUBDIV_PLAIN_REGEX: /(?:(?:^| )(?:art|ch|Ch|subch|p|pp|para|subpara|pt|r|sec|subsec|Sec|sch|tit)\.)/,
|
||||||
STATUTE_SUBDIV_STRINGS: {
|
STATUTE_SUBDIV_STRINGS: {
|
||||||
|
@ -9590,7 +9590,7 @@ CSL.Transform = function (state) {
|
||||||
secondary_tok.strings.prefix = " ";
|
secondary_tok.strings.prefix = " ";
|
||||||
}
|
}
|
||||||
for (var i = secondary_tok.decorations.length - 1; i > -1; i += -1) {
|
for (var i = secondary_tok.decorations.length - 1; i > -1; i += -1) {
|
||||||
if (secondary_tok.decorations[i][0] === '@quotes') {
|
if (['@quotes/true','@font-style/italic','@font-style/oblique','@font-weight/bold'].indexOf(secondary_tok.decorations[i].join('/')) > -1) {
|
||||||
secondary_tok.decorations = secondary_tok.decorations.slice(0, i).concat(secondary_tok.decorations.slice(i + 1))
|
secondary_tok.decorations = secondary_tok.decorations.slice(0, i).concat(secondary_tok.decorations.slice(i + 1))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9604,7 +9604,7 @@ CSL.Transform = function (state) {
|
||||||
tertiary_tok.strings.prefix = " ";
|
tertiary_tok.strings.prefix = " ";
|
||||||
}
|
}
|
||||||
for (var i = tertiary_tok.decorations.length - 1; i > -1; i += -1) {
|
for (var i = tertiary_tok.decorations.length - 1; i > -1; i += -1) {
|
||||||
if (tertiary_tok.decorations[i][0] === '@quotes') {
|
if (['@quotes/true','@font-style/italic','@font-style/oblique','@font-weight/bold'].indexOf(tertiary_tok.decorations[i].join('/')) > -1) {
|
||||||
tertiary_tok.decorations = tertiary_tok.decorations.slice(0, i).concat(tertiary_tok.decorations.slice(i + 1))
|
tertiary_tok.decorations = tertiary_tok.decorations.slice(0, i).concat(tertiary_tok.decorations.slice(i + 1))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10531,66 +10531,83 @@ CSL.Util.Dates.year.numeric = function (state, num) {
|
||||||
}
|
}
|
||||||
return (pre + num);
|
return (pre + num);
|
||||||
};
|
};
|
||||||
CSL.Util.Dates.month = {};
|
CSL.Util.Dates.normalizeMonth = function (num, useSeason) {
|
||||||
CSL.Util.Dates.month.numeric = function (state, num) {
|
var ret;
|
||||||
if (num) {
|
|
||||||
num = parseInt(num, 10);
|
|
||||||
if (num > 12) {
|
|
||||||
num = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var ret = "" + num;
|
|
||||||
return ret;
|
|
||||||
};
|
|
||||||
CSL.Util.Dates.month["numeric-leading-zeros"] = function (state, num) {
|
|
||||||
if (!num) {
|
if (!num) {
|
||||||
num = 0;
|
num = 0;
|
||||||
}
|
}
|
||||||
num = parseInt(num, 10);
|
num = "" + num;
|
||||||
if (num > 12) {
|
if (!num.match(/^[0-9]+$/)) {
|
||||||
num = 0;
|
num = 0;
|
||||||
}
|
}
|
||||||
|
num = parseInt(num, 10);
|
||||||
|
if (useSeason) {
|
||||||
|
var res = {stub: "month-", num: num};
|
||||||
|
if (res.num < 1 || res.num > 20) {
|
||||||
|
res.num = 0;
|
||||||
|
} else if (res.num > 16) {
|
||||||
|
res.stub = "season-";
|
||||||
|
res.num = res.num - 16;
|
||||||
|
} else if (res.num > 12) {
|
||||||
|
res.stub = "season-";
|
||||||
|
res.num = res.num - 12;
|
||||||
|
}
|
||||||
|
ret = res;
|
||||||
|
} else {
|
||||||
|
if (num < 1 || num > 12) {
|
||||||
|
num = 0;
|
||||||
|
}
|
||||||
|
ret = num;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
CSL.Util.Dates.month = {};
|
||||||
|
CSL.Util.Dates.month.numeric = function (state, num) {
|
||||||
|
var num = CSL.Util.Dates.normalizeMonth(num);
|
||||||
|
if (!num) {
|
||||||
|
num = "";
|
||||||
|
}
|
||||||
|
return num;
|
||||||
|
};
|
||||||
|
CSL.Util.Dates.month["numeric-leading-zeros"] = function (state, num) {
|
||||||
|
var num = CSL.Util.Dates.normalizeMonth(num);
|
||||||
|
if (!num) {
|
||||||
|
num = "";
|
||||||
|
} else {
|
||||||
num = "" + num;
|
num = "" + num;
|
||||||
while (num.length < 2) {
|
while (num.length < 2) {
|
||||||
num = "0" + num;
|
num = "0" + num;
|
||||||
}
|
}
|
||||||
return num.toString();
|
}
|
||||||
|
return num;
|
||||||
};
|
};
|
||||||
CSL.Util.Dates.month["long"] = function (state, num) {
|
CSL.Util.Dates.month["long"] = function (state, num) {
|
||||||
var stub = "month-";
|
var res = CSL.Util.Dates.normalizeMonth(num, true);
|
||||||
num = parseInt(num, 10);
|
var num = res.num;
|
||||||
if (num > 12) {
|
if (!num) {
|
||||||
stub = "season-";
|
num = "";
|
||||||
if (num > 16) {
|
|
||||||
num = num - 16;
|
|
||||||
} else {
|
} else {
|
||||||
num = num - 12;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
num = "" + num;
|
num = "" + num;
|
||||||
while (num.length < 2) {
|
while (num.length < 2) {
|
||||||
num = "0" + num;
|
num = "0" + num;
|
||||||
}
|
}
|
||||||
num = stub + num;
|
num = state.getTerm(res.stub + num, "long", 0);
|
||||||
return state.getTerm(num, "long", 0);
|
}
|
||||||
|
return num;
|
||||||
};
|
};
|
||||||
CSL.Util.Dates.month["short"] = function (state, num) {
|
CSL.Util.Dates.month["short"] = function (state, num) {
|
||||||
var stub = "month-";
|
var res = CSL.Util.Dates.normalizeMonth(num, true);
|
||||||
num = parseInt(num, 10);
|
var num = res.num;
|
||||||
if (num > 12) {
|
if (!num) {
|
||||||
stub = "season-";
|
num = "";
|
||||||
if (num > 16) {
|
|
||||||
num = num - 16;
|
|
||||||
} else {
|
} else {
|
||||||
num = num - 12;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
num = "" + num;
|
num = "" + num;
|
||||||
while (num.length < 2) {
|
while (num.length < 2) {
|
||||||
num = "0" + num;
|
num = "0" + num;
|
||||||
}
|
}
|
||||||
num = "month-" + num;
|
num = state.getTerm(res.stub + num, "short", 0);
|
||||||
return state.getTerm(num, "short", 0);
|
}
|
||||||
|
return num;
|
||||||
};
|
};
|
||||||
CSL.Util.Dates.day = {};
|
CSL.Util.Dates.day = {};
|
||||||
CSL.Util.Dates.day.numeric = function (state, num) {
|
CSL.Util.Dates.day.numeric = function (state, num) {
|
||||||
|
|
Loading…
Reference in a new issue