Update citeproc-js to 1.1.212
This commit is contained in:
parent
9c2d0d7272
commit
4861b2e841
1 changed files with 273 additions and 30 deletions
|
@ -24,7 +24,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var CSL = {
|
var CSL = {
|
||||||
PROCESSOR_VERSION: "1.1.210",
|
PROCESSOR_VERSION: "1.1.212",
|
||||||
CONDITION_LEVEL_TOP: 1,
|
CONDITION_LEVEL_TOP: 1,
|
||||||
CONDITION_LEVEL_BOTTOM: 2,
|
CONDITION_LEVEL_BOTTOM: 2,
|
||||||
PLAIN_HYPHEN_REGEX: /(?:[^\\]-|\u2013)/,
|
PLAIN_HYPHEN_REGEX: /(?:[^\\]-|\u2013)/,
|
||||||
|
@ -171,7 +171,7 @@ var CSL = {
|
||||||
"genre":"titles",
|
"genre":"titles",
|
||||||
"medium":"titles",
|
"medium":"titles",
|
||||||
"container-title":"journals",
|
"container-title":"journals",
|
||||||
"collection-title":"journals",
|
"collection-title":"titles",
|
||||||
"archive":"journals",
|
"archive":"journals",
|
||||||
"publisher":"publishers",
|
"publisher":"publishers",
|
||||||
"authority":"publishers",
|
"authority":"publishers",
|
||||||
|
@ -179,10 +179,10 @@ var CSL = {
|
||||||
"event-place": "places",
|
"event-place": "places",
|
||||||
"archive-place": "places",
|
"archive-place": "places",
|
||||||
"jurisdiction": "places",
|
"jurisdiction": "places",
|
||||||
"number": "number",
|
"number": "places",
|
||||||
"edition":"number",
|
"edition":"places",
|
||||||
"issue":"number",
|
"issue":"places",
|
||||||
"volume":"number"
|
"volume":"places"
|
||||||
},
|
},
|
||||||
AbbreviationSegments: function () {
|
AbbreviationSegments: function () {
|
||||||
this["container-title"] = {};
|
this["container-title"] = {};
|
||||||
|
@ -489,6 +489,21 @@ var CSL = {
|
||||||
"reviewed-author",
|
"reviewed-author",
|
||||||
"translator"
|
"translator"
|
||||||
],
|
],
|
||||||
|
CREATORS: [
|
||||||
|
"author",
|
||||||
|
"collection-editor",
|
||||||
|
"composer",
|
||||||
|
"container-author",
|
||||||
|
"director",
|
||||||
|
"editor",
|
||||||
|
"editorial-director",
|
||||||
|
"illustrator",
|
||||||
|
"interviewer",
|
||||||
|
"original-author",
|
||||||
|
"recipient",
|
||||||
|
"reviewed-author",
|
||||||
|
"translator"
|
||||||
|
],
|
||||||
NUMERIC_VARIABLES: [
|
NUMERIC_VARIABLES: [
|
||||||
"call-number",
|
"call-number",
|
||||||
"chapter-number",
|
"chapter-number",
|
||||||
|
@ -750,7 +765,7 @@ var CSL = {
|
||||||
"sv-SE":"Swedish",
|
"sv-SE":"Swedish",
|
||||||
"th-TH":"Thai",
|
"th-TH":"Thai",
|
||||||
"tr-TR":"Turkish",
|
"tr-TR":"Turkish",
|
||||||
"uk-UA":"Ukranian",
|
"uk-UA":"Ukrainian",
|
||||||
"vi-VN":"Vietnamese",
|
"vi-VN":"Vietnamese",
|
||||||
"zh-CN":"Chinese (CN)",
|
"zh-CN":"Chinese (CN)",
|
||||||
"zh-TW":"Chinese (TW)"
|
"zh-TW":"Chinese (TW)"
|
||||||
|
@ -7753,6 +7768,9 @@ CSL.Node.label = {
|
||||||
};
|
};
|
||||||
this.execs.push(func);
|
this.execs.push(func);
|
||||||
} else {
|
} else {
|
||||||
|
if (!this.strings.form) {
|
||||||
|
this.strings.form = "long";
|
||||||
|
}
|
||||||
var namevars = state.build.names_variables.slice(-1)[0];
|
var namevars = state.build.names_variables.slice(-1)[0];
|
||||||
if (!state.build.name_label) {
|
if (!state.build.name_label) {
|
||||||
state.build.name_label = {};
|
state.build.name_label = {};
|
||||||
|
@ -10215,6 +10233,7 @@ CSL.Node.names = {
|
||||||
}
|
}
|
||||||
if (this.tokentype === CSL.START) {
|
if (this.tokentype === CSL.START) {
|
||||||
state.build.names_flag = true;
|
state.build.names_flag = true;
|
||||||
|
state.build.name_flag = false;
|
||||||
state.build.names_level += 1;
|
state.build.names_level += 1;
|
||||||
if (state.build.names_level === 1) {
|
if (state.build.names_level === 1) {
|
||||||
state.build.names_variables = [];
|
state.build.names_variables = [];
|
||||||
|
@ -10648,7 +10667,7 @@ CSL.Node.text = {
|
||||||
var transfall = false;
|
var transfall = false;
|
||||||
if (form === "short" || ["country", "jurisdiction"].indexOf(this.variables_real[0]) > -1) {
|
if (form === "short" || ["country", "jurisdiction"].indexOf(this.variables_real[0]) > -1) {
|
||||||
if (this.variables_real[0] === "container-title") {
|
if (this.variables_real[0] === "container-title") {
|
||||||
altvar = "journalAbbreviation";
|
altvar = "container-title-short";
|
||||||
} else if (this.variables_real[0] === "title") {
|
} else if (this.variables_real[0] === "title") {
|
||||||
altvar = "title-short";
|
altvar = "title-short";
|
||||||
}
|
}
|
||||||
|
@ -10687,20 +10706,22 @@ CSL.Node.text = {
|
||||||
if (value) {
|
if (value) {
|
||||||
if (state.opt.development_extensions.wrap_url_and_doi) {
|
if (state.opt.development_extensions.wrap_url_and_doi) {
|
||||||
if (!this.decorations.length || this.decorations[0][0] !== "@" + this.variables[0]) {
|
if (!this.decorations.length || this.decorations[0][0] !== "@" + this.variables[0]) {
|
||||||
if (this.variables_real[0] === "DOI" && this.strings.prefix === "https://doi.org/") {
|
if (this.variables_real[0] === "DOI") {
|
||||||
var clonetoken = CSL.Util.cloneToken(this);
|
var clonetoken = CSL.Util.cloneToken(this);
|
||||||
var groupblob = new CSL.Blob(null, null, "url-wrapper");
|
var groupblob = new CSL.Blob(null, null, "url-wrapper");
|
||||||
groupblob.decorations.push(["@DOI", "true"]);
|
groupblob.decorations.push(["@DOI", "true"]);
|
||||||
value = value.replace(/^https?:\/\/doi\.org\//, "");
|
|
||||||
var prefix;
|
var prefix;
|
||||||
if (value.match(/^https?:\/\//)) {
|
if (this.strings.prefix && this.strings.prefix.match(/^.*https:\/\/doi\.org\/$/)) {
|
||||||
prefix = "";
|
value = value.replace(/^https?:\/\/doi\.org\//, "");
|
||||||
} else {
|
if (value.match(/^https?:\/\//)) {
|
||||||
prefix = "https://doi.org/";
|
prefix = "";
|
||||||
|
} else {
|
||||||
|
prefix = "https://doi.org/";
|
||||||
|
}
|
||||||
|
clonetoken.strings.prefix = this.strings.prefix.slice(0, clonetoken.strings.prefix.length-16);
|
||||||
}
|
}
|
||||||
var prefixblob = new CSL.Blob(prefix);
|
var prefixblob = new CSL.Blob(prefix);
|
||||||
var valueblob = new CSL.Blob(value);
|
var valueblob = new CSL.Blob(value);
|
||||||
clonetoken.strings.prefix = "";
|
|
||||||
groupblob.push(prefixblob);
|
groupblob.push(prefixblob);
|
||||||
groupblob.push(valueblob);
|
groupblob.push(valueblob);
|
||||||
state.output.append(groupblob, clonetoken, false, false, true);
|
state.output.append(groupblob, clonetoken, false, false, true);
|
||||||
|
@ -11023,7 +11044,7 @@ CSL.Attributes["@variable"] = function (state, arg) {
|
||||||
if (variable === "title") {
|
if (variable === "title") {
|
||||||
variable = "title-short";
|
variable = "title-short";
|
||||||
} else if (variable === "container-title") {
|
} else if (variable === "container-title") {
|
||||||
variable = "journalAbbreviation";
|
variable = "container-title-short";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (variable === "year-suffix") {
|
if (variable === "year-suffix") {
|
||||||
|
@ -13984,12 +14005,22 @@ CSL.Engine.prototype.processNumber = function (node, ItemObject, variable, type)
|
||||||
var m = str.match(/(;\s+|,\s+|\s*\\*[\-\u2013]+\s*|\s*&\s*)/g);
|
var m = str.match(/(;\s+|,\s+|\s*\\*[\-\u2013]+\s*|\s*&\s*)/g);
|
||||||
if (m) {
|
if (m) {
|
||||||
var lst = str.split(/(?:;\s+|,\s+|\s*\\*[\-\u2013]+\s*|\s*&\s*)/);
|
var lst = str.split(/(?:;\s+|,\s+|\s*\\*[\-\u2013]+\s*|\s*&\s*)/);
|
||||||
for (var i=0,ilen=lst.length-1; i<ilen; i++) {
|
var recombine = false;
|
||||||
elems.push(lst[i]);
|
for (var i in lst) {
|
||||||
elems.push(m[i]);
|
if (lst[i].replace(/^[a-z]\.\s+/, "").match(/[^\s0-9ivxlcmIVXLCM]/)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (recombine) {
|
||||||
|
elems = [str];
|
||||||
|
} else {
|
||||||
|
for (var i=0,ilen=lst.length-1; i<ilen; i++) {
|
||||||
|
elems.push(lst[i]);
|
||||||
|
elems.push(m[i]);
|
||||||
|
}
|
||||||
|
elems.push(lst[lst.length-1]);
|
||||||
|
elems = fixupSubsections(elems);
|
||||||
}
|
}
|
||||||
elems.push(lst[lst.length-1]);
|
|
||||||
elems = fixupSubsections(elems);
|
|
||||||
} else {
|
} else {
|
||||||
var elems = [str];
|
var elems = [str];
|
||||||
}
|
}
|
||||||
|
@ -14199,7 +14230,7 @@ CSL.Engine.prototype.processNumber = function (node, ItemObject, variable, type)
|
||||||
if (hasTerm && rangeDelimiter === "-") {
|
if (hasTerm && rangeDelimiter === "-") {
|
||||||
if (isNumeric) {
|
if (isNumeric) {
|
||||||
if (isPage || ["locator", "issue", "volume", "edition", "number"].indexOf(variable) > -1) {
|
if (isPage || ["locator", "issue", "volume", "edition", "number"].indexOf(variable) > -1) {
|
||||||
rangeDelimiter = me.getTerm("page-range-delimiter")
|
rangeDelimiter = me.getTerm("page-range-delimiter");
|
||||||
if (!rangeDelimiter) {
|
if (!rangeDelimiter) {
|
||||||
rangeDelimiter = "\u2013";
|
rangeDelimiter = "\u2013";
|
||||||
}
|
}
|
||||||
|
@ -14243,7 +14274,7 @@ CSL.Engine.prototype.processNumber = function (node, ItemObject, variable, type)
|
||||||
currentInfo.count = 1;
|
currentInfo.count = 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!me.opt["page-range-format"] && parseInt(values[i-1].value, 10) > parseInt(values[i].value, 10)) {
|
if (!me.opt["page-range-format"] && (parseInt(values[i-1].value, 10) > parseInt(values[i].value, 10))) {
|
||||||
values[i-1].joiningSuffix = fixupRangeDelimiter(variable, values[i], values[i-1].joiningSuffix, true);
|
values[i-1].joiningSuffix = fixupRangeDelimiter(variable, values[i], values[i-1].joiningSuffix, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -14259,7 +14290,7 @@ CSL.Engine.prototype.processNumber = function (node, ItemObject, variable, type)
|
||||||
}
|
}
|
||||||
str = values[i-1].value + stripHyphenBackslash(values[i-1].joiningSuffix) + values[i].value;
|
str = values[i-1].value + stripHyphenBackslash(values[i-1].joiningSuffix) + values[i].value;
|
||||||
}
|
}
|
||||||
var m = str.match(/^((?:[0-9]*[a-zA-Z]+0*))?([0-9]+)(\s*[^0-9]+\s*)([-,a-zA-Z]?0*)([0-9]+)$/);
|
var m = str.match(/^((?:[0-9]*[a-zA-Z]+0*))?([0-9]+[a-z]*)(\s*[^0-9]+\s*)([-,a-zA-Z]?0*)([0-9]+[a-z]*)$/);
|
||||||
if (m) {
|
if (m) {
|
||||||
var rangeDelimiter = m[3];
|
var rangeDelimiter = m[3];
|
||||||
rangeDelimiter = fixupRangeDelimiter(variable, val, rangeDelimiter, values[i].numeric);
|
rangeDelimiter = fixupRangeDelimiter(variable, val, rangeDelimiter, values[i].numeric);
|
||||||
|
@ -14462,7 +14493,7 @@ CSL.Util.PageRangeMangler = {};
|
||||||
CSL.Util.PageRangeMangler.getFunction = function (state, rangeType) {
|
CSL.Util.PageRangeMangler.getFunction = function (state, rangeType) {
|
||||||
var rangerex, pos, len, stringify, listify, expand, minimize, minimize_internal, chicago, lst, m, b, e, ret, begin, end, ret_func, ppos, llen;
|
var rangerex, pos, len, stringify, listify, expand, minimize, minimize_internal, chicago, lst, m, b, e, ret, begin, end, ret_func, ppos, llen;
|
||||||
var range_delimiter = state.getTerm(rangeType + "-range-delimiter");
|
var range_delimiter = state.getTerm(rangeType + "-range-delimiter");
|
||||||
rangerex = /([0-9]*[a-zA-Z]+0*)?([0-9]+)\s*(?:\u2013|-)\s*([0-9]*[a-zA-Z]+0*)?([0-9]+)/;
|
rangerex = /([0-9]*[a-zA-Z]+0*)?([0-9]+[a-z]*)\s*(?:\u2013|-)\s*([0-9]*[a-zA-Z]+0*)?([0-9]+[a-z]*)/;
|
||||||
stringify = function (lst) {
|
stringify = function (lst) {
|
||||||
len = lst.length;
|
len = lst.length;
|
||||||
for (pos = 1; pos < len; pos += 2) {
|
for (pos = 1; pos < len; pos += 2) {
|
||||||
|
@ -14480,8 +14511,8 @@ CSL.Util.PageRangeMangler.getFunction = function (state, rangeType) {
|
||||||
var this_range_delimiter = range_delimiter === "-" ? "" : range_delimiter;
|
var this_range_delimiter = range_delimiter === "-" ? "" : range_delimiter;
|
||||||
var delimRex = new RegExp("([^\\\\])[-" + this_range_delimiter + "\\u2013]", "g");
|
var delimRex = new RegExp("([^\\\\])[-" + this_range_delimiter + "\\u2013]", "g");
|
||||||
str = str.replace(delimRex, "$1 - ").replace(/\s+-\s+/g, " - ");
|
str = str.replace(delimRex, "$1 - ").replace(/\s+-\s+/g, " - ");
|
||||||
var rexm = new RegExp("((?:[0-9]*[a-zA-Z]+0*)?[0-9]+" + hyphens + "(?:[0-9]*[a-zA-Z]+0*)?[0-9]+)", "g");
|
var rexm = new RegExp("((?:[0-9]*[a-zA-Z]+0*)?[0-9]+[a-z]*" + hyphens + "(?:[0-9]*[a-zA-Z]+0*)?[0-9]+[a-z]*)", "g");
|
||||||
var rexlst = new RegExp("(?:[0-9]*[a-zA-Z]+0*)?[0-9]+" + hyphens + "(?:[0-9]*[a-zA-Z]+0*)?[0-9]+");
|
var rexlst = new RegExp("(?:[0-9]*[a-zA-Z]+0*)?[0-9]+[a-z]*" + hyphens + "(?:[0-9]*[a-zA-Z]+0*)?[0-9]+[a-z]*");
|
||||||
m = str.match(rexm);
|
m = str.match(rexm);
|
||||||
lst = str.split(rexlst);
|
lst = str.split(rexlst);
|
||||||
if (lst.length === 0) {
|
if (lst.length === 0) {
|
||||||
|
@ -15169,7 +15200,10 @@ CSL.Output.Formatters = new function () {
|
||||||
var _tagParams = {
|
var _tagParams = {
|
||||||
"<span style=\"font-variant: small-caps;\">": "</span>",
|
"<span style=\"font-variant: small-caps;\">": "</span>",
|
||||||
"<span class=\"nocase\">": "</span>",
|
"<span class=\"nocase\">": "</span>",
|
||||||
"<span class=\"nodecor\">": "</span>"
|
"<span class=\"nodecor\">": "</span>",
|
||||||
|
"<sc>": "</sc>",
|
||||||
|
"<sub>": "</sub>",
|
||||||
|
"<sup>": "</sup>"
|
||||||
}
|
}
|
||||||
function _capitalise (word, force) {
|
function _capitalise (word, force) {
|
||||||
var m = word.match(/(^\s*)((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]))(.*)/);
|
var m = word.match(/(^\s*)((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]))(.*)/);
|
||||||
|
@ -15294,8 +15328,11 @@ CSL.Output.Formatters = new function () {
|
||||||
}
|
}
|
||||||
if (config.lastWordPos) {
|
if (config.lastWordPos) {
|
||||||
var lastWords = wordDoppel.split(config.doppel.strings[config.lastWordPos.strings]);
|
var lastWords = wordDoppel.split(config.doppel.strings[config.lastWordPos.strings]);
|
||||||
var lastWord = _capitalise(lastWords.strings[config.lastWordPos.words]);
|
var lastWord = lastWords.strings[config.lastWordPos.words];
|
||||||
lastWords.strings[config.lastWordPos.words] = lastWord;
|
if (lastWord.length > 1 && lastWord.toLowerCase().match(config.skipWordsRex)) {
|
||||||
|
lastWord = _capitalise(lastWord);
|
||||||
|
lastWords.strings[config.lastWordPos.words] = lastWord;
|
||||||
|
}
|
||||||
config.doppel.strings[config.lastWordPos.strings] = wordDoppel.join(lastWords);
|
config.doppel.strings[config.lastWordPos.strings] = wordDoppel.join(lastWords);
|
||||||
}
|
}
|
||||||
return tagDoppel.join(config.doppel);
|
return tagDoppel.join(config.doppel);
|
||||||
|
@ -15707,6 +15744,212 @@ CSL.Output.Formats.prototype.rtf = {
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
CSL.Output.Formats.prototype.asciidoc = {
|
||||||
|
"text_escape": function (text) {
|
||||||
|
if (!text) {
|
||||||
|
text = "";
|
||||||
|
}
|
||||||
|
return text.replace("*", "pass:[*]", "g")
|
||||||
|
.replace("_", "pass:[_]", "g")
|
||||||
|
.replace("#", "pass:[#]", "g")
|
||||||
|
.replace("^", "pass:[^]", "g")
|
||||||
|
.replace("~", "pass:[~]", "g")
|
||||||
|
.replace("[[", "pass:[[[]", "g")
|
||||||
|
.replace(" ", "  ", "g")
|
||||||
|
.replace(CSL.SUPERSCRIPTS_REGEXP, function(aChar) {
|
||||||
|
return "^" + CSL.SUPERSCRIPTS[aChar] + "^";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
"bibstart": "",
|
||||||
|
"bibend": "",
|
||||||
|
"@passthrough/true": CSL.Output.Formatters.passthrough,
|
||||||
|
"@font-style/italic": "__%%STRING%%__",
|
||||||
|
"@font-style/oblique": "__%%STRING%%__",
|
||||||
|
"@font-style/normal": false,
|
||||||
|
"@font-variant/small-caps": "[small-caps]#%%STRING%%#",
|
||||||
|
"@font-variant/normal": false,
|
||||||
|
"@font-weight/bold": "**%%STRING%%**",
|
||||||
|
"@font-weight/normal": false,
|
||||||
|
"@font-weight/light": false,
|
||||||
|
"@text-decoration/none": false,
|
||||||
|
"@text-decoration/underline": "[underline]##%%STRING%%##",
|
||||||
|
"@vertical-align/sup": "^^%%STRING%%^^",
|
||||||
|
"@vertical-align/sub": "~~%%STRING%%~~",
|
||||||
|
"@vertical-align/baseline": false,
|
||||||
|
"@strip-periods/true": CSL.Output.Formatters.passthrough,
|
||||||
|
"@strip-periods/false": CSL.Output.Formatters.passthrough,
|
||||||
|
"@quotes/true": function (state, str) {
|
||||||
|
if ("undefined" === typeof str) {
|
||||||
|
return "``";
|
||||||
|
}
|
||||||
|
return "``" + str + "''";
|
||||||
|
},
|
||||||
|
"@quotes/inner": function (state, str) {
|
||||||
|
if ("undefined" === typeof str) {
|
||||||
|
return "`";
|
||||||
|
}
|
||||||
|
return "`" + str + "'";
|
||||||
|
},
|
||||||
|
"@quotes/false": false,
|
||||||
|
"@cite/entry": function (state, str) {
|
||||||
|
return state.sys.wrapCitationEntry(str, this.item_id, this.locator_txt, this.suffix_txt);
|
||||||
|
},
|
||||||
|
"@bibliography/entry": function (state, str) {
|
||||||
|
return str + "\n";
|
||||||
|
},
|
||||||
|
"@display/block": function (state, str) {
|
||||||
|
return str;
|
||||||
|
},
|
||||||
|
"@display/left-margin": function (state, str) {
|
||||||
|
return str;
|
||||||
|
},
|
||||||
|
"@display/right-inline": function (state, str) {
|
||||||
|
return " " + str;
|
||||||
|
},
|
||||||
|
"@display/indent": function (state, str) {
|
||||||
|
return " " + str;
|
||||||
|
},
|
||||||
|
"@showid/true": function (state, str, cslid) {
|
||||||
|
if (!state.tmp.just_looking && !state.tmp.suppress_decorations && this.params && "string" === typeof str) {
|
||||||
|
var prePunct = "";
|
||||||
|
if (str) {
|
||||||
|
var m = str.match(CSL.VARIABLE_WRAPPER_PREPUNCT_REX);
|
||||||
|
prePunct = m[1];
|
||||||
|
str = m[2];
|
||||||
|
}
|
||||||
|
var postPunct = "";
|
||||||
|
if (str && CSL.SWAPPING_PUNCTUATION.indexOf(str.slice(-1)) > -1) {
|
||||||
|
postPunct = str.slice(-1);
|
||||||
|
str = str.slice(0,-1);
|
||||||
|
}
|
||||||
|
return state.sys.variableWrapper(this.params, prePunct, str, postPunct);
|
||||||
|
} else {
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@URL/true": function (state, str) {
|
||||||
|
return str;
|
||||||
|
},
|
||||||
|
"@DOI/true": function (state, str) {
|
||||||
|
var doiurl = str;
|
||||||
|
if (!str.match(/^https?:\/\//)) {
|
||||||
|
doiurl = "https://doi.org/" + str;
|
||||||
|
}
|
||||||
|
return doiurl + "[" + str + "]";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
CSL.Output.Formats.prototype.fo = {
|
||||||
|
"text_escape": function (text) {
|
||||||
|
if (!text) {
|
||||||
|
text = "";
|
||||||
|
}
|
||||||
|
return text.replace(/&/g, "&")
|
||||||
|
.replace(/</g, "<")
|
||||||
|
.replace(/>/g, ">")
|
||||||
|
.replace(" ", "  ", "g")
|
||||||
|
.replace(CSL.SUPERSCRIPTS_REGEXP, function(aChar) {
|
||||||
|
return "<fo:inline vertical-align=\"super\">" + CSL.SUPERSCRIPTS[aChar] + "</fo:inline>";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
"bibstart": "",
|
||||||
|
"bibend": "",
|
||||||
|
"@passthrough/true": CSL.Output.Formatters.passthrough,
|
||||||
|
"@font-style/italic": "<fo:inline font-style=\"italic\">%%STRING%%</fo:inline>",
|
||||||
|
"@font-style/oblique": "<fo:inline font-style=\"oblique\">%%STRING%%</fo:inline>",
|
||||||
|
"@font-style/normal": "<fo:inline font-style=\"normal\">%%STRING%%</fo:inline>",
|
||||||
|
"@font-variant/small-caps": "<fo:inline font-variant=\"small-caps\">%%STRING%%</fo:inline>",
|
||||||
|
"@font-variant/normal": "<fo:inline font-variant=\"normal\">%%STRING%%</fo:inline>",
|
||||||
|
"@font-weight/bold": "<fo:inline font-weight=\"bold\">%%STRING%%</fo:inline>",
|
||||||
|
"@font-weight/normal": "<fo:inline font-weight=\"normal\">%%STRING%%</fo:inline>",
|
||||||
|
"@font-weight/light": "<fo:inline font-weight=\"lighter\">%%STRING%%</fo:inline>",
|
||||||
|
"@text-decoration/none": "<fo:inline text-decoration=\"none\">%%STRING%%</fo:inline>",
|
||||||
|
"@text-decoration/underline": "<fo:inline text-decoration=\"underline\">%%STRING%%</fo:inline>",
|
||||||
|
"@vertical-align/sup": "<fo:inline vertical-align=\"super\">%%STRING%%</fo:inline>",
|
||||||
|
"@vertical-align/sub": "<fo:inline vertical-align=\"sub\">%%STRING%%</fo:inline>",
|
||||||
|
"@vertical-align/baseline": "<fo:inline vertical-align=\"baseline\">%%STRING%%</fo:inline>",
|
||||||
|
"@strip-periods/true": CSL.Output.Formatters.passthrough,
|
||||||
|
"@strip-periods/false": CSL.Output.Formatters.passthrough,
|
||||||
|
"@quotes/true": function (state, str) {
|
||||||
|
if ("undefined" === typeof str) {
|
||||||
|
return state.getTerm("open-quote");
|
||||||
|
}
|
||||||
|
return state.getTerm("open-quote") + str + state.getTerm("close-quote");
|
||||||
|
},
|
||||||
|
"@quotes/inner": function (state, str) {
|
||||||
|
if ("undefined" === typeof str) {
|
||||||
|
return "\u2019";
|
||||||
|
}
|
||||||
|
return state.getTerm("open-inner-quote") + str + state.getTerm("close-inner-quote");
|
||||||
|
},
|
||||||
|
"@quotes/false": false,
|
||||||
|
"@cite/entry": function (state, str) {
|
||||||
|
return state.sys.wrapCitationEntry(str, this.item_id, this.locator_txt, this.suffix_txt);
|
||||||
|
},
|
||||||
|
"@bibliography/entry": function (state, str) {
|
||||||
|
var indent = "";
|
||||||
|
if (state.bibliography && state.bibliography.opt && state.bibliography.opt.hangingindent) {
|
||||||
|
var hi = state.bibliography.opt.hangingindent;
|
||||||
|
indent = " start-indent=\"" + hi +"em\" text-indent=\"-" + hi + "em\"";
|
||||||
|
}
|
||||||
|
var insert = "";
|
||||||
|
if (state.sys.embedBibliographyEntry) {
|
||||||
|
insert = state.sys.embedBibliographyEntry(this.item_id) + "\n";
|
||||||
|
}
|
||||||
|
return "<fo:block id=\"" + this.system_id + "\"" + indent + ">" + str + "</fo:block>\n" + insert;
|
||||||
|
},
|
||||||
|
"@display/block": function (state, str) {
|
||||||
|
return "\n <fo:block>" + str + "</fo:block>\n";
|
||||||
|
},
|
||||||
|
"@display/left-margin": function (state, str) {
|
||||||
|
return "\n <fo:table table-layout=\"fixed\" width=\"100%\">\n " +
|
||||||
|
"<fo:table-column column-number=\"1\" column-width=\"$$$__COLUMN_WIDTH_1__$$$\"/>\n " +
|
||||||
|
"<fo:table-column column-number=\"2\" column-width=\"proportional-column-width(1)\"/>\n " +
|
||||||
|
"<fo:table-body>\n " +
|
||||||
|
"<fo:table-row>\n " +
|
||||||
|
"<fo:table-cell>\n " +
|
||||||
|
"<fo:block>" + str + "</fo:block>\n " +
|
||||||
|
"</fo:table-cell>\n ";
|
||||||
|
},
|
||||||
|
"@display/right-inline": function (state, str) {
|
||||||
|
return "<fo:table-cell>\n " +
|
||||||
|
"<fo:block>" + str + "</fo:block>\n " +
|
||||||
|
"</fo:table-cell>\n " +
|
||||||
|
"</fo:table-row>\n " +
|
||||||
|
"</fo:table-body>\n " +
|
||||||
|
"</fo:table>\n";
|
||||||
|
},
|
||||||
|
"@display/indent": function (state, str) {
|
||||||
|
return "<fo:block margin-left=\"2em\">" + str + "</fo:block>\n";
|
||||||
|
},
|
||||||
|
"@showid/true": function (state, str, cslid) {
|
||||||
|
if (!state.tmp.just_looking && !state.tmp.suppress_decorations && this.params && "string" === typeof str) {
|
||||||
|
var prePunct = "";
|
||||||
|
if (str) {
|
||||||
|
var m = str.match(CSL.VARIABLE_WRAPPER_PREPUNCT_REX);
|
||||||
|
prePunct = m[1];
|
||||||
|
str = m[2];
|
||||||
|
}
|
||||||
|
var postPunct = "";
|
||||||
|
if (str && CSL.SWAPPING_PUNCTUATION.indexOf(str.slice(-1)) > -1) {
|
||||||
|
postPunct = str.slice(-1);
|
||||||
|
str = str.slice(0,-1);
|
||||||
|
}
|
||||||
|
return state.sys.variableWrapper(this.params, prePunct, str, postPunct);
|
||||||
|
} else {
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@URL/true": function (state, str) {
|
||||||
|
return "<fo:basic-link external-destination=\"url('" + str + "')\">" + str + "</fo:basic-link>";
|
||||||
|
},
|
||||||
|
"@DOI/true": function (state, str) {
|
||||||
|
var doiurl = str;
|
||||||
|
if (!str.match(/^https?:\/\//)) {
|
||||||
|
doiurl = "https://doi.org/" + str;
|
||||||
|
}
|
||||||
|
return "<fo:basic-link external-destination=\"url('" + doiurl + "')\">" + str + "</fo:basic-link>";
|
||||||
|
}
|
||||||
|
};
|
||||||
CSL.Output.Formats = new CSL.Output.Formats();
|
CSL.Output.Formats = new CSL.Output.Formats();
|
||||||
CSL.Registry = function (state) {
|
CSL.Registry = function (state) {
|
||||||
var pos, len, ret, i, ilen;
|
var pos, len, ret, i, ilen;
|
||||||
|
|
Loading…
Reference in a new issue