commit b9422b32e65d2ead496d09410059685d9c728f26
parent 2eb3a6f4dcb24322986d66ea14f8591f2c3d2d5b
Author: Frank <biercenator@gmail.com>
Date: Mon, 30 Jan 2012 16:10:38 +0800
Upgrade citeproc-js to version 1.0.271
Diffstat:
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/chrome/content/zotero/xpcom/citeproc.js b/chrome/content/zotero/xpcom/citeproc.js
@@ -837,7 +837,7 @@ CSL.Output.Queue.prototype.closeLevel = function (name) {
}
this.current.pop();
};
-CSL.Output.Queue.prototype.append = function (str, tokname, notSerious, ignorePredecessor) {
+CSL.Output.Queue.prototype.append = function (str, tokname, notSerious, ignorePredecessor, noStripPeriods) {
var token, blob, curr;
var useblob = true;
if (this.state.tmp["doing-macro-with-date"]) {
@@ -897,7 +897,7 @@ CSL.Output.Queue.prototype.append = function (str, tokname, notSerious, ignorePr
curr = this.current.value();
}
if ("string" === typeof blob.blobs) {
- if (this.state.tmp.strip_periods) {
+ if (this.state.tmp.strip_periods && !noStripPeriods) {
blob.blobs = blob.blobs.replace(/\./g, "");
}
if (!ignorePredecessor) {
@@ -1989,7 +1989,7 @@ CSL.DateParser = function () {
};
CSL.Engine = function (sys, style, lang, forceLang) {
var attrs, langspec, localexml, locale;
- this.processor_version = "1.0.270";
+ this.processor_version = "1.0.271";
this.csl_version = "1.0";
this.sys = sys;
this.sys.xml = new CSL.System.Xml.Parsing();
@@ -7093,7 +7093,7 @@ CSL.Node.number = {
}
newstr = state.fun.page_mangler(newstr);
}
- if (newstr && !newstr.match(/^[0-9]+$/)) {
+ if (newstr && !newstr.match(/^[-.\u20130-9]+$/)) {
state.output.append(newstr, this);
} else {
state.output.openLevel("empty");
@@ -7105,7 +7105,7 @@ CSL.Node.number = {
if (i < values.length - 1) {
blob.strings.suffix = blob.strings.suffix.replace(/\s*$/, "");
}
- state.output.append(blob, "literal");
+ state.output.append(blob, "literal", false, false, true);
}
state.output.closeLevel("empty");
}
@@ -7339,7 +7339,7 @@ CSL.Node.text = {
if (item && item[this.variables[0]]) {
var locator = "" + item[this.variables[0]];
locator = locator.replace(/--*/g,"\u2013");
- state.output.append(locator, this);
+ state.output.append(locator, this, false, false, true);
}
};
} else if (this.variables_real[0] === "page-first") {
@@ -7352,7 +7352,7 @@ CSL.Node.text = {
if (idx > -1) {
value = value.slice(0, idx);
}
- state.output.append(value, this);
+ state.output.append(value, this, false, false, true);
}
};
} else if (this.variables_real[0] === "page") {
@@ -7360,7 +7360,7 @@ CSL.Node.text = {
var value = state.getVariable(Item, "page", form);
if (value) {
value = state.fun.page_mangler(value);
- state.output.append(value, this);
+ state.output.append(value, this, false, false, true);
}
};
} else if (this.variables_real[0] === "volume") {
@@ -7382,6 +7382,16 @@ CSL.Node.text = {
state.output.append(value, this);
}
};
+ } else if (this.variables_real[0] === "URL") {
+ func = function (state, Item) {
+ var value;
+ if (this.variables[0]) {
+ value = state.getVariable(Item, this.variables[0], form);
+ if (value) {
+ state.output.append(value, this, false, false, true);
+ }
+ }
+ };
} else if (this.variables_real[0] === "section") {
func = function (state, Item) {
var value;