commit afd6c35406cd87509178905ea8f3ccb858eafb22
parent e4086a00698e3a4c46055410efbcdaf0bae69ec2
Author: Frank <biercenator@gmail.com>
Date: Mon, 9 Jan 2012 09:04:29 +0800
Upgrade citeproc-js to version 1.0.255
Diffstat:
1 file changed, 22 insertions(+), 7 deletions(-)
diff --git a/chrome/content/zotero/xpcom/citeproc.js b/chrome/content/zotero/xpcom/citeproc.js
@@ -1963,7 +1963,7 @@ CSL.DateParser = function () {
};
CSL.Engine = function (sys, style, lang, forceLang) {
var attrs, langspec, localexml, locale;
- this.processor_version = "1.0.254";
+ this.processor_version = "1.0.255";
this.csl_version = "1.0";
this.sys = sys;
this.sys.xml = new CSL.System.Xml.Parsing();
@@ -6333,7 +6333,7 @@ CSL.NameOutput.prototype.fixupInstitution = function (name, varname, listpos) {
if (this.state.sys.getAbbreviation) {
var jurisdiction = this.Item.jurisdiction;
for (var j = 0, jlen = long_form.length; j < jlen; j += 1) {
- var jurisdiction = this.state.transform.loadAbbreviation(jurisdiction, "institution-part", long_form[j]);
+ jurisdiction = this.state.transform.loadAbbreviation(jurisdiction, "institution-part", long_form[j]);
if (this.state.transform.abbrevs[jurisdiction]["institution-part"][long_form[j]]) {
short_form[j] = this.state.transform.abbrevs[jurisdiction]["institution-part"][long_form[j]];
}
@@ -6367,7 +6367,7 @@ CSL.NameOutput.prototype._splitInstitution = function (value, v, i) {
var jurisdiction = this.Item.jurisdiction;
for (var j = splitInstitution.length; j > 0; j += -1) {
var str = splitInstitution.slice(0, j).join("|");
- var jurisdiction = this.state.transform.loadAbbreviation(jurisdiction, "institution-entire", str);
+ jurisdiction = this.state.transform.loadAbbreviation(jurisdiction, "institution-entire", str);
if (this.state.transform.abbrevs[jurisdiction]["institution-entire"][str]) {
var splitLst = this.state.transform.abbrevs[jurisdiction]["institution-entire"][str];
var splitSplitLst = splitLst.split(/>>[0-9]{4}>>/);
@@ -8331,11 +8331,26 @@ CSL.Transform = function (state) {
return jurisdiction;
}
if (state.sys.getAbbreviation) {
- if (!this.abbrevs[jurisdiction]) {
- this.abbrevs[jurisdiction] = new CSL.AbbreviationSegments();
+ var tryList = ['default'];
+ if (jurisdiction !== 'default') {
+ var workLst = jurisdiction.split(/\s*;\s*/);
+ for (var i=0, ilen=workLst.length; i < ilen; i += 1) {
+ tryList.push(workLst.slice(0,i+1).join(';'));
+ }
}
- if (!this.abbrevs[jurisdiction][category][orig]) {
- state.sys.getAbbreviation(state.opt.styleID, this.abbrevs, jurisdiction, category, orig);
+ for (var i=tryList.length - 1; i > -1; i += -1) {
+ if (!this.abbrevs[tryList[i]]) {
+ this.abbrevs[tryList[i]] = new CSL.AbbreviationSegments();
+ }
+ if (!this.abbrevs[tryList[i]][category][orig]) {
+ state.sys.getAbbreviation(state.opt.styleID, this.abbrevs, tryList[i], category, orig);
+ }
+ if (this.abbrevs[tryList[i]][category][orig]) {
+ if (i < tryList.length) {
+ this.abbrevs[jurisdiction][category][orig] = this.abbrevs[tryList[i]][category][orig];
+ }
+ break;
+ }
}
}
return jurisdiction;