diff --git a/CHANGES.txt b/CHANGES.txt index a3227d285..77b1429e1 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,5 +1,13 @@ Summary of changes to citeproc-js since version 1.2 release. +========================= +Changes in version 1.2.15 +========================= + +- Housekeeping update. Remove decommissioned attributes from schema, tests, + docs, and processor code. Still work to be done on docs, some things + remain to be covered. + ========================= Changes in version 1.2.14 ========================= diff --git a/citeproc.js b/citeproc.js index d2246de6c..2e5607567 100644 --- a/citeproc.js +++ b/citeproc.js @@ -59,7 +59,7 @@ Copyright (c) 2009-2019 Frank Bennett var CSL = { - PROCESSOR_VERSION: "1.2.14", + PROCESSOR_VERSION: "1.2.15", error: function(str) { // default error function if ("undefined" === typeof Error) { @@ -15115,18 +15115,6 @@ CSL.Node.intext = { CSL.Attributes = {}; -CSL.Attributes["@genre"] = function (state, arg) { - this.tests ? {} : this.tests = []; - arg = arg.replace("-", " "); - var func = function (Item) { - if (arg === Item.genre) { - return true; - } - return false; - }; - this.tests.push(func); -}; - CSL.Attributes["@disambiguate"] = function (state, arg) { this.tests ? {} : this.tests = []; if (arg === "true") { @@ -15701,25 +15689,6 @@ CSL.Attributes["@has-day"] = function (state, arg) { } }; -CSL.Attributes["@subjurisdictions"] = function (state, arg) { - this.tests ? {} : this.tests = []; - var trysubjurisdictions = parseInt(arg, 10); - var func = function (Item) { - var subjurisdictions = 0; - if (Item.jurisdiction) { - subjurisdictions = Item.jurisdiction.split(":").length; - } - if (subjurisdictions) { - subjurisdictions += -1; - } - if (subjurisdictions >= trysubjurisdictions) { - return true; - } - return false; - }; - this.tests.push(func); -}; - CSL.Attributes["@is-plural"] = function (state, arg) { this.tests ? {} : this.tests = []; var func = function (Item) { @@ -15857,26 +15826,6 @@ CSL.Attributes["@locale"] = function (state, arg) { } }; -CSL.Attributes["@authority-residue"] = function (state, arg) { - this.tests ? {} : this.tests = []; - var maketest = function () { - var succeed = (arg === "true") ? true : false; - return function(Item) { - if (!Item.authority || !Item.authority[0] || !Item.authority[0].family) { - return !succeed; - } - var varLen = Item.authority[0].family.split("|").length; - var stopLast = state.tmp.authority_stop_last; - if ((varLen + stopLast) > 0) { - return succeed; - } else { - return !succeed; - } - }; - }; - this.tests.push(maketest()); -}; - CSL.Attributes["@alternative-node-internal"] = function (state) { this.tests ? {} : this.tests = []; var maketest = function () { @@ -15981,10 +15930,6 @@ CSL.Attributes["@no-repeat"] = function (state, arg) { }; -CSL.Attributes["@jurisdiction-depth"] = function (state, arg) { - this.strings.jurisdiction_depth = parseInt(arg, 10); -}; - CSL.Attributes["@require"] = function (state, arg) { this.strings.require = arg; @@ -16254,9 +16199,6 @@ CSL.Attributes["@publisher-and"] = function (state, arg) { this.strings["publisher-and"] = arg; }; -CSL.Attributes["@newdate"] = function () {}; - - CSL.Attributes["@givenname-disambiguation-rule"] = function (state, arg) { if (CSL.GIVENNAME_DISAMBIGUATION_RULES.indexOf(arg) > -1) { state.citation.opt["givenname-disambiguation-rule"] = arg; @@ -16703,7 +16645,7 @@ CSL.Parallel.prototype.getRepeats = function(prev, curr) { if (key.match(rex)) { continue; } - if (typeof prev[key] === "string") { + if (typeof prev[key] === "string" || !prev[key]) { if (prev[key] && prev[key] === curr[key]) { ret[key] = true; } @@ -16763,6 +16705,7 @@ CSL.Parallel.prototype.StartCitation = function (sortedItems, out) { sortedItems[i-1][1].parallel = "first"; sortedItems[i][1].parallel = "mid"; sortedItems[i][1].repeats = this.getRepeats(prev, curr); + sortedItems[i-1][1].repeats = sortedItems[i][1].repeats; if (!sortedItems[i][1].prefix) { sortedItems[i][1].prefix = ", "; } @@ -16779,15 +16722,20 @@ CSL.Parallel.prototype.StartCitation = function (sortedItems, out) { } delete seriesRels[curr.id]; sortedItems[i][1].repeats = this.getRepeats(prev, curr); + //sortedItems[i-1][1].repeats = sortedItems[i][1].repeats; this.state.registry.registry[masterID].siblings.push(curr.id); } else { sortedItems[i-1][1].parallel = "last"; + sortedItems[i][1].repeats = this.getRepeats(prev, curr); seriesRels = false; } } if (i === (sortedItems.length-1)) { if (sortedItems[i][1].parallel === "mid") { sortedItems[i][1].parallel = "last"; + sortedItems[i][1].repeats = this.getRepeats(prev, curr); + } else if (sortedItems[i][1].parallel !== "last") { + delete sortedItems[i][1].repeats; } } } @@ -16799,22 +16747,17 @@ CSL.Parallel.prototype.purgeGroupsIfParallel = function () { for (var i = this.parallel_conditional_blobs_list.length - 1; i > -1; i += -1) { var obj = this.parallel_conditional_blobs_list[i]; if (!obj.result && !obj.repeats) { - //this.state.sys.print(i + " No action [render] " + obj.id); purgeme = false; } else { if (obj.condition) { var purgeme = true; if (obj.result === obj.condition) { - //this.state.sys.print(i + " Position match [render] "+obj.id); purgeme = false; } - //else { - // this.state.sys.print(i + " Position non-match [not-render] "+obj.id + " " + obj.condition + " " + obj.result); - //} - } else if (obj.repeats) { + } + if (purgeme && obj.norepeat && obj.repeats) { purgeme = false; var matches = 0; - //this.state.sys.print(obj.norepeat) for (var j=0,jlen=obj.norepeat.length; j obj.pos) { diff --git a/citeproc_commonjs.js b/citeproc_commonjs.js index 65236b6e6..a0a3a62db 100644 --- a/citeproc_commonjs.js +++ b/citeproc_commonjs.js @@ -59,7 +59,7 @@ Copyright (c) 2009-2019 Frank Bennett var CSL = { - PROCESSOR_VERSION: "1.2.14", + PROCESSOR_VERSION: "1.2.15", error: function(str) { // default error function if ("undefined" === typeof Error) { @@ -15115,18 +15115,6 @@ CSL.Node.intext = { CSL.Attributes = {}; -CSL.Attributes["@genre"] = function (state, arg) { - this.tests ? {} : this.tests = []; - arg = arg.replace("-", " "); - var func = function (Item) { - if (arg === Item.genre) { - return true; - } - return false; - }; - this.tests.push(func); -}; - CSL.Attributes["@disambiguate"] = function (state, arg) { this.tests ? {} : this.tests = []; if (arg === "true") { @@ -15701,25 +15689,6 @@ CSL.Attributes["@has-day"] = function (state, arg) { } }; -CSL.Attributes["@subjurisdictions"] = function (state, arg) { - this.tests ? {} : this.tests = []; - var trysubjurisdictions = parseInt(arg, 10); - var func = function (Item) { - var subjurisdictions = 0; - if (Item.jurisdiction) { - subjurisdictions = Item.jurisdiction.split(":").length; - } - if (subjurisdictions) { - subjurisdictions += -1; - } - if (subjurisdictions >= trysubjurisdictions) { - return true; - } - return false; - }; - this.tests.push(func); -}; - CSL.Attributes["@is-plural"] = function (state, arg) { this.tests ? {} : this.tests = []; var func = function (Item) { @@ -15857,26 +15826,6 @@ CSL.Attributes["@locale"] = function (state, arg) { } }; -CSL.Attributes["@authority-residue"] = function (state, arg) { - this.tests ? {} : this.tests = []; - var maketest = function () { - var succeed = (arg === "true") ? true : false; - return function(Item) { - if (!Item.authority || !Item.authority[0] || !Item.authority[0].family) { - return !succeed; - } - var varLen = Item.authority[0].family.split("|").length; - var stopLast = state.tmp.authority_stop_last; - if ((varLen + stopLast) > 0) { - return succeed; - } else { - return !succeed; - } - }; - }; - this.tests.push(maketest()); -}; - CSL.Attributes["@alternative-node-internal"] = function (state) { this.tests ? {} : this.tests = []; var maketest = function () { @@ -15981,10 +15930,6 @@ CSL.Attributes["@no-repeat"] = function (state, arg) { }; -CSL.Attributes["@jurisdiction-depth"] = function (state, arg) { - this.strings.jurisdiction_depth = parseInt(arg, 10); -}; - CSL.Attributes["@require"] = function (state, arg) { this.strings.require = arg; @@ -16254,9 +16199,6 @@ CSL.Attributes["@publisher-and"] = function (state, arg) { this.strings["publisher-and"] = arg; }; -CSL.Attributes["@newdate"] = function () {}; - - CSL.Attributes["@givenname-disambiguation-rule"] = function (state, arg) { if (CSL.GIVENNAME_DISAMBIGUATION_RULES.indexOf(arg) > -1) { state.citation.opt["givenname-disambiguation-rule"] = arg; @@ -16703,7 +16645,7 @@ CSL.Parallel.prototype.getRepeats = function(prev, curr) { if (key.match(rex)) { continue; } - if (typeof prev[key] === "string") { + if (typeof prev[key] === "string" || !prev[key]) { if (prev[key] && prev[key] === curr[key]) { ret[key] = true; } @@ -16763,6 +16705,7 @@ CSL.Parallel.prototype.StartCitation = function (sortedItems, out) { sortedItems[i-1][1].parallel = "first"; sortedItems[i][1].parallel = "mid"; sortedItems[i][1].repeats = this.getRepeats(prev, curr); + sortedItems[i-1][1].repeats = sortedItems[i][1].repeats; if (!sortedItems[i][1].prefix) { sortedItems[i][1].prefix = ", "; } @@ -16779,15 +16722,20 @@ CSL.Parallel.prototype.StartCitation = function (sortedItems, out) { } delete seriesRels[curr.id]; sortedItems[i][1].repeats = this.getRepeats(prev, curr); + //sortedItems[i-1][1].repeats = sortedItems[i][1].repeats; this.state.registry.registry[masterID].siblings.push(curr.id); } else { sortedItems[i-1][1].parallel = "last"; + sortedItems[i][1].repeats = this.getRepeats(prev, curr); seriesRels = false; } } if (i === (sortedItems.length-1)) { if (sortedItems[i][1].parallel === "mid") { sortedItems[i][1].parallel = "last"; + sortedItems[i][1].repeats = this.getRepeats(prev, curr); + } else if (sortedItems[i][1].parallel !== "last") { + delete sortedItems[i][1].repeats; } } } @@ -16799,22 +16747,17 @@ CSL.Parallel.prototype.purgeGroupsIfParallel = function () { for (var i = this.parallel_conditional_blobs_list.length - 1; i > -1; i += -1) { var obj = this.parallel_conditional_blobs_list[i]; if (!obj.result && !obj.repeats) { - //this.state.sys.print(i + " No action [render] " + obj.id); purgeme = false; } else { if (obj.condition) { var purgeme = true; if (obj.result === obj.condition) { - //this.state.sys.print(i + " Position match [render] "+obj.id); purgeme = false; } - //else { - // this.state.sys.print(i + " Position non-match [not-render] "+obj.id + " " + obj.condition + " " + obj.result); - //} - } else if (obj.repeats) { + } + if (purgeme && obj.norepeat && obj.repeats) { purgeme = false; var matches = 0; - //this.state.sys.print(obj.norepeat) for (var j=0,jlen=obj.norepeat.length; j obj.pos) { diff --git a/package.json b/package.json index 6d52605aa..73d332281 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "citeproc", - "version": "2.2.14", - "description": "The citeproc-js citation formatting module, in CommonJS format. This version is based on citeproc-js 1.2.14", + "version": "2.2.15", + "description": "The citeproc-js citation formatting module, in CommonJS format. This version is based on citeproc-js 1.2.15", "main": "citeproc_commonjs.js", "repository": { "type": "git", diff --git a/src/load.js b/src/load.js index 5d7eeeabc..63f9b052c 100644 --- a/src/load.js +++ b/src/load.js @@ -35,7 +35,7 @@ var CSL = { - PROCESSOR_VERSION: "1.2.14", + PROCESSOR_VERSION: "1.2.15", error: function(str) { // default error function if ("undefined" === typeof Error) {