From 5e6b763623d4041ac32830b123b9376ba5c59084 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sat, 16 Apr 2016 02:44:33 -0400 Subject: [PATCH 1/4] Update citeproc-js to 1.1.96 --- chrome/content/zotero/xpcom/citeproc.js | 89 ++++++++++++++++--------- 1 file changed, 58 insertions(+), 31 deletions(-) diff --git a/chrome/content/zotero/xpcom/citeproc.js b/chrome/content/zotero/xpcom/citeproc.js index 05d0e04c9..7c5278836 100644 --- a/chrome/content/zotero/xpcom/citeproc.js +++ b/chrome/content/zotero/xpcom/citeproc.js @@ -34,7 +34,7 @@ if (!Array.indexOf) { }; } var CSL = { - PROCESSOR_VERSION: "1.1.91", + PROCESSOR_VERSION: "1.1.96", CONDITION_LEVEL_TOP: 1, CONDITION_LEVEL_BOTTOM: 2, PLAIN_HYPHEN_REGEX: /(?:[^\\]-|\u2013)/, @@ -120,7 +120,9 @@ var CSL = { "vol": "volume" }, MODULE_MACROS: { + "juris-pretitle": true, "juris-title": true, + "juris-pretitle-short": true, "juris-title-short": true, "juris-main": true, "juris-main-short": true, @@ -204,6 +206,55 @@ var CSL = { this["container-phrase"] = {}; this["title-phrase"] = {}; }, + parseNoteFieldHacks: function(Item, validFieldsForType) { + if ("string" !== typeof Item.note) return; + var elems = []; + var m = Item.note.match(CSL.NOTE_FIELDS_REGEXP); + if (m) { + var splt = Item.note.split(CSL.NOTE_FIELDS_REGEXP); + for (var i=0,ilen=(splt.length-1);i -1) { + Item[key] = {raw: val}; + elems[i] = ""; + } else { + Item[key] = val; + } + } else if (CSL.NAME_VARIABLES.indexOf(key) > -1) { + if (!names[key]) { + names[key] = []; + } + var lst = val.split(/\s*\|\|\s*/); + if (lst.length === 1) { + names[key].push({family:lst[0],isInstitution:true}); + } else if (lst.length === 2) { + var name = {family:lst[0],given:lst[1]}; + CSL.parseParticles(name); + names[key].push(name); + } + elems[i] = ""; + } + } + if (name === "type") { + Item.type = val; + } + Item.note = elems.join(""); + } + for (var key in names) { + Item[key] = names[key]; + } + } + }, GENDERS: ["masculine", "feminine"], ERROR_NO_RENDERED_FORM: 1, PREVIEW: "Just for laughs.", @@ -1099,7 +1150,7 @@ CSL.parseXml = function(str) { var _obj = {children:[]}; var _stack = [_obj.children]; function _listifyString(str) { - str = str.split("\n").join(" ").replace(/>[ ]+<").replace(/<\!--.*?-->/g, ""); + str = str.split(/(?:\r\n|\n|\r)/).join(" ").replace(/>[ ]+<").replace(/<\!--.*?-->/g, ""); var lst = str.split("><"); var stylePos = null; for (var i=0,ilen=lst.length;i -1) { - Item[mm[1]] = {raw:mm[2]}; - } else if (!Item[mm[1]] && CSL.NAME_VARIABLES.indexOf(mm[1]) > -1) { - if (!names[mm[1]]) { - names[mm[1]] = []; - } - var lst = mm[2].split(/\s*\|\|\s*/); - if (lst.length === 1) { - names[mm[1]].push({family:lst[0],isInstitution:true}); - } else if (lst.length === 2) { - var name = {family:lst[0],given:lst[1]}; - CSL.parseParticles(name); - names[mm[1]].push(name); - } - } else if (!Item[mm[1]] || mm[1] === "type") { - Item[mm[1]] = mm[2].replace(/^\s+/, "").replace(/\s+$/, ""); - } - Item.note.replace(CSL.NOTE_FIELD_REGEXP, ""); - } - for (var key in names) { - Item[key] = names[key]; - } - } + CSL.parseNoteFieldHacks(Item); } for (var i = 1, ilen = CSL.DATE_VARIABLES.length; i < ilen; i += 1) { var dateobj = Item[CSL.DATE_VARIABLES[i]]; @@ -11892,7 +11916,9 @@ CSL.Transform = function (state) { if (ret.name && !jurisdictionName) { jurisdictionName = state.sys.getHumanForm(Item[field]); } - ret.name = CSL.getSuppressedJurisdictionName.call(state, Item[field], jurisdictionName); + if (jurisdictionName) { + ret.name = CSL.getSuppressedJurisdictionName.call(state, Item[field], jurisdictionName); + } } return ret; } @@ -13205,6 +13231,7 @@ CSL.Engine.prototype.processNumber = function (node, ItemObject, variable, type) var debug = false; var me = this; function normalizeFieldValue(str, defaultLabel) { + str = str.trim(); var m = str.match(/^([^ ]+)/); if (m && !CSL.STATUTE_SUBDIV_STRINGS[m[1]]) { var embeddedLabel = null; From 196b28cc667c4e18604702bbe9f973324a68ac52 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sat, 16 Apr 2016 02:52:20 -0400 Subject: [PATCH 2/4] Update version --- install.rdf | 2 +- resource/config.js | 2 +- update.rdf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/install.rdf b/install.rdf index fdd0620ff..dc8a9d80b 100644 --- a/install.rdf +++ b/install.rdf @@ -6,7 +6,7 @@ zotero@chnm.gmu.edu Zotero - 4.0.29.7.SOURCE + 4.0.29.8.SOURCE Center for History and New Media
George Mason University
Dan Cohen Sean Takats diff --git a/resource/config.js b/resource/config.js index 6c68b8ebe..05a7557b4 100644 --- a/resource/config.js +++ b/resource/config.js @@ -15,7 +15,7 @@ var ZOTERO_CONFIG = { BOOKMARKLET_ORIGIN: 'https://www.zotero.org', HTTP_BOOKMARKLET_ORIGIN: 'http://www.zotero.org', BOOKMARKLET_URL: 'https://www.zotero.org/bookmarklet/', - VERSION: '4.0.29.7.SOURCE' + VERSION: '4.0.29.8.SOURCE' }; EXPORTED_SYMBOLS = ["ZOTERO_CONFIG"]; diff --git a/update.rdf b/update.rdf index d48c624ac..f3f70604c 100644 --- a/update.rdf +++ b/update.rdf @@ -7,7 +7,7 @@ - 4.0.29.7.SOURCE + 4.0.29.8.SOURCE {ec8030f7-c20a-464f-9b0e-13a3a9e97384} From 2ee6886cf1b0257f8a10843e45ca76c0f9c801fb Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sun, 17 Apr 2016 04:16:25 -0400 Subject: [PATCH 3/4] Update citeproc-js to 1.1.98 --- chrome/content/zotero/xpcom/citeproc.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/chrome/content/zotero/xpcom/citeproc.js b/chrome/content/zotero/xpcom/citeproc.js index 7c5278836..533a28eed 100644 --- a/chrome/content/zotero/xpcom/citeproc.js +++ b/chrome/content/zotero/xpcom/citeproc.js @@ -34,7 +34,7 @@ if (!Array.indexOf) { }; } var CSL = { - PROCESSOR_VERSION: "1.1.96", + PROCESSOR_VERSION: "1.1.98", CONDITION_LEVEL_TOP: 1, CONDITION_LEVEL_BOTTOM: 2, PLAIN_HYPHEN_REGEX: /(?:[^\\]-|\u2013)/, @@ -236,7 +236,7 @@ var CSL = { } var lst = val.split(/\s*\|\|\s*/); if (lst.length === 1) { - names[key].push({family:lst[0],isInstitution:true}); + names[key].push({literal:lst[0]}); } else if (lst.length === 2) { var name = {family:lst[0],given:lst[1]}; CSL.parseParticles(name); @@ -1200,7 +1200,7 @@ CSL.parseXml = function(str) { }); } function _getAttributes(elem) { - var m = elem.match(/([^\"= ]+)=\"[^\"]*\"/g); + var m = elem.match(/([^\'\"= ]+)=(?:\"[^\"]*\"|\'[^\']*\')/g); if (m) { for (var i=0,ilen=m.length;i]+)"); From a726699b27603ffe3de2d71eafec847a25b0ddd5 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Fri, 22 Apr 2016 00:01:37 -0400 Subject: [PATCH 4/4] Update citeproc-js to 1.1.99 --- chrome/content/zotero/xpcom/citeproc.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/xpcom/citeproc.js b/chrome/content/zotero/xpcom/citeproc.js index 533a28eed..451d9e745 100644 --- a/chrome/content/zotero/xpcom/citeproc.js +++ b/chrome/content/zotero/xpcom/citeproc.js @@ -34,7 +34,7 @@ if (!Array.indexOf) { }; } var CSL = { - PROCESSOR_VERSION: "1.1.98", + PROCESSOR_VERSION: "1.1.99", CONDITION_LEVEL_TOP: 1, CONDITION_LEVEL_BOTTOM: 2, PLAIN_HYPHEN_REGEX: /(?:[^\\]-|\u2013)/, @@ -13370,7 +13370,7 @@ CSL.Engine.prototype.processNumber = function (node, ItemObject, variable, type) isCollapsible = true; } for (var j=currentLabelInfo.pos,jlen=values.length; j 1 && isCollapsible) { + if (currentLabelInfo.label === values[j].label && currentLabelInfo.count > 1 && isCollapsible) { values[j].plural = 1; } values[j].numeric = currentLabelInfo.numeric;