commit cf125435fb991252d211b60947debbeb3600c1a1
parent 74fe4b31f981ec21835efb057810ff36c21771cf
Author: Dan Stillman <dstillman@zotero.org>
Date: Fri, 19 May 2017 04:51:20 -0400
Update citeproc-js to 1.1.167
Diffstat:
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/chrome/content/zotero/xpcom/citeproc.js b/chrome/content/zotero/xpcom/citeproc.js
@@ -23,7 +23,7 @@
* <http://www.gnu.org/licenses/> respectively.
*/
var CSL = {
- PROCESSOR_VERSION: "1.1.165",
+ PROCESSOR_VERSION: "1.1.167",
CONDITION_LEVEL_TOP: 1,
CONDITION_LEVEL_BOTTOM: 2,
PLAIN_HYPHEN_REGEX: /(?:[^\\]-|\u2013)/,
@@ -3796,6 +3796,10 @@ CSL.Output.Queue.prototype.append = function (str, tokname, notSerious, ignorePr
this.state.parallel.AppendBlobPointer(curr);
}
if ("string" === typeof str) {
+ if ("string" === typeof blob.blobs && [':', '!', '?', '.', ',', ';'].indexOf(blob.blobs.slice(0, 1)) > -1) {
+ blob.strings.prefix = blob.strings.prefix + blob.blobs.slice(0, 1);
+ blob.blobs = blob.blobs.slice(1);
+ }
if (blob.strings["text-case"]) {
blob.blobs = CSL.Output.Formatters[blob.strings["text-case"]](this.state, str);
}
@@ -14689,7 +14693,7 @@ CSL.Util.FlipFlopper = function(state) {
}
return false;
}
- function _undoppelToQueue(blob, doppel) {
+ function _undoppelToQueue(blob, doppel, leadingSpace) {
var TOP = blob;
var firstString = true;
var tagReg = new _TagReg(blob);
@@ -14767,7 +14771,11 @@ CSL.Util.FlipFlopper = function(state) {
};
var stack = new Stack(blob);
if (doppel.strings.length) {
- stack.addStyling(doppel.strings[0]);
+ var str = doppel.strings[0];
+ if (leadingSpace) {
+ str = " " + str;
+ }
+ stack.addStyling(str);
}
for (var i=0,ilen=doppel.tags.length;i<ilen;i++) {
var tag = doppel.tags[i];
@@ -14783,7 +14791,12 @@ CSL.Util.FlipFlopper = function(state) {
}
}
function processTags(blob) {
- var str = " " + blob.blobs;
+ var str = blob.blobs;
+ var leadingSpace = false;
+ if (str.slice(0, 1) === " " && !str.match(/^\s+[\'\"]/)) {
+ leadingSpace = true;
+ }
+ var str = " " + str;
var doppel = _doppelString(str);
if (doppel.tags.length === 0) return;
var quoteFormSeen = false;
@@ -14862,7 +14875,7 @@ CSL.Util.FlipFlopper = function(state) {
doppel.strings[i] += tag.slice(0, 1);
}
}
- _undoppelToQueue(blob, doppel);
+ _undoppelToQueue(blob, doppel, leadingSpace);
}
}
CSL.Output.Formatters = new function () {