update to citeproc-js 1.0.143

This commit is contained in:
Simon Kornblith 2011-04-03 01:08:40 +00:00
parent 050a845546
commit d3a58f9477

View file

@ -686,7 +686,7 @@ CSL.Output.Queue.prototype.append = function (str, tokname) {
};
CSL.Output.Queue.prototype.string = function (state, myblobs, blob) {
var blobs, ret, blob_delimiter, i, params, blobjr, last_str, last_char, b, use_suffix, qres, addtoret, span_split, j, res, blobs_start, blobs_end, key, pos, len, ppos, llen, ttype, ltype, terminal, leading, delimiters, use_prefix, txt_esc;
txt_esc = CSL.Output.Formats[this.state.opt.mode].text_escape;
txt_esc = CSL.getSafeEscape(this.state.opt.mode, this.state.tmp.area);
blobs = myblobs.slice();
ret = [];
if (blobs.length === 0) {
@ -772,7 +772,7 @@ CSL.Output.Queue.prototype.string = function (state, myblobs, blob) {
if (["@bibliography", "@display"].indexOf(params[0]) === -1) {
continue;
}
blobs_start = state.fun.decorate[params[0]][params[1]](state, blobs_start);
blobs_start = state.fun.decorate[params[0]][params[1]].call(blob, state, blobs_start);
}
}
}
@ -813,7 +813,7 @@ CSL.Output.Queue.prototype.clearlevel = function () {
};
CSL.Output.Queue.prototype.renderBlobs = function (blobs, delim) {
var state, ret, ret_last_char, use_delim, i, blob, pos, len, ppos, llen, pppos, lllen, res, str, params, txt_esc;
txt_esc = CSL.Output.Formats[this.state.opt.mode].text_escape;
txt_esc = CSL.getSafeEscape(this.state.opt.mode, this.state.tmp.area);
if (!delim) {
delim = "";
}
@ -1779,7 +1779,7 @@ CSL.DateParser = function (txt) {
};
CSL.Engine = function (sys, style, lang, forceLang) {
var attrs, langspec, localexml, locale;
this.processor_version = "1.0.140";
this.processor_version = "1.0.143";
this.csl_version = "1.0";
this.sys = sys;
this.sys.xml = new CSL.System.Xml.Parsing();
@ -2589,6 +2589,7 @@ CSL.getBibliographyEntries = function (bibsection) {
bib_entry = new CSL.Token("group", CSL.START);
bib_entry.decorations = [["@bibliography", "entry"]].concat(this[this.build.area].opt.layout_decorations);
this.output.startTag("bib_entry", bib_entry);
this.output.current.value().item_id = item.id;
sortedItems = [[{id: "" + item.id}, item]];
entry_item_ids = [];
if (this.registry.registry[item.id].master) {
@ -7295,7 +7296,9 @@ CSL.Util.Names.unInitialize = function (state, name) {
punctlist = name.match(/(\-|\s+)/g);
ret = "";
for (pos = 0, len = namelist.length; pos < len; pos += 1) {
if (CSL.ALL_ROMANESQUE_REGEXP.exec(namelist[pos].slice(0,-1))) {
if (CSL.ALL_ROMANESQUE_REGEXP.exec(namelist[pos].slice(0,-1))
&& namelist[pos]
&& namelist[pos] !== namelist[pos].toUpperCase()) {
namelist[pos] = namelist[pos].slice(0, 1) + namelist[pos].slice(1).toLowerCase();
}
ret += namelist[pos];
@ -7657,7 +7660,7 @@ CSL.Util.substituteEnd = function (state, target) {
if (toplevel && hasval) {
author_substitute = new CSL.Token("text", CSL.SINGLETON);
func = function (state, Item) {
var text_esc = CSL.Output.Formats[state.opt.mode].text_escape;
var text_esc = CSL.getSafeEscape(state.opt.mode, state.tmp.area);
var printing = !state.tmp.suppress_decorations;
if (printing) {
if (!state.tmp.rendered_name) {
@ -8037,6 +8040,7 @@ CSL.Util.FlipFlopper = function (state) {
this.okReverseHash = hashes[4];
};
CSL.Util.FlipFlopper.prototype.init = function (str, blob) {
this.txt_esc = CSL.getSafeEscape(this.state.opt.mode, this.state.tmp.area);
if (!blob) {
this.strs = this.getSplitStrings(str);
this.blob = new CSL.Blob();
@ -8134,7 +8138,7 @@ CSL.Util.FlipFlopper.prototype.getSplitStrings = function (str) {
sep = strs[badTagPos];
if (sep.length && sep[0] !== "<" && this.openToDecorations[sep] && this.quotechars.indexOf(sep.replace(/\s+/g,"")) === -1) {
params = this.openToDecorations[sep];
sep = this.state.fun.decorate[params[0]][params[1][0]](this.state);
sep = this.state.fun.decorate[params[0]][params[1]](this.state);
}
resplice = strs[(badTagPos - 1)] + sep + strs[(badTagPos + 1)];
head.push(resplice);
@ -8143,7 +8147,7 @@ CSL.Util.FlipFlopper.prototype.getSplitStrings = function (str) {
len = strs.length;
for (pos = 0; pos < len; pos += 2) {
strs[pos] = strs[pos].replace("'", "\u2019");
strs[pos] = CSL.Output.Formats[this.state.opt.mode].text_escape(strs[pos]);
strs[pos] = this.txt_esc(strs[pos]);
}
return strs;
};
@ -8255,6 +8259,13 @@ CSL.Util.FlipFlopper.prototype.addFlipFlop = function (blob, fun) {
return newdecor;
};
CSL.Output.Formatters = {};
CSL.getSafeEscape = function(outputModeOpt, outputArea) {
if (["bibliography", "citation"].indexOf(outputArea) > -1) {
return CSL.Output.Formats[outputModeOpt].text_escape;
} else {
return function (txt) { return txt; };
}
};
CSL.Output.Formatters.strip_periods = function (state, string) {
return string.replace(/\./g, " ").replace(/\s*$/g, "").replace(/\s+/g, " ");
};
@ -8606,9 +8617,9 @@ CSL.Registry.prototype.init = function (myitems, uncited_flag) {
this.mylist = myitems.concat(this.uncited);
}
this.myhash = {};
len = myitems.length;
len = this.mylist.length;
for (pos = 0; pos < len; pos += 1) {
this.myhash[myitems[pos]] = true;
this.myhash[this.mylist[pos]] = true;
}
this.refreshes = {};
this.touched = {};