From 6d723d7e8c85c64ddb7c7c04215df8f948022633 Mon Sep 17 00:00:00 2001 From: aurimasv Date: Thu, 22 Mar 2012 16:41:50 -0500 Subject: [PATCH 01/29] This should cover more dashes. E.g. "DEANE-PETER BAKER" at http://onlinelibrary.wiley.com/doi/10.1111/j.1468-5930.2011.00548.x/abstract --- chrome/content/zotero/xpcom/utilities.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/utilities.js b/chrome/content/zotero/xpcom/utilities.js index bdf52ace7..73aa39e98 100644 --- a/chrome/content/zotero/xpcom/utilities.js +++ b/chrome/content/zotero/xpcom/utilities.js @@ -628,7 +628,7 @@ Zotero.Utilities = { "down", "as"]; // this may only match a single character - const delimiterRegexp = /([ \/\-–—])/; + const delimiterRegexp = /([ \/\u002D\u00AD\u2010-\u2015\u2212\u2E3A\u2E3B])/; string = this.trimInternal(string); string = string.replace(/ : /g, ": "); From 5c565c457ff7260ae02e3f1b80179284b61dc549 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Fri, 23 Mar 2012 00:31:43 -0400 Subject: [PATCH 02/29] Set capitalizeTitles to false by default --- defaults/preferences/zotero.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/defaults/preferences/zotero.js b/defaults/preferences/zotero.js index df398ed04..58863f19e 100644 --- a/defaults/preferences/zotero.js +++ b/defaults/preferences/zotero.js @@ -33,7 +33,7 @@ pref("extensions.zotero.automaticTags",true); pref("extensions.zotero.fontSize", "1.0"); pref("extensions.zotero.recursiveCollections", false); pref("extensions.zotero.attachmentRenameFormatString", '{%c - }{%y - }{%t{50}}'); -pref("extensions.zotero.capitalizeTitles", true); +pref("extensions.zotero.capitalizeTitles", false); pref("extensions.zotero.launchNonNativeFiles", false); pref("extensions.zotero.sortNotesChronologically", false); pref("extensions.zotero.sortAttachmentsChronologically", false); From 657ea7b660684e2e2122309583aa00ed519c09b0 Mon Sep 17 00:00:00 2001 From: Frank Date: Sat, 24 Mar 2012 16:10:09 +0800 Subject: [PATCH 03/29] Upgrade citeproc-js to version 1.0.306 --- chrome/content/zotero/xpcom/citeproc.js | 113 +++++++++++++++++------- 1 file changed, 81 insertions(+), 32 deletions(-) diff --git a/chrome/content/zotero/xpcom/citeproc.js b/chrome/content/zotero/xpcom/citeproc.js index c0904bb0d..87db4c61e 100644 --- a/chrome/content/zotero/xpcom/citeproc.js +++ b/chrome/content/zotero/xpcom/citeproc.js @@ -1122,7 +1122,7 @@ CSL.Output.Queue.prototype.string = function (state, myblobs, blob) { if (state.normalDecorIsOrphan(blobjr, params)) { continue; } - b = state.fun.decorate[params[0]][params[1]](state, b); + b = state.fun.decorate[params[0]][params[1]](state, b, params[2]); } } if (b && b.length) { @@ -1169,7 +1169,7 @@ CSL.Output.Queue.prototype.string = function (state, myblobs, blob) { if (state.normalDecorIsOrphan(blobjr, params)) { continue; } - blobs_start = state.fun.decorate[params[0]][params[1]](state, blobs_start); + blobs_start = state.fun.decorate[params[0]][params[1]](state, blobs_start, params[2]); } } b = blobs_start; @@ -1188,7 +1188,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]].call(blob, state, blobs_start); + blobs_start = state.fun.decorate[params[0]][params[1]].call(blob, state, blobs_start, params[2]); } } } @@ -1286,7 +1286,7 @@ CSL.Output.Queue.prototype.renderBlobs = function (blobs, delim, has_more) { if (state.normalDecorIsOrphan(blob, params)) { continue; } - str = state.fun.decorate[params[0]][params[1]](state, str); + str = state.fun.decorate[params[0]][params[1]](state, str, params[2]); } } str = blob.strings.prefix + str + blob.strings.suffix; @@ -1711,6 +1711,7 @@ CSL.expandMacro = function (macro_key_token) { } var hasDate = false; macro_nodes = this.sys.xml.getNodesByName(this.cslXml, 'macro', mkey); + var macroid = this.sys.xml.getAttributeValue(macro_nodes,'cslid'); if (macro_nodes.length) { hasDate = this.sys.xml.getAttributeValue(macro_nodes[0], "macro-has-date"); } @@ -1723,6 +1724,7 @@ CSL.expandMacro = function (macro_key_token) { macro_key_token.execs.push(func); } macro_key_token.tokentype = CSL.START; + macro_key_token.cslid = macroid; CSL.Node.group.build.call(macro_key_token, this, this[this.build.area].tokens, true); if (!this.sys.xml.getNodeValue(macro_nodes)) { throw "CSL style error: undefined macro \"" + mkey + "\""; @@ -2156,7 +2158,7 @@ CSL.DateParser = function () { }; CSL.Engine = function (sys, style, lang, forceLang) { var attrs, langspec, localexml, locale; - this.processor_version = "1.0.305"; + this.processor_version = "1.0.306"; this.csl_version = "1.0"; this.sys = sys; this.sys.xml = new CSL.System.Xml.Parsing(); @@ -2184,6 +2186,22 @@ CSL.Engine = function (sys, style, lang, forceLang) { this.output = new CSL.Output.Queue(this); this.dateput = new CSL.Output.Queue(this); this.cslXml = this.sys.xml.makeXml(style); + if (this.opt.development_extensions.csl_reverse_lookup_support) { + this.build.cslNodeId = 0; + this.setCslNodeIds = function(myxml, nodename) { + var children = this.sys.xml.children(myxml); + this.sys.xml.setAttribute(myxml, 'cslid', this.build.cslNodeId); + this.opt.nodenames.push(nodename); + this.build.cslNodeId += 1; + for (var i = 0, ilen = this.sys.xml.numberofnodes(children); i < ilen; i += 1) { + nodename = this.sys.xml.nodename(children[i]); + if (nodename) { + this.setCslNodeIds(children[i], nodename); + } + } + } + this.setCslNodeIds(this.cslXml, "style"); + } this.sys.xml.addMissingNameNodes(this.cslXml); this.sys.xml.addInstitutionNodes(this.cslXml); this.sys.xml.insertPublisherAndPlace(this.cslXml); @@ -2750,6 +2768,8 @@ CSL.Engine.Opt = function () { this.development_extensions.flip_parentheses_to_braces = true; this.development_extensions.parse_section_variable = true; this.development_extensions.jurisdiction_subfield = true; + this.development_extensions.csl_reverse_lookup_support = false; + this.nodenames = []; this.gender = {}; this['cite-lang-prefs'] = { persons:['orig'], @@ -5279,7 +5299,6 @@ CSL.NameOutput.prototype.init = function (names) { if (!this.state.tmp.value.length) { return; } - this.state.tmp.group_context.value()[2] = false; }; CSL.NameOutput.prototype.reinit = function (names) { if (this.state.tmp.can_substitute.value()) { @@ -5381,15 +5400,20 @@ CSL.NameOutput.prototype.outputNames = function () { this.state.output.append(blob, this.names); this.state.tmp.name_node.top = this.state.output.current.value(); if (variables[0] !== "authority") { - var oldSuppressDecorations = this.state.tmp.suppress_decorations; - this.state.tmp.suppress_decorations = true; - var lastBlob = this.state.tmp.name_node.top.blobs.pop(); - var name_node_string = this.state.output.string(this.state, lastBlob.blobs, false); - this.state.tmp.name_node.top.blobs.push(lastBlob); + var name_node_string = []; + var nameobjs = this.Item[variables[0]]; + if (nameobjs) { + for (var i = 0, ilen = nameobjs.length; i < ilen; i += 1) { + substring = CSL.Util.Names.getRawName(nameobjs[i]); + if (substring) { + name_node_string.push(substring); + } + } + } + name_node_string = name_node_string.join(", "); if (name_node_string) { this.state.tmp.name_node.string = name_node_string; } - this.state.tmp.suppress_decorations = oldSuppressDecorations; } if (this.state.tmp.name_node.string && !this.state.tmp.first_name_string) { this.state.tmp.first_name_string = this.state.tmp.name_node.string; @@ -5414,24 +5438,6 @@ CSL.NameOutput.prototype.outputNames = function () { } } } - if (this.Item.type === "personal_communication" || this.Item.type === "interview") { - var author = ""; - author = this.state.tmp.name_node.string; - if (author && this.state.sys.getAbbreviation && !(this.item && this.item["suppress-author"])) { - this.state.transform.loadAbbreviation("default", "nickname", author); - var myLocalName = this.state.transform.abbrevs["default"].nickname[author]; - if (myLocalName) { - if (myLocalName === "{suppress}") { - this.state.tmp.name_node.top.blobs.pop(); - this.state.tmp.group_context.value()[2] = false; - } else { - this.state.output.append(myLocalName, "empty", true) - blob = this.state.output.pop(); - this.state.tmp.name_node.top.blobs = [blob]; - } - } - } - } this._collapseAuthor(); this.variables = []; }; @@ -5692,7 +5698,10 @@ CSL.NameOutput.prototype._getFreeters = function (v, values) { this.freeters[v] = []; for (var i = values.length - 1; i > -1; i += -1) { if (this.isPerson(values[i])) { - this.freeters[v].push(values.pop()); + var value = this._checkNickname(values.pop()); + if (value) { + this.freeters[v].push(value); + } } else { break; } @@ -5710,7 +5719,10 @@ CSL.NameOutput.prototype._getPersonsAndInstitutions = function (v, values) { var first = true; for (var i = values.length - 1; i > -1; i += -1) { if (this.isPerson(values[i])) { - persons.push(values[i]); + var value = this._checkNickname(values[i]); + if (value) { + persons.push(value); + } } else { has_affiliates = true; this.institutions[v].push(values[i]); @@ -5734,6 +5746,22 @@ CSL.NameOutput.prototype._clearValues = function (values) { values.pop(); } }; +CSL.NameOutput.prototype._checkNickname = function (name) { + var author = ""; + author = CSL.Util.Names.getRawName(name); + if (author && this.state.sys.getAbbreviation && !(this.item && this.item["suppress-author"])) { + this.state.transform.loadAbbreviation("default", "nickname", author); + var myLocalName = this.state.transform.abbrevs["default"].nickname[author]; + if (myLocalName) { + if (myLocalName === "{suppress}") { + name = false; + } else { + name = {family:myLocalName,given:''}; + } + } + } + return name; +} CSL.NameOutput.prototype.joinPersons = function (blobs, pos) { var ret; if (this.etal_spec[pos] === 1) { @@ -7708,6 +7736,9 @@ CSL.Node.text = { } }; CSL.Attributes = {}; +CSL.Attributes["@cslid"] = function (state, arg) { + this.cslid = parseInt(arg, 10); +} CSL.Attributes["@is-plural"] = function (state, arg) { var func = function (state, Item, item) { var nameList = Item[arg]; @@ -9721,6 +9752,16 @@ CSL.Util.Names.stripRight = function (str) { } return str.slice(0, end); }; +CSL.Util.Names.getRawName = function (name) { + var ret = []; + if (name.given) { + ret.push(name.given); + } + if (name.family) { + ret.push(name.family); + } + return ret.join(" "); +}; CSL.Util.Dates = {}; CSL.Util.Dates.year = {}; CSL.Util.Dates.year["long"] = function (state, num) { @@ -9857,6 +9898,11 @@ CSL.Util.substituteStart = function (state, target) { } }; this.execs.push(func); + if (this.decorations && state.opt.development_extensions.csl_reverse_lookup_support) { + this.decorations.reverse(); + this.decorations.push(["@showid","true", this.cslid]); + this.decorations.reverse(); + } nodetypes = ["number", "date", "names"]; if (("text" === this.name && !this.postponed_macro) || nodetypes.indexOf(this.name) > -1) { element_trace = function (state, Item, item) { @@ -10947,6 +10993,9 @@ CSL.Output.Formats.prototype.html = { }, "@display/indent": function (state, str) { return "
" + str + "
\n "; + }, + "@showid/true": function (state, str, cslid) { + return "" + str + ""; } }; CSL.Output.Formats.prototype.text = { From 75d320284579b8d7000a5cf8d8a202e29468f75e Mon Sep 17 00:00:00 2001 From: Frank Date: Sun, 25 Mar 2012 04:31:59 +0800 Subject: [PATCH 04/29] Upgrade citeproc-js to version 1.0.307 --- chrome/content/zotero/xpcom/citeproc.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/citeproc.js b/chrome/content/zotero/xpcom/citeproc.js index 87db4c61e..9009e3665 100644 --- a/chrome/content/zotero/xpcom/citeproc.js +++ b/chrome/content/zotero/xpcom/citeproc.js @@ -2158,7 +2158,7 @@ CSL.DateParser = function () { }; CSL.Engine = function (sys, style, lang, forceLang) { var attrs, langspec, localexml, locale; - this.processor_version = "1.0.306"; + this.processor_version = "1.0.307"; this.csl_version = "1.0"; this.sys = sys; this.sys.xml = new CSL.System.Xml.Parsing(); @@ -10179,6 +10179,9 @@ CSL.Util.Suffixator.prototype.format = function (N) { CSL.Engine.prototype.processNumber = function (node, ItemObject, variable) { var num, m, i, ilen, j, jlen; var debug = false; + if (!ItemObject) { + return; + } num = ItemObject[variable]; this.tmp.shadow_numbers[variable] = {}; this.tmp.shadow_numbers[variable].values = []; From c9e6fc3f1be7c71ff3c90bc734a73929323ed4d4 Mon Sep 17 00:00:00 2001 From: Frank Date: Sun, 25 Mar 2012 06:19:45 +0800 Subject: [PATCH 05/29] Upgrade citeproc-js to version 1.0.308 --- chrome/content/zotero/xpcom/citeproc.js | 28 +++++++++++++++---------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/chrome/content/zotero/xpcom/citeproc.js b/chrome/content/zotero/xpcom/citeproc.js index 9009e3665..0fa24a4a1 100644 --- a/chrome/content/zotero/xpcom/citeproc.js +++ b/chrome/content/zotero/xpcom/citeproc.js @@ -2158,7 +2158,7 @@ CSL.DateParser = function () { }; CSL.Engine = function (sys, style, lang, forceLang) { var attrs, langspec, localexml, locale; - this.processor_version = "1.0.307"; + this.processor_version = "1.0.308"; this.csl_version = "1.0"; this.sys = sys; this.sys.xml = new CSL.System.Xml.Parsing(); @@ -6727,6 +6727,7 @@ CSL.NameOutput.prototype.getStaticOrder = function (name, refresh) { } CSL.NameOutput.prototype._splitInstitution = function (value, v, i) { var ret = {}; + value.literal = this.state.transform.quashCheck(value.literal); var splitInstitution = value.literal.replace(/\s*\|\s*/g, "|"); splitInstitution = splitInstitution.split("|"); if (this.institution.strings.form === "short" && this.state.sys.getAbbreviation) { @@ -8921,16 +8922,7 @@ CSL.Transform = function (state) { if (myabbrev_family) { primary = abbreviate(state, Item, alternative_varname, primary, myabbrev_family, true); if (primary) { - var m = primary.match(/^!([-,_a-z]+)<< Date: Sun, 25 Mar 2012 07:27:57 +0800 Subject: [PATCH 06/29] Upgrade citeproc-js to version 1.0.309 --- chrome/content/zotero/xpcom/citeproc.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/xpcom/citeproc.js b/chrome/content/zotero/xpcom/citeproc.js index 0fa24a4a1..298904af5 100644 --- a/chrome/content/zotero/xpcom/citeproc.js +++ b/chrome/content/zotero/xpcom/citeproc.js @@ -1710,9 +1710,10 @@ CSL.expandMacro = function (macro_key_token) { this.build.macro_stack.push(mkey); } var hasDate = false; + var macroid = false; macro_nodes = this.sys.xml.getNodesByName(this.cslXml, 'macro', mkey); - var macroid = this.sys.xml.getAttributeValue(macro_nodes,'cslid'); if (macro_nodes.length) { + macroid = this.sys.xml.getAttributeValue(macro_nodes[0],'cslid'); hasDate = this.sys.xml.getAttributeValue(macro_nodes[0], "macro-has-date"); } if (hasDate) { @@ -2158,7 +2159,7 @@ CSL.DateParser = function () { }; CSL.Engine = function (sys, style, lang, forceLang) { var attrs, langspec, localexml, locale; - this.processor_version = "1.0.308"; + this.processor_version = "1.0.309"; this.csl_version = "1.0"; this.sys = sys; this.sys.xml = new CSL.System.Xml.Parsing(); @@ -6727,7 +6728,6 @@ CSL.NameOutput.prototype.getStaticOrder = function (name, refresh) { } CSL.NameOutput.prototype._splitInstitution = function (value, v, i) { var ret = {}; - value.literal = this.state.transform.quashCheck(value.literal); var splitInstitution = value.literal.replace(/\s*\|\s*/g, "|"); splitInstitution = splitInstitution.split("|"); if (this.institution.strings.form === "short" && this.state.sys.getAbbreviation) { @@ -6737,6 +6737,7 @@ CSL.NameOutput.prototype._splitInstitution = function (value, v, i) { 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]; + splitLst = this.state.transform.quashCheck(splitLst); var splitSplitLst = splitLst.split(/>>[0-9]{4}>>/); var m = splitLst.match(/>>([0-9]{4})>>/); splitLst = splitSplitLst.pop(); From 8f0ec95e735807ace07f36e0cdf9a27dbf11ac11 Mon Sep 17 00:00:00 2001 From: aurimasv Date: Fri, 16 Mar 2012 19:57:45 -0500 Subject: [PATCH 07/29] Check for references to parent. Tweaked formatting. --- chrome/content/zotero/xpcom/utilities.js | 39 ++++++++++++++++++++---- 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/chrome/content/zotero/xpcom/utilities.js b/chrome/content/zotero/xpcom/utilities.js index 73aa39e98..20df92acf 100644 --- a/chrome/content/zotero/xpcom/utilities.js +++ b/chrome/content/zotero/xpcom/utilities.js @@ -1014,7 +1014,7 @@ Zotero.Utilities = { * * Adapted from http://binnyva.blogspot.com/2005/10/dump-function-javascript-equivalent-of.html */ - "varDump":function(arr,level,maxLevel) { + "varDump":function(arr,level,maxLevel,parentObjects,path) { var dumped_text = ""; if (!level){ level = 0; @@ -1023,7 +1023,7 @@ Zotero.Utilities = { if (!maxLevel) { maxLevel = 4; } - + // The padding given at the beginning of the line. var level_padding = ""; for (var j=0;j maxLevel){ - return dumped_text + level_padding + "...\n"; + return dumped_text + level_padding + "<>...\n"; } if (typeof(arr) == 'object') { // Array/Hashes/Objects + //array for checking recursion + //initialise at first itteration + if(!parentObjects) { + parentObjects = [arr]; + path = '__ROOT__'; + } + for (var item in arr) { var value = arr[item]; - if (typeof(value) == 'object') { // If it is an array, - dumped_text += level_padding + "'" + item + "' ...\n"; - dumped_text += arguments.callee(value,level+1,maxLevel); + if (typeof(value) == 'object') { // If it is an array + //check for recursion + var i = parentObjects.indexOf(value); + if(i != -1) { + var parentName = path.split('->').slice(0,i+1).join('->'); + dumped_text += level_padding + "'" + item + "' => <>\n"; + continue; + } + + var openBrace = '{', closeBrace = '}'; + var type = Object.prototype.toString.call(value); + if(type == '[object Array]') { + openBrace = '['; + closeBrace = ']'; + } + + dumped_text += level_padding + "'" + item + "' => " + openBrace; + //only recurse if there's anything in the object, purely cosmetical + for(var i in value) { + dumped_text += "\n" + arguments.callee(value,level+1,maxLevel,parentObjects.concat(value),path + '->' + item) + level_padding; + break; + } + dumped_text += closeBrace + "\n"; } else { if (typeof value == 'function'){ From 7b5d7bccf8d01634d626a93e29fbbd24fc929e5c Mon Sep 17 00:00:00 2001 From: aurimasv Date: Sat, 17 Mar 2012 00:59:04 -0500 Subject: [PATCH 08/29] Arrays are more appropriate here than strings. --- chrome/content/zotero/xpcom/utilities.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/xpcom/utilities.js b/chrome/content/zotero/xpcom/utilities.js index 20df92acf..d46ee793f 100644 --- a/chrome/content/zotero/xpcom/utilities.js +++ b/chrome/content/zotero/xpcom/utilities.js @@ -1039,7 +1039,7 @@ Zotero.Utilities = { //initialise at first itteration if(!parentObjects) { parentObjects = [arr]; - path = '__ROOT__'; + path = ['ROOT']; } for (var item in arr) { @@ -1049,7 +1049,7 @@ Zotero.Utilities = { //check for recursion var i = parentObjects.indexOf(value); if(i != -1) { - var parentName = path.split('->').slice(0,i+1).join('->'); + var parentName = path.slice(0,i+1).join('->'); dumped_text += level_padding + "'" + item + "' => <>\n"; continue; } @@ -1064,7 +1064,7 @@ Zotero.Utilities = { dumped_text += level_padding + "'" + item + "' => " + openBrace; //only recurse if there's anything in the object, purely cosmetical for(var i in value) { - dumped_text += "\n" + arguments.callee(value,level+1,maxLevel,parentObjects.concat(value),path + '->' + item) + level_padding; + dumped_text += "\n" + arguments.callee(value,level+1,maxLevel,parentObjects.concat([value]),path.concat([item])) + level_padding; break; } dumped_text += closeBrace + "\n"; From 1458315cd51f44378c9d67f102d371eff1e23776 Mon Sep 17 00:00:00 2001 From: aurimasv Date: Sun, 18 Mar 2012 01:27:13 -0500 Subject: [PATCH 09/29] Don't use deprecated arguments.callee --- chrome/content/zotero/xpcom/utilities.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/utilities.js b/chrome/content/zotero/xpcom/utilities.js index d46ee793f..fe1cf30fa 100644 --- a/chrome/content/zotero/xpcom/utilities.js +++ b/chrome/content/zotero/xpcom/utilities.js @@ -1064,7 +1064,7 @@ Zotero.Utilities = { dumped_text += level_padding + "'" + item + "' => " + openBrace; //only recurse if there's anything in the object, purely cosmetical for(var i in value) { - dumped_text += "\n" + arguments.callee(value,level+1,maxLevel,parentObjects.concat([value]),path.concat([item])) + level_padding; + dumped_text += "\n" + varDump(value,level+1,maxLevel,parentObjects.concat([value]),path.concat([item])) + level_padding; break; } dumped_text += closeBrace + "\n"; From 752b4d252676f4fc742f532cf485a7ee5ffbb17c Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Sun, 25 Mar 2012 14:26:39 -0400 Subject: [PATCH 10/29] Correct recursive call for varDump --- chrome/content/zotero/xpcom/utilities.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/utilities.js b/chrome/content/zotero/xpcom/utilities.js index fe1cf30fa..7afbdffbe 100644 --- a/chrome/content/zotero/xpcom/utilities.js +++ b/chrome/content/zotero/xpcom/utilities.js @@ -1064,7 +1064,7 @@ Zotero.Utilities = { dumped_text += level_padding + "'" + item + "' => " + openBrace; //only recurse if there's anything in the object, purely cosmetical for(var i in value) { - dumped_text += "\n" + varDump(value,level+1,maxLevel,parentObjects.concat([value]),path.concat([item])) + level_padding; + dumped_text += "\n" + Zotero.Utilities.varDump(value,level+1,maxLevel,parentObjects.concat([value]),path.concat([item])) + level_padding; break; } dumped_text += closeBrace + "\n"; From 4aa5bef60a714d217296d2d3b766b6eeb2f09a09 Mon Sep 17 00:00:00 2001 From: Frank Date: Sun, 25 Mar 2012 16:51:21 +0800 Subject: [PATCH 11/29] Upgrade citeproc-js to version 1.0.310 --- chrome/content/zotero/xpcom/citeproc.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/chrome/content/zotero/xpcom/citeproc.js b/chrome/content/zotero/xpcom/citeproc.js index 298904af5..8460bf8b2 100644 --- a/chrome/content/zotero/xpcom/citeproc.js +++ b/chrome/content/zotero/xpcom/citeproc.js @@ -2159,7 +2159,7 @@ CSL.DateParser = function () { }; CSL.Engine = function (sys, style, lang, forceLang) { var attrs, langspec, localexml, locale; - this.processor_version = "1.0.309"; + this.processor_version = "1.0.310"; this.csl_version = "1.0"; this.sys = sys; this.sys.xml = new CSL.System.Xml.Parsing(); @@ -4414,7 +4414,7 @@ CSL.Node.date = { } } dp = dpx.slice(); - if (!state.tmp.extension && ("" + Item.volume) === "" + state.tmp.date_object.year && this.dateparts.length === 1 && this.dateparts[0] === "year") { + if (!state.tmp.extension && ("" + Item["collection-number"]) === "" + state.tmp.date_object.year && this.dateparts.length === 1 && this.dateparts[0] === "year") { for (key in state.tmp.date_object) { if (state.tmp.date_object.hasOwnProperty(key)) { if (key.slice(0, 4) === "year" && state.tmp.citeblob.can_suppress_identical_year) { @@ -7332,11 +7332,14 @@ CSL.Node.number = { varname = this.variables[0]; state.parallel.StartVariable(this.variables[0]); state.parallel.AppendToVariable(Item[this.variables[0]]); + var value = Item[this.variables[0]]; + if (value && this.variables[0] === "collection-number") { + state.tmp.citeblob.has_collection_number = true; + } if (this.text_case_normal) { - var value = Item[this.variables[0]]; if (value) { value = value.replace("\\", ""); - state.output.append(value, this) + state.output.append(value, this); } } else { var node = this; @@ -7600,7 +7603,7 @@ CSL.Node.text = { func = state.transform.getOutputFunction(this.variables, abbrevfam, abbrfall, altvar, transfall); if (this.variables_real[0] === "container-title") { var xfunc = function (state, Item, item) { - if (Item['container-title'] && state.tmp.citeblob.has_volume) { + if (Item['container-title'] && state.tmp.citeblob.has_collection_number) { state.tmp.citeblob.can_suppress_identical_year = true; } }; @@ -7641,7 +7644,6 @@ CSL.Node.text = { if (this.variables[0]) { var value = state.getVariable(Item, this.variables[0], form); if (value) { - state.tmp.citeblob.has_volume = true; state.output.append(value, this); } } From 39dbdb8483dcb3ff93fdcc901f62f53a4242cae7 Mon Sep 17 00:00:00 2001 From: Frank Date: Sun, 25 Mar 2012 18:41:01 +0800 Subject: [PATCH 12/29] Upgrade citeproc-js to version 1.0.311 --- chrome/content/zotero/xpcom/citeproc.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/chrome/content/zotero/xpcom/citeproc.js b/chrome/content/zotero/xpcom/citeproc.js index 8460bf8b2..a895e1a6b 100644 --- a/chrome/content/zotero/xpcom/citeproc.js +++ b/chrome/content/zotero/xpcom/citeproc.js @@ -2159,7 +2159,7 @@ CSL.DateParser = function () { }; CSL.Engine = function (sys, style, lang, forceLang) { var attrs, langspec, localexml, locale; - this.processor_version = "1.0.310"; + this.processor_version = "1.0.311"; this.csl_version = "1.0"; this.sys = sys; this.sys.xml = new CSL.System.Xml.Parsing(); @@ -10188,14 +10188,14 @@ CSL.Util.Suffixator.prototype.format = function (N) { CSL.Engine.prototype.processNumber = function (node, ItemObject, variable) { var num, m, i, ilen, j, jlen; var debug = false; - if (!ItemObject) { - return; - } num = ItemObject[variable]; this.tmp.shadow_numbers[variable] = {}; this.tmp.shadow_numbers[variable].values = []; this.tmp.shadow_numbers[variable].plural = 0; this.tmp.shadow_numbers[variable].numeric = false; + if (!ItemObject) { + return; + } if ("undefined" !== typeof num) { if ("number" === typeof num) { num = "" + num; From f3f86406bfbb3a7f6b977d992de624bcc96056af Mon Sep 17 00:00:00 2001 From: Frank Date: Mon, 26 Mar 2012 12:37:00 +0800 Subject: [PATCH 13/29] Upgrade citeproc-js to version 1.0.312 --- chrome/content/zotero/xpcom/citeproc.js | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/chrome/content/zotero/xpcom/citeproc.js b/chrome/content/zotero/xpcom/citeproc.js index a895e1a6b..364b26f00 100644 --- a/chrome/content/zotero/xpcom/citeproc.js +++ b/chrome/content/zotero/xpcom/citeproc.js @@ -2159,7 +2159,7 @@ CSL.DateParser = function () { }; CSL.Engine = function (sys, style, lang, forceLang) { var attrs, langspec, localexml, locale; - this.processor_version = "1.0.311"; + this.processor_version = "1.0.312"; this.csl_version = "1.0"; this.sys = sys; this.sys.xml = new CSL.System.Xml.Parsing(); @@ -4414,10 +4414,10 @@ CSL.Node.date = { } } dp = dpx.slice(); - if (!state.tmp.extension && ("" + Item["collection-number"]) === "" + state.tmp.date_object.year && this.dateparts.length === 1 && this.dateparts[0] === "year") { + if (!state.tmp.extension && ("" + Item["collection-number"]) === "" + state.tmp.date_object.year && this.dateparts.length === 1 && this.dateparts[0] === "year" && state.registry.registry[Item.id] && state.registry.registry[Item.id].renders_collection_number) { for (key in state.tmp.date_object) { if (state.tmp.date_object.hasOwnProperty(key)) { - if (key.slice(0, 4) === "year" && state.tmp.citeblob.can_suppress_identical_year) { + if (key.slice(0, 4) === "year") { delete state.tmp.date_object[key]; } } @@ -5142,7 +5142,6 @@ CSL.Node.layout = { this.execs.push(func); func = function (state, Item) { state.output.openLevel("empty"); - state.tmp.citeblob = state.output.queue[state.output.queue.length - 1]; }; this.execs.push(func); target.push(this); @@ -7332,10 +7331,10 @@ CSL.Node.number = { varname = this.variables[0]; state.parallel.StartVariable(this.variables[0]); state.parallel.AppendToVariable(Item[this.variables[0]]); - var value = Item[this.variables[0]]; - if (value && this.variables[0] === "collection-number") { - state.tmp.citeblob.has_collection_number = true; + if (varname === 'collection-number' && Item.type === 'legal_case') { + state.tmp.renders_collection_number = true; } + var value = Item[this.variables[0]]; if (this.text_case_normal) { if (value) { value = value.replace("\\", ""); @@ -7601,14 +7600,6 @@ CSL.Node.text = { abbrfall = true; } func = state.transform.getOutputFunction(this.variables, abbrevfam, abbrfall, altvar, transfall); - if (this.variables_real[0] === "container-title") { - var xfunc = function (state, Item, item) { - if (Item['container-title'] && state.tmp.citeblob.has_collection_number) { - state.tmp.citeblob.can_suppress_identical_year = true; - } - }; - this.execs.push(xfunc); - } } else { if (CSL.CITE_FIELDS.indexOf(this.variables_real[0]) > -1) { func = function (state, Item, item) { @@ -11267,6 +11258,10 @@ CSL.Registry.prototype.doinserts = function (mylist) { "disambig": false, "ref": Item }; + if (this.state.tmp.renders_collection_number) { + newitem.renders_collection_number = true; + this.state.tmp.renders_collection_number = false; + } this.registry[item] = newitem; abase = CSL.getAmbigConfig.call(this.state); this.registerAmbigToken(akey, item, abase); From d1c9a8a14807d86f63ee4cd90e3e34923739a2ca Mon Sep 17 00:00:00 2001 From: Frank Date: Tue, 27 Mar 2012 00:15:46 +0800 Subject: [PATCH 14/29] Upgrade citeproc-js to version 1.0.313 --- chrome/content/zotero/xpcom/citeproc.js | 56 +++++++++++++++++-------- 1 file changed, 39 insertions(+), 17 deletions(-) diff --git a/chrome/content/zotero/xpcom/citeproc.js b/chrome/content/zotero/xpcom/citeproc.js index 364b26f00..f6e1fad73 100644 --- a/chrome/content/zotero/xpcom/citeproc.js +++ b/chrome/content/zotero/xpcom/citeproc.js @@ -697,12 +697,12 @@ CSL_CHROME.prototype.deleteAttribute = function (myxml,attr) { myxml.removeAttribute(attr); } CSL_CHROME.prototype.setAttribute = function (myxml,attr,val) { - var attribute; if (!myxml.ownerDocument) { myxml = myxml.firstChild; } - attribute = myxml.ownerDocument.createAttribute(attr); - myxml.setAttribute(attr, val); + if (myxml.setAttribute) { + myxml.setAttribute(attr, val); + } return false; } CSL_CHROME.prototype.nodeCopy = function (myxml) { @@ -2159,7 +2159,7 @@ CSL.DateParser = function () { }; CSL.Engine = function (sys, style, lang, forceLang) { var attrs, langspec, localexml, locale; - this.processor_version = "1.0.312"; + this.processor_version = "1.0.313"; this.csl_version = "1.0"; this.sys = sys; this.sys.xml = new CSL.System.Xml.Parsing(); @@ -4105,6 +4105,19 @@ CSL.citeEnd = function (Item, item) { this.tmp.cut_var = false; this.tmp.disambig_request = false; this.tmp.cite_locales.push(this.tmp.last_cite_locale); + if (this.tmp.original_date && this.tmp.renders_collection_number) { + var buf = []; + for (var i = this.tmp.original_date.list.length - 1; i > this.tmp.original_date.pos; i += -1) { + buf.push(this.tmp.original_date.list.pop()); + } + this.tmp.original_date.list.pop(); + for (var i = buf.length - 1; i > -1; i += -1) { + this.tmp.original_date.list.push(buf.pop()); + } + this.parallel.cite["original-date"] = false; + } + this.tmp.original_date = false; + this.tmp.renders_collection_number = false; if (this.opt.development_extensions.flip_parentheses_to_braces && item && item.suffix) { var openBrace = CSL.checkNestedBraceOpen.exec(item.suffix); var closeBrace = CSL.checkNestedBraceClose.exec(item.suffix); @@ -4414,15 +4427,6 @@ CSL.Node.date = { } } dp = dpx.slice(); - if (!state.tmp.extension && ("" + Item["collection-number"]) === "" + state.tmp.date_object.year && this.dateparts.length === 1 && this.dateparts[0] === "year" && state.registry.registry[Item.id] && state.registry.registry[Item.id].renders_collection_number) { - for (key in state.tmp.date_object) { - if (state.tmp.date_object.hasOwnProperty(key)) { - if (key.slice(0, 4) === "year") { - delete state.tmp.date_object[key]; - } - } - } - } mypos = 2; len = dp.length; for (pos = 0; pos < len; pos += 1) { @@ -4443,6 +4447,23 @@ CSL.Node.date = { this.execs.push(func); func = function (state, Item) { state.output.startTag("date", this); + if (this.variables[0] === "original-date" + && Item.type === "legal_case" + && !state.tmp.extension + && "" + Item["collection-number"] === "" + state.tmp.date_object.year + && this.dateparts.length === 1 + && this.dateparts[0] === "year") { + for (key in state.tmp.date_object) { + if (state.tmp.date_object.hasOwnProperty(key)) { + if (key.slice(0, 4) === "year") { + state.tmp.original_date = {}; + var lst = state.output.current.mystack.slice(-2)[0].blobs; + state.tmp.original_date.list = lst; + state.tmp.original_date.pos = lst.length - 1; + } + } + } + } }; this.execs.push(func); } @@ -6882,6 +6903,11 @@ CSL.evaluateLabel = function (node, state, Item, item) { } plural = state.tmp.shadow_numbers[myterm].plural; } + if (node.decorations && state.opt.development_extensions.csl_reverse_lookup_support) { + node.decorations.reverse(); + node.decorations.push(["@showid","true", node.cslid]); + node.decorations.reverse(); + } } return CSL.castLabel(state, node, myterm, plural, CSL.TOLERANT); }; @@ -11258,10 +11284,6 @@ CSL.Registry.prototype.doinserts = function (mylist) { "disambig": false, "ref": Item }; - if (this.state.tmp.renders_collection_number) { - newitem.renders_collection_number = true; - this.state.tmp.renders_collection_number = false; - } this.registry[item] = newitem; abase = CSL.getAmbigConfig.call(this.state); this.registerAmbigToken(akey, item, abase); From 38c7f5964e5ab07c0a2de83a2254504cd5069c68 Mon Sep 17 00:00:00 2001 From: Frank Date: Tue, 27 Mar 2012 18:00:33 +0800 Subject: [PATCH 15/29] Change Zotero statute mapping from CSL bill to CSL legislation A bill is a law that has not yet been enacted. Legislation is law that has been enacted. The two are archived and cited differently, and should be associated with different item types. CSL provides a legislation type that is well suited to serve for laws that have been enacted. Among the existing styles in the repository, only two use the legislation variable (american-association-of-petroleum-geologists and irish-historical-studies). Both treat it as equivalent to bill. All other styles use CSL bill exclusively. It would be safe at this point to add legislation alongside bill in all tests where it occurs (481 repository styles, apart from the two mentioned above). There is no particular urgency about this patch for official Zotero, though, since statute support is likely to change considerably when full legal support comes onstream anyway. --- chrome/content/zotero/xpcom/utilities.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/utilities.js b/chrome/content/zotero/xpcom/utilities.js index 7afbdffbe..55f325b27 100644 --- a/chrome/content/zotero/xpcom/utilities.js +++ b/chrome/content/zotero/xpcom/utilities.js @@ -112,7 +112,7 @@ const CSL_TYPE_MAPPINGS = { 'case':"legal_case", 'hearing':"bill", // ?? 'patent':"patent", - 'statute':"bill", // ?? + 'statute':"legislation", // ?? 'email':"personal_communication", 'map':"map", 'blogPost':"post-weblog", From c8a87f123ae4707347c891293a88b726a4140dc8 Mon Sep 17 00:00:00 2001 From: Frank Date: Tue, 27 Mar 2012 21:19:36 +0800 Subject: [PATCH 16/29] Upgrade citeproc-js to version 1.0.314 --- 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 f6e1fad73..21c78fa1b 100644 --- a/chrome/content/zotero/xpcom/citeproc.js +++ b/chrome/content/zotero/xpcom/citeproc.js @@ -2159,7 +2159,7 @@ CSL.DateParser = function () { }; CSL.Engine = function (sys, style, lang, forceLang) { var attrs, langspec, localexml, locale; - this.processor_version = "1.0.313"; + this.processor_version = "1.0.314"; this.csl_version = "1.0"; this.sys = sys; this.sys.xml = new CSL.System.Xml.Parsing(); @@ -10205,7 +10205,6 @@ CSL.Util.Suffixator.prototype.format = function (N) { CSL.Engine.prototype.processNumber = function (node, ItemObject, variable) { var num, m, i, ilen, j, jlen; var debug = false; - num = ItemObject[variable]; this.tmp.shadow_numbers[variable] = {}; this.tmp.shadow_numbers[variable].values = []; this.tmp.shadow_numbers[variable].plural = 0; @@ -10213,6 +10212,7 @@ CSL.Engine.prototype.processNumber = function (node, ItemObject, variable) { if (!ItemObject) { return; } + num = ItemObject[variable]; if ("undefined" !== typeof num) { if ("number" === typeof num) { num = "" + num; From 8a7245fd74dbd6e9702b02ead0a3cc8cdd1097a0 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Thu, 29 Mar 2012 20:10:22 -0400 Subject: [PATCH 17/29] COinS atitle should be title for proceeding, and btitle should be publicationTitle. --- chrome/content/zotero/xpcom/openurl.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/chrome/content/zotero/xpcom/openurl.js b/chrome/content/zotero/xpcom/openurl.js index 58ee096de..2990fc703 100644 --- a/chrome/content/zotero/xpcom/openurl.js +++ b/chrome/content/zotero/xpcom/openurl.js @@ -296,20 +296,20 @@ Zotero.OpenURL = new function() { item.accessDate = ""; } } else if(key == "rft.btitle") { - if(item.itemType == "book" || item.itemType == "conferencePaper" || item.itemType == "report") { + if(item.itemType == "book" || item.itemType == "report") { item.title = value; - } else if(item.itemType == "bookSection") { + } else if(item.itemType == "bookSection" || item.itemType == "conferencePaper") { item.publicationTitle = value; } - } else if(key == "rft.atitle" && (item.itemType == "journalArticle" || - item.itemType == "bookSection")) { + } else if(key == "rft.atitle" + && ["journalArticle", "bookSection", "conferencePaper"].indexOf(item.itemType)) { item.title = value; } else if(key == "rft.jtitle" && item.itemType == "journalArticle") { item.publicationTitle = value; } else if(key == "rft.stitle" && item.itemType == "journalArticle") { item.journalAbbreviation = value; } else if(key == "rft.title") { - if(item.itemType == "journalArticle" || item.itemType == "bookSection") { + if(["journalArticle", "bookSection", "conferencePaper"].indexOf(item.itemType)) { item.publicationTitle = value; } else { item.title = value; From f77644659eb601f96dbea5ac88a55268185aaadc Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Thu, 29 Mar 2012 20:11:53 -0400 Subject: [PATCH 18/29] rft.genre=document is a document --- chrome/content/zotero/xpcom/openurl.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/chrome/content/zotero/xpcom/openurl.js b/chrome/content/zotero/xpcom/openurl.js index 2990fc703..35e17b346 100644 --- a/chrome/content/zotero/xpcom/openurl.js +++ b/chrome/content/zotero/xpcom/openurl.js @@ -252,6 +252,8 @@ Zotero.OpenURL = new function() { item.itemType = "conferencePaper"; } else if(coParts.indexOf("rft.genre=report") !== -1) { item.itemType = "report"; + } else if(coParts.indexOf("rft.genre=document") !== -1) { + item.itemType = "document"; } else { item.itemType = "book"; } From 0117065a8ed8a2cfc04323d8f8dcdabecff8fe6a Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Thu, 29 Mar 2012 20:18:26 -0400 Subject: [PATCH 19/29] Fix dumb typo --- chrome/content/zotero/xpcom/openurl.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/xpcom/openurl.js b/chrome/content/zotero/xpcom/openurl.js index 35e17b346..bf05a106a 100644 --- a/chrome/content/zotero/xpcom/openurl.js +++ b/chrome/content/zotero/xpcom/openurl.js @@ -304,14 +304,14 @@ Zotero.OpenURL = new function() { item.publicationTitle = value; } } else if(key == "rft.atitle" - && ["journalArticle", "bookSection", "conferencePaper"].indexOf(item.itemType)) { + && ["journalArticle", "bookSection", "conferencePaper"].indexOf(item.itemType) !== -1) { item.title = value; } else if(key == "rft.jtitle" && item.itemType == "journalArticle") { item.publicationTitle = value; } else if(key == "rft.stitle" && item.itemType == "journalArticle") { item.journalAbbreviation = value; } else if(key == "rft.title") { - if(["journalArticle", "bookSection", "conferencePaper"].indexOf(item.itemType)) { + if(["journalArticle", "bookSection", "conferencePaper"].indexOf(item.itemType) !== -1) { item.publicationTitle = value; } else { item.title = value; From 754836c4289216bdf7c87fb44dfa99452d78d29e Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Thu, 29 Mar 2012 20:35:27 -0400 Subject: [PATCH 20/29] Test fail if Z.selectItems() is called multiple times --- .../content/zotero/tools/testTranslators/translatorTester.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/chrome/content/zotero/tools/testTranslators/translatorTester.js b/chrome/content/zotero/tools/testTranslators/translatorTester.js index 909637898..407ea61ab 100644 --- a/chrome/content/zotero/tools/testTranslators/translatorTester.js +++ b/chrome/content/zotero/tools/testTranslators/translatorTester.js @@ -404,12 +404,17 @@ Zotero_TranslatorTester.prototype.runTest = function(test, doc, testDoneCallback translate.setHandler("done", function(obj, returnValue) { me._checkResult(test, obj, returnValue, errorReturned, testDoneCallback); }); + var selectCalled = false; translate.setHandler("select", function(obj, items, callback) { if(test.items !== "multiple" && test.items.length <= 1) { testDoneCallback(me, test, "failed", "Zotero.selectItems() called, but only one item defined in test"); callback({}); + } else if(selectCalled) { + testDoneCallback(me, test, "failed", "Zotero.selectItems() called multiple times"); + callback({}); } + selectCalled = true; var newItems = {}; var haveItems = false; for(var i in items) { From be89e3ad17fa64848f765cfd99bc509c904806d5 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Thu, 29 Mar 2012 20:35:53 -0400 Subject: [PATCH 21/29] Don't continue translating on failure --- chrome/content/zotero/tools/testTranslators/translatorTester.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/chrome/content/zotero/tools/testTranslators/translatorTester.js b/chrome/content/zotero/tools/testTranslators/translatorTester.js index 407ea61ab..dcfd3498f 100644 --- a/chrome/content/zotero/tools/testTranslators/translatorTester.js +++ b/chrome/content/zotero/tools/testTranslators/translatorTester.js @@ -409,9 +409,11 @@ Zotero_TranslatorTester.prototype.runTest = function(test, doc, testDoneCallback if(test.items !== "multiple" && test.items.length <= 1) { testDoneCallback(me, test, "failed", "Zotero.selectItems() called, but only one item defined in test"); callback({}); + return; } else if(selectCalled) { testDoneCallback(me, test, "failed", "Zotero.selectItems() called multiple times"); callback({}); + return; } selectCalled = true; From 4fcee3afa4c8ce3e389f9441614bfae9828fb67f Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Sun, 1 Apr 2012 12:28:21 -0400 Subject: [PATCH 22/29] Fix error during ISBN lookup --- chrome/content/zotero/xpcom/utilities_translate.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/utilities_translate.js b/chrome/content/zotero/xpcom/utilities_translate.js index 5a7935f74..923a7d49f 100644 --- a/chrome/content/zotero/xpcom/utilities_translate.js +++ b/chrome/content/zotero/xpcom/utilities_translate.js @@ -242,7 +242,7 @@ Zotero.Utilities.Translate.prototype.processDocuments = function(urls, processor } for(var i=0; i Date: Sun, 1 Apr 2012 13:44:49 -0400 Subject: [PATCH 23/29] Trim ISBNs before lookup --- chrome/content/zotero/lookup.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/content/zotero/lookup.js b/chrome/content/zotero/lookup.js index 99984dfea..0a2e43e84 100644 --- a/chrome/content/zotero/lookup.js +++ b/chrome/content/zotero/lookup.js @@ -39,7 +39,7 @@ const Zotero_Lookup = new function () { if(doi) { var item = {itemType:"journalArticle", DOI:doi}; } else { - identifier = identifier.replace("-", "", "g"); + identifier = identifier.trim().replace("-", "", "g"); if(identifier.length == 10 || identifier.length == 13) { // ISBN var item = {itemType:"book", ISBN:identifier}; From 8b20586ccc29fd08d50fa5070349b3c487d6da9a Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Sun, 1 Apr 2012 14:56:13 -0400 Subject: [PATCH 24/29] ZU.itemToServerJSON() should ignore empty tags --- chrome/content/zotero/xpcom/utilities.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/chrome/content/zotero/xpcom/utilities.js b/chrome/content/zotero/xpcom/utilities.js index 55f325b27..fe64190c2 100644 --- a/chrome/content/zotero/xpcom/utilities.js +++ b/chrome/content/zotero/xpcom/utilities.js @@ -1200,6 +1200,8 @@ Zotero.Utilities = { Zotero.debug("itemToServerJSON: Discarded invalid tag"); continue; } + } else if(tag === "") { + continue; } newTags[j] = {"tag":tag.toString(), "type":1}; } From e8f3fe799d822cafaf7a05214bd1173a937e923b Mon Sep 17 00:00:00 2001 From: Frank Date: Sat, 31 Mar 2012 15:38:40 +0800 Subject: [PATCH 25/29] Upgrade citeproc-js to version 1.0.315 --- chrome/content/zotero/xpcom/citeproc.js | 346 +++++++++++++----------- 1 file changed, 185 insertions(+), 161 deletions(-) diff --git a/chrome/content/zotero/xpcom/citeproc.js b/chrome/content/zotero/xpcom/citeproc.js index 21c78fa1b..e12696faf 100644 --- a/chrome/content/zotero/xpcom/citeproc.js +++ b/chrome/content/zotero/xpcom/citeproc.js @@ -1610,7 +1610,7 @@ CSL.Output.Queue.adjustPunctuation = function (state, myblobs, stk, finish) { state.tmp.last_chr = lastchr; return lastchr; }; -CSL.compareAmbigConfig = function(a, b) { +CSL.ambigConfigDiff = function(a, b) { var ret, pos, len, ppos, llen; if (a.names.length !== b.names.length) { return 1; @@ -1619,7 +1619,7 @@ CSL.compareAmbigConfig = function(a, b) { if (a.names[pos] !== b.names[pos]) { return 1; } else { - for (ppos = 0, llen = a.names[pos]; ppos < llen; ppos += 1) { + for (ppos = 0, llen = a.givens[pos]; ppos < llen; ppos += 1) { if (a.givens[pos][ppos] !== b.givens[pos][ppos]) { return 1; } @@ -1627,6 +1627,12 @@ CSL.compareAmbigConfig = function(a, b) { } } } + if (a.disambiguate != b.disambiguate) { + return 1; + } + if (a.year_suffix !== b.year_suffix) { + return 1; + } return 0; }; CSL.cloneAmbigConfig = function (config, oldconfig, tainters) { @@ -1638,23 +1644,11 @@ CSL.cloneAmbigConfig = function (config, oldconfig, tainters) { ret.disambiguate = false; for (i = 0, ilen = config.names.length; i < ilen; i += 1) { param = config.names[i]; - if (oldconfig && (!oldconfig.names[i] || oldconfig.names[i] !== param)) { - for (j = 0, jlen = tainters.length; j < jlen; j += 1) { - this.tmp.taintedItemIDs[tainters[j].id] = true; - } - oldconfig = false; - } ret.names[i] = param; } for (i = 0, ilen = config.givens.length; i < ilen; i += 1) { param = []; for (j = 0, jlen = config.givens[i].length; j < jlen; j += 1) { - if (oldconfig && oldconfig.givens[i][j] !== config.givens[i][j]) { - for (k = 0, klen = tainters.length; k < klen; k += 1) { - this.tmp.taintedItemIDs[tainters[k].id] = true; - } - oldconfig = false; - } param.push(config.givens[i][j]); } ret.givens.push(param); @@ -2159,7 +2153,7 @@ CSL.DateParser = function () { }; CSL.Engine = function (sys, style, lang, forceLang) { var attrs, langspec, localexml, locale; - this.processor_version = "1.0.314"; + this.processor_version = "1.0.315"; this.csl_version = "1.0"; this.sys = sys; this.sys.xml = new CSL.System.Xml.Parsing(); @@ -5373,6 +5367,7 @@ CSL.NameOutput.prototype.outputNames = function () { this.getEtAlConfig(); this.divideAndTransliterateNames(); this.truncatePersonalNameLists(); + this.disambigNames(); this.constrainNames(); if (this.name.strings.form === "count") { if (this.state.tmp.extension || this.names_count != 0) { @@ -5381,7 +5376,6 @@ CSL.NameOutput.prototype.outputNames = function () { } return; } - this.disambigNames(); this.setEtAlParameters(); this.setCommonTerm(); this.state.tmp.name_node = {}; @@ -5891,11 +5885,9 @@ CSL.NameOutput.prototype.disambigNames = function () { var v = this.variables[i]; if (this.freeters[v].length) { this._runDisambigNames(this.freeters[v], pos); - this.state.tmp.disambig_settings.givens.push([]); pos += 1; } if (this.institutions[v].length) { - this.state.tmp.disambig_settings.givens.push([]); pos += 1; } for (var j = 0, jlen = this.persons[v].length; j < jlen; j += 1) { @@ -5910,23 +5902,26 @@ CSL.NameOutput.prototype.disambigNames = function () { CSL.NameOutput.prototype._runDisambigNames = function (lst, pos) { var chk, myform, myinitials, param, i, ilen, paramx; for (i = 0, ilen = lst.length; i < ilen; i += 1) { - if (!lst[i].given || !lst[i].family) { + if (!lst[i].given && !lst[i].family) { continue; } + myinitials = this.name.strings["initialize-with"]; this.state.registry.namereg.addname("" + this.Item.id, lst[i], i); chk = this.state.tmp.disambig_settings.givens[pos]; if ("undefined" === typeof chk) { - this.state.tmp.disambig_settings.givens.push([]); + for (var j = 0, jlen = pos + 1; j < jlen; j += 1) { + if (!this.state.tmp.disambig_settings.givens[j]) { + this.state.tmp.disambig_settings.givens[j] = []; + } + } } chk = this.state.tmp.disambig_settings.givens[pos][i]; if ("undefined" === typeof chk) { myform = this.name.strings.form; - myinitials = this.name.strings["initialize-with"]; param = this.state.registry.namereg.evalname("" + this.Item.id, lst[i], i, 0, myform, myinitials); this.state.tmp.disambig_settings.givens[pos].push(param); } myform = this.name.strings.form; - myinitials = this.name.strings["initialize-with"]; paramx = this.state.registry.namereg.evalname("" + this.Item.id, lst[i], i, 0, myform, myinitials); if (this.state.tmp.disambig_request) { var val = this.state.tmp.disambig_settings.givens[pos][i]; @@ -5947,6 +5942,11 @@ CSL.NameOutput.prototype._runDisambigNames = function (lst, pos) { } if (!this.state.tmp.sort_key_flag) { this.state.tmp.disambig_settings.givens[pos][i] = param; + if ("string" === typeof myinitials + && ("undefined" === typeof this.name.strings["initialize"] + || true === this.name.strings["initialize"])) { + this.state.tmp.disambig_settings.use_initials = true; + } } } }; @@ -6073,9 +6073,6 @@ CSL.NameOutput.prototype._imposeNameConstraints = function (lst, count, key, pos } } this.state.tmp.disambig_settings.names[pos] = lst[key].length; - if (!this.state.tmp.disambig_request) { - this.state.tmp.disambig_settings.givens[pos] = []; - } }; CSL.NameOutput.prototype.getEtAlConfig = function () { var item = this.item; @@ -11754,8 +11751,8 @@ CSL.Disambiguation.prototype.run = function(akey) { }; CSL.Disambiguation.prototype.runDisambig = function () { var pos, len, ppos, llen, pppos, lllen, ismax; + this.initGivens = true; for (pos = 0; pos < this.lists.length; pos += 1) { - this.nnameset = 0; this.gnameset = 0; this.gname = 0; this.clashes = [1, 0]; @@ -11765,33 +11762,25 @@ CSL.Disambiguation.prototype.runDisambig = function () { this.base = this.lists[pos][0]; } var names_used = []; - ismax = this.incrementDisambig(); - this.scanItems(this.lists[pos], 1); + var ismax = this.incrementDisambig(); + this.scanItems(this.lists[pos]); this.evalScan(ismax); } } }; -CSL.Disambiguation.prototype.scanItems = function (list, phase) { +CSL.Disambiguation.prototype.scanItems = function (list) { var pos, len, Item, otherItem, ItemCite, ignore, base; - Item = list[1][0]; + this.Item = list[1][0]; + this.ItemCite = CSL.getAmbiguousCite.call(this.state, this.Item, this.base); this.scanlist = list[1]; this.partners = []; - var tempResult = this.getItemDesc(Item); - this.base = tempResult[0]; - if (!phase) { - this.base.disambiguate = false; - } - this.maxvals = tempResult[1]; - this.minval = tempResult[2]; - ItemCite = tempResult[3]; - this.partners.push(Item); + this.partners.push(this.Item); this.nonpartners = []; var clashes = 0; for (pos = 1, len = list[1].length; pos < len; pos += 1) { otherItem = list[1][pos]; - var otherItemData = this.getItemDesc(otherItem); - var otherItemCite = otherItemData[3]; - if (ItemCite === otherItemCite) { + var otherItemCite = CSL.getAmbiguousCite.call(this.state, otherItem, this.base); + if (this.ItemCite === otherItemCite) { clashes += 1; this.partners.push(otherItem); } else { @@ -11801,66 +11790,75 @@ CSL.Disambiguation.prototype.scanItems = function (list, phase) { this.clashes[0] = this.clashes[1]; this.clashes[1] = clashes; }; -CSL.Disambiguation.prototype.evalScan = function (ismax) { - this[this.modes[this.modeindex]](ismax); +CSL.Disambiguation.prototype.evalScan = function (maxed) { + this[this.modes[this.modeindex]](maxed); + if (maxed) { + if (this.modeindex < this.modes.length - 1) { + this.modeindex += 1; + } else { + this.lists[this.listpos + 1] = [this.base, []]; + } + } }; CSL.Disambiguation.prototype.disNames = function (ismax) { var pos, len, mybase; if (this.clashes[1] === 0 && this.nonpartners.length === 1) { - mybase = CSL.cloneAmbigConfig(this.base); - mybase.year_suffix = false; - this.state.registry.registerAmbigToken(this.akey, "" + this.partners[0].id, mybase); - this.state.registry.registerAmbigToken(this.akey, "" + this.nonpartners[0].id, mybase); - this.state.tmp.taintedItemIDs[this.nonpartners[0].id] = true; - this.lists[this.listpos] = [this.base, []]; - } else if (this.clashes[1] === 0) { - this.betterbase = CSL.cloneAmbigConfig(this.base); - this.betterbase.year_suffix = false; - this.state.registry.registerAmbigToken(this.akey, "" + this.partners[0].id, this.betterbase); - this.lists[this.listpos] = [this.base, []]; - } else if (this.nonpartners.length === 1) { - this.betterbase = CSL.cloneAmbigConfig(this.base); - this.betterbase.year_suffix = false; + this.captureStepToBase(); this.state.registry.registerAmbigToken(this.akey, "" + this.nonpartners[0].id, this.betterbase); - this.lists[this.listpos] = [this.base, this.partners]; + this.state.registry.registerAmbigToken(this.akey, "" + this.partners[0].id, this.betterbase); + this.lists[this.listpos] = [this.betterbase, []]; + } else if (this.clashes[1] === 0) { + this.captureStepToBase(); + this.state.registry.registerAmbigToken(this.akey, "" + this.partners[0].id, this.betterbase); + this.lists[this.listpos] = [this.betterbase, this.nonpartners]; + if (this.nonpartners.length) { + this.initGivens = true; + } + } else if (this.nonpartners.length === 1) { + this.captureStepToBase(); + this.state.registry.registerAmbigToken(this.akey, "" + this.nonpartners[0].id, this.betterbase); + this.lists[this.listpos] = [this.betterbase, this.partners]; } else if (this.clashes[1] < this.clashes[0]) { - this.betterbase = CSL.cloneAmbigConfig(this.base); - this.lists[this.listpos] = [this.base, this.partners]; - this.lists.push([this.base, this.nonpartners]); + this.captureStepToBase(); + this.lists[this.listpos] = [this.betterbase, this.partners]; + this.lists.push([this.betterbase, this.nonpartners]) } else { if (ismax) { - if (this.betterbase) { - this.base = CSL.cloneAmbigConfig(this.betterbase); - } - this.lists[this.listpos] = [this.base, this.nonpartners]; - for (pos = 0, len = this.partners.length; pos < len; pos += 1) { - this.state.registry.registerAmbigToken(this.akey, "" + this.partners[pos].id, this.base); + this.lists[this.listpos] = [this.betterbase, this.nonpartners]; + this.lists.push([this.betterbase, this.partners]); + if (this.modeindex === this.modes.length - 1) { + for (var i = 0, ilen = this.partners.length; i < ilen; i += 1) { + this.state.registry.registerAmbigToken(this.akey, "" + this.partners[i].id, this.betterbase); + } + this.lists[this.listpos] = [this.betterbase, []]; } } } }; CSL.Disambiguation.prototype.disExtraText = function () { var pos, len, mybase; - mybase = CSL.cloneAmbigConfig(this.base); - mybase.year_suffix = false; - if (this.clashes[1] === 0 || this.clashes[1] < this.clashes[0]) { - this.state.registry.registerAmbigToken(this.akey, "" + this.partners[0].id, mybase); - for (var i=0, ilen=this.partners.length; i < ilen; i += 1) { - this.state.registry.registerAmbigToken(this.akey, "" + this.partners[i].id, mybase); - } - for (var i=0, ilen=this.nonpartners.length; i < ilen; i += 1) { - this.state.registry.registerAmbigToken(this.akey, "" + this.nonpartners[i].id, mybase); - } + if (this.modes.length > 1 && !this.base.disambiguate) { + this.modeindex = 0; + this.base = CSL.cloneAmbigConfig(this.betterbase); + } + if (!this.betterbase.disambiguate) { + this.base.disambiguate = true; + this.betterbase.disambiguate = true; + this.initGivens = true; } else { - for (var i=0, ilen=this.partners.length; i < ilen; i += 1) { - this.state.registry.registerAmbigToken(this.akey, "" + this.partners[i].id, this.betterbase); + if (this.modeindex === this.modes.length - 1) { + var base = this.lists[this.listpos][0]; + for (var i = 0, ilen = this.lists[this.listpos][1].length; i < ilen; i += 1) { + this.state.registry.registerAmbigToken(this.akey, "" + this.lists[this.listpos][1][i].id, base); + } + this.lists[this.listpos] = [this.betterbase, []]; } } - this.lists[this.listpos] = [this.base, []]; }; CSL.Disambiguation.prototype.disYears = function () { var pos, len, tokens, token, item; tokens = []; + var base = this.lists[this.listpos][0]; if (this.clashes[1]) { for (pos = 0, len = this.lists[this.listpos][1].length; pos < len; pos += 1) { token = this.registry[this.lists[this.listpos][1][pos].id]; @@ -11869,118 +11867,93 @@ CSL.Disambiguation.prototype.disYears = function () { } tokens.sort(this.state.registry.sorter.compareKeys); for (pos = 0, len = tokens.length; pos < len; pos += 1) { - if (pos === 0) { - this.base.year_suffix = ""+pos; - this.state.registry.registerAmbigToken(this.akey, "" + tokens[pos].id, this.base); - } else { - this.base.year_suffix = ""+pos; - this.state.registry.registerAmbigToken(this.akey, "" + tokens[pos].id, this.base); - } - var newys = this.state.registry.registry[tokens[pos].id].disambig.year_suffix; - if (this.old_desc[tokens[pos].id][0] !== newys) { + base.year_suffix = ""+pos; + var oldBase = this.state.registry.registry[tokens[pos].id].disambig; + this.state.registry.registerAmbigToken(this.akey, "" + tokens[pos].id, base); + if (CSL.ambigConfigDiff(oldBase,base)) { this.state.tmp.taintedItemIDs[tokens[pos].id] = true; } } - this.lists[this.listpos] = [this.base, []]; + this.lists[this.listpos] = [this.betterbase, []]; }; CSL.Disambiguation.prototype.incrementDisambig = function () { - var val, maxed; - var maxed = false; + var val; + if (this.initGivens) { + this.initGivens = false; + return false; + } + maxed = false; + increment_names = true; + increment_givens = true; if ("disNames" === this.modes[this.modeindex]) { - var increment_name = false; - var increment_nameset = false; - if (this.state.opt["disambiguate-add-givenname"] && this.state.opt["givenname-disambiguation-rule"] === "by-cite") { - if (this.base.givens[this.gnameset][this.gname] < 2) { + increment_names = false; + if ("number" !== typeof this.givensMax) { + increment_names = true; + } + var increment_namesets = false; + if ("number" !== typeof this.namesMax) { + increment_namesets = true; + } + if ("number" === typeof this.givensMax) { + if (this.base.givens[this.gnameset][this.gname] < this.givensMax) { this.base.givens[this.gnameset][this.gname] += 1; } else { - this.base.givens[this.gnameset][this.gname] = this.betterbase.givens[this.gnameset][this.gname]; - if (this.gname < this.base.names[this.gnameset]) { - this.gname += 1; - this.base.names[this.gnameset] += 1; - this.base.givens[this.gnameset][this.gname] += 1; - } else { - increment_name = true; - } + var increment_names = true; } - } else { - increment_name = true; } - if (this.state.opt["disambiguate-add-names"]) { - if (increment_name) { - if (this.base.names[this.gnameset] < this.maxvals[this.gnameset]) { - this.gname += 1; - this.base.names[this.gnameset] += 1; - } else { - increment_nameset = true; - } + if ("number" === typeof this.namesMax && increment_names) { + increment_namesets = false; + if (this.base.names[this.gnameset] < this.namesMax) { + this.base.names[this.gnameset] += 1; + this.gname += 1; + } else { + var increment_namesets = true; } - if (increment_nameset) { - if (this.gnameset < this.base.names.length - 1) { - this.gnameset += 1; - this.gname = 0; - if (this.state.opt["disambiguate-add-givenname"] && this.state.opt["givenname-disambiguation-rule"] === "by-cite") { - this.base.givens[this.gnameset][this.gname] += 1; - } else if (this.base.names[this.gnameset] < this.maxvals[this.gnameset]) { - this.gname += 1; - this.base.names[this.gnameset] += 1; - } - } else { - maxed = true; - this.base = CSL.cloneAmbigConfig(this.betterbase); - if (this.modeindex < this.modes.length - 1) { - this.modeindex += 1; - } - } + } + if ("number" === typeof this.namesetsMax && increment_namesets) { + if (this.gnameset < this.namesetsMax) { + this.gnameset += 1; + this.base.names[this.gnameset] = 1; + this.gname = 0; + } else { + var increment_mode = true; } - } else if (increment_name) { + } + if (("number" !== typeof this.namesetsMax || this.namesetsMax === -1 || this.gnameset === this.namesetsMax) + && ("number" !== typeof this.namesMax || this.base.names[this.gnameset] === this.namesMax) + && ("number" != typeof this.givensMax || "undefined" === typeof this.base.givens[this.gnameset][this.gname] || this.base.givens[this.gnameset][this.gname] === this.givensMax)) { maxed = true; - if (this.modeindex < this.modes.length - 1) { - this.modeindex += 1; - } } } - if ("disExtraText" === this.modes[this.modeindex]) { - this.base.disambiguate = true; - } if ("disYears" === this.modes[this.modeindex]) { } return maxed; }; -CSL.Disambiguation.prototype.getItemDesc = function (Item, forceMax) { - var str, maxvals, minval, base; - str = CSL.getAmbiguousCite.call(this.state, Item, this.base); - maxvals = CSL.getMaxVals.call(this.state); - minval = CSL.getMinVal.call(this.state); - base = CSL.getAmbigConfig.call(this.state); - return [base, maxvals, minval, str]; -}; CSL.Disambiguation.prototype.initVars = function (akey) { var i, ilen, myIds, myItemBundles, myItems; this.lists = []; this.base = false; this.betterbase = false; this.akey = akey; + this.maxNamesByItemId = {}; myItemBundles = []; - this.old_desc = {}; myIds = this.ambigcites[akey]; + var Item = false; + var myItem = this.state.retrieveItem("" + myIds[0]); + this.getCiteData(myItem); + this.base = CSL.getAmbigConfig.call(this.state); if (myIds && myIds.length > 1) { - for (i = 0, ilen = myIds.length; i < ilen; i += 1) { - var myItem = this.state.retrieveItem("" + myIds[i]); - var myDesc = this.getItemDesc(myItem); - if (!this.betterbase) { - this.betterbase = CSL.cloneAmbigConfig(myDesc[0]); - this.base = myDesc[0]; - this.maxvals = myDesc[1]; - this.minval = myDesc[2]; - } - myItemBundles.push([myDesc, myItem]); - this.old_desc[myIds[i]] = [this.state.registry.registry[myIds[i]].disambig.year_suffix, this.state.registry.registry[myIds[i]].disambig.disambiguate]; + myItemBundles.push([this.maxNamesByItemId[myItem.id], myItem]); + for (i = 1, ilen = myIds.length; i < ilen; i += 1) { + myItem = this.state.retrieveItem("" + myIds[i]); + this.getCiteData(myItem, this.base); + myItemBundles.push([this.maxNamesByItemId[myItem.id], myItem]); } myItemBundles.sort( function (a, b) { - if (a[0][1] > b[0][1]) { + if (a[0] > b[0]) { return 1; - } else if (a[0][1] < b[0][1]) { + } else if (a[0] < b[0]) { return -1; } else { if (a[1].id > b[1].id) { @@ -11998,8 +11971,27 @@ CSL.Disambiguation.prototype.initVars = function (akey) { myItems.push(myItemBundles[i][1]); } this.lists.push([this.base, myItems]); + this.Item = this.lists[0][1][0]; + } else { + this.Item = this.state.retrieveItem("" + myIds[0]); } this.modeindex = 0; + this.namesMax = this.maxNamesByItemId[this.Item.id][0]; + for (var i = 0, ilen = this.base.givens.length; i < ilen; i += 1) { + for (var j = 0, jlen = this.namesMax; j < jlen; j += 1) { + if (!this.base.givens[i][j]) { + this.base.givens[i][j] = 0; + this.betterbase.givens[i][j] = 0; + } + } + } + this.base.year_suffix = false; + this.base.disambiguate = false; + this.betterbase.year_suffix = false; + this.betterbase.disambiguate = false; + if (this.state.opt["givenname-disambiguation-rule"] === "by-cite") { + this.givensMax = 2; + } }; CSL.Disambiguation.prototype.configModes = function () { var dagopt, gdropt; @@ -12016,6 +12008,38 @@ CSL.Disambiguation.prototype.configModes = function () { this.modes.push("disYears"); } }; +CSL.Disambiguation.prototype.getCiteData = function(Item, base) { + if (!this.maxNamesByItemId[Item.id]) { + CSL.getAmbiguousCite.call(this.state, Item, base); + base = CSL.getAmbigConfig.call(this.state); + this.maxNamesByItemId[Item.id] = CSL.getMaxVals.call(this.state); + this.state.registry.registry[Item.id].disambig.givens = this.state.tmp.disambig_settings.givens.slice(); + this.namesetsMax = this.state.registry.registry[Item.id].disambig.names.length - 1; + if (!this.base) { + this.base = base; + this.betterbase = CSL.cloneAmbigConfig(base); + } + if (base.names.length < this.base.names.length) { + this.base = base; + } + var update = false; + for (var i = 0, ilen = base.names.length; i < ilen; i += 1) { + if (base.names[i] > this.base.names[i]) { + this.base.givens[i] = this.base.givens[i].concat(this.base.givens[i].slice(this.base.names[i])); + this.base.names[i] = base.names[i]; + this.betterbase.names = this.base.names.slice(); + } + } + this.betterbase.givens = this.base.givens.slice(); + for (var j = 0, jlen = this.base.givens.length; j < jlen; j += 1) { + this.betterbase.givens[j] = this.base.givens[j].slice(); + } + } +}; +CSL.Disambiguation.prototype.captureStepToBase = function() { + this.betterbase.givens[this.gnameset][this.gname] = this.base.givens[this.gnameset][this.gname]; + this.betterbase.names[this.gnameset] = this.base.names[this.gnameset]; +}; CSL.Registry.CitationReg = function (state) { this.citationById = {}; this.citationByIndex = []; From 89d3f096828ce8f2321ea9b1fa5ded03bcf3dd88 Mon Sep 17 00:00:00 2001 From: Frank Date: Mon, 2 Apr 2012 15:42:26 +0800 Subject: [PATCH 26/29] Upgrade citeproc-js to version 1.0.316 --- chrome/content/zotero/xpcom/citeproc.js | 107 ++++++++++++++++++------ 1 file changed, 81 insertions(+), 26 deletions(-) diff --git a/chrome/content/zotero/xpcom/citeproc.js b/chrome/content/zotero/xpcom/citeproc.js index e12696faf..b8383cfc9 100644 --- a/chrome/content/zotero/xpcom/citeproc.js +++ b/chrome/content/zotero/xpcom/citeproc.js @@ -2153,7 +2153,7 @@ CSL.DateParser = function () { }; CSL.Engine = function (sys, style, lang, forceLang) { var attrs, langspec, localexml, locale; - this.processor_version = "1.0.315"; + this.processor_version = "1.0.316"; this.csl_version = "1.0"; this.sys = sys; this.sys.xml = new CSL.System.Xml.Parsing(); @@ -2522,6 +2522,20 @@ CSL.Engine.prototype.retrieveItem = function (id) { } } } + if (this.opt.development_extensions.atomic_statutes) { + if (Item.type && ["legislation","bill"].indexOf(Item.type) > -1 + && Item.title + && Item.jurisdiction) { + var legislation_id = []; + for (var i = 0, ilen = 3; i < ilen; i += 1) { + var varname = ["type", "genre", "jurisdiction"][i]; + if (Item[varname]) { + legislation_id.push(Item[varname]); + } + } + Item.legislation_id = legislation_id.join("::"); + } + } for (var i = 1, ilen = CSL.DATE_VARIABLES.length; i < ilen; i += 1) { var dateobj = Item[CSL.DATE_VARIABLES[i]]; if (dateobj) { @@ -2763,6 +2777,7 @@ CSL.Engine.Opt = function () { this.development_extensions.flip_parentheses_to_braces = true; this.development_extensions.parse_section_variable = true; this.development_extensions.jurisdiction_subfield = true; + this.development_extensions.atomic_statutes = false; this.development_extensions.csl_reverse_lookup_support = false; this.nodenames = []; this.gender = {}; @@ -3509,13 +3524,29 @@ CSL.Engine.prototype.processCitationCluster = function (citation, citationsPre, } for (k = 0, klen = citations[j].sortedItems.length; k < klen; k += 1) { item = citations[j].sortedItems[k]; + var myid = item[0].id; + var mylocator = item[1].locator; + var mylabel = item[1].label; + if (item[0].legislation_id) { + myid = item[0].legislation_id; + mylocator = item[0].section; + mylabel = ""; + } + var incitationid; + if (k > 0) { + if (onecitation.sortedItems[k - 1][0].legislation_id) { + incitationid = onecitation.sortedItems[k - 1][0].legislation_id; + } else { + incitationid = onecitation.sortedItems[k - 1][1].id + } + } if (flag === CSL.PREVIEW) { if (onecitation.citationID != citation.citationID) { if ("undefined" === typeof first_ref[item[1].id]) { - first_ref[item[1].id] = onecitation.properties.noteIndex; - last_ref[item[1].id] = onecitation.properties.noteIndex; + first_ref[myid] = onecitation.properties.noteIndex; + last_ref[myid] = onecitation.properties.noteIndex; } else { - last_ref[item[1].id] = onecitation.properties.noteIndex; + last_ref[myid] = onecitation.properties.noteIndex; } continue; } @@ -3526,17 +3557,27 @@ CSL.Engine.prototype.processCitationCluster = function (citation, citationsPre, oldvalue["near-note"] = item[1]["near-note"]; item[1]["first-reference-note-number"] = 0; item[1]["near-note"] = false; - if ("undefined" === typeof first_ref[item[1].id]) { - first_ref[item[1].id] = onecitation.properties.noteIndex; - last_ref[item[1].id] = onecitation.properties.noteIndex; + if ("undefined" === typeof first_ref[myid]) { + first_ref[myid] = onecitation.properties.noteIndex; + last_ref[myid] = onecitation.properties.noteIndex; item[1].position = CSL.POSITION_FIRST; } else { var ibidme = false; var suprame = false; + if (j > 0) { + var oldlastid = citations[j - 1].sortedItems.slice(-1)[0][1].id; + if (citations[j - 1].sortedItems[0].slice(-1)[0].legislation_id) { + oldlastid = citations[j - 1].sortedItems[0].slice(-1)[0].legislation_id; + } + } if (j > 0 && parseInt(k, 10) === 0 && citations[j - 1].properties.noteIndex !== citations[j].properties.noteIndex) { var items = citations[(j - 1)].sortedItems; var useme = false; - if ((citations[j - 1].sortedItems[0][1].id == item[1].id && citations[j - 1].properties.noteIndex >= (citations[j].properties.noteIndex - 1)) || citations[j - 1].sortedItems[0][1].id == this.registry.registry[item[1].id].parallel) { + var oldid = citations[j - 1].sortedItems[0][0].id; + if (citations[j - 1].sortedItems[0][0].legislation_id) { + oldid = citations[j - 1].sortedItems[0][0].legislation_id; + } + if ((oldid == myid && citations[j - 1].properties.noteIndex >= (citations[j].properties.noteIndex - 1)) || citations[j - 1].sortedItems[0][1].id == this.registry.registry[item[1].id].parallel) { if (citationsInNote[citations[j - 1].properties.noteIndex] == 1 || citations[j - 1].properties.noteIndex == 0) { useme = true; } @@ -3552,41 +3593,55 @@ CSL.Engine.prototype.processCitationCluster = function (citation, citationsPre, } else { suprame = true; } - } else if (k > 0 && onecitation.sortedItems[k - 1][1].id == item[1].id) { + } else if (k > 0 && incitationid == myid) { ibidme = true; } else if (k == 0 && citations[j - 1].properties.noteIndex == citations[j].properties.noteIndex && citations[j - 1].sortedItems.length - && citations[j - 1].sortedItems.slice(-1)[0][1].id == item[1].id) { + && oldlastid == myid) { ibidme = true; } else { suprame = true; } var prev, prev_locator, prev_label, curr_locator, curr_label; if (ibidme) { + var myprev_locator; + var myprev_label; if (k > 0) { - prev = onecitation.sortedItems[(k - 1)][1]; + if (onecitation.sortedItems[(k - 1)][0].legislation_id) { + myprev_locator = onecitation.sortedItems[(k - 1)][0].section; + myprev_label = ""; + } else { + myprev_locator = onecitation.sortedItems[(k - 1)][1].locator; + myprev_label = onecitation.sortedItems[(k - 1)][1].label; + } } else { - prev = citations[(j - 1)].sortedItems[0][1]; + if (citations[(j - 1)].sortedItems[0][0].legislation_id) { + myprev_locator = citations[(j - 1)].sortedItems[0][0].section; + myprev_label = ""; + } else { + myprev_locator = citations[(j - 1)].sortedItems[0][1].locator; + myprev_label = citations[(j - 1)].sortedItems[0][1].label; + } } - if (prev.locator) { - if (prev.label) { - prev_label = prev.label; + if (myprev_locator) { + if (myprev_label) { + prev_label = myprev_label; } else { prev_label = ""; } - prev_locator = "" + prev.locator + prev_label; + prev_locator = "" + myprev_locator + prev_label; } else { - prev_locator = prev.locator; + prev_locator = myprev_locator; } - if (item[1].locator) { - if (item[1].label) { - curr_label = item[1].label; + if (mylocator) { + if (mylabel) { + curr_label = mylabel; } else { curr_label = ""; } - curr_locator = "" + item[1].locator + curr_label; + curr_locator = "" + mylocator + curr_label; } else { - curr_locator = item[1].locator; + curr_locator = mylocator; } } if (ibidme && prev_locator && !curr_locator) { @@ -3609,18 +3664,18 @@ CSL.Engine.prototype.processCitationCluster = function (citation, citationsPre, } if (suprame) { item[1].position = CSL.POSITION_SUBSEQUENT; - if (first_ref[item[1].id] != onecitation.properties.noteIndex) { - item[1]["first-reference-note-number"] = first_ref[item[1].id]; + if (first_ref[myid] != onecitation.properties.noteIndex) { + item[1]["first-reference-note-number"] = first_ref[myid]; } } } if (onecitation.properties.noteIndex) { - var note_distance = parseInt(onecitation.properties.noteIndex, 10) - parseInt(last_ref[item[1].id], 10); + var note_distance = parseInt(onecitation.properties.noteIndex, 10) - parseInt(last_ref[myid], 10); if (item[1].position !== CSL.POSITION_FIRST && note_distance <= this.citation.opt["near-note-distance"]) { item[1]["near-note"] = true; } - last_ref[item[1].id] = onecitation.properties.noteIndex; + last_ref[myid] = onecitation.properties.noteIndex; } if (onecitation.citationID != citation.citationID) { for (n = 0, nlen = CSL.POSITION_TEST_VARS.length; n < nlen; n += 1) { From c9354535da1a4117a7413e441caf5149c644f46b Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Mon, 2 Apr 2012 17:57:13 -0400 Subject: [PATCH 27/29] Allow use of relative paths for file import in non-RDF translators --- .../zotero/xpcom/translation/translate.js | 14 ++++++++++++-- .../zotero/xpcom/translation/translate_item.js | 17 +++++++++++++++-- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js index 4616fef38..2e6a03ba6 100644 --- a/chrome/content/zotero/xpcom/translation/translate.js +++ b/chrome/content/zotero/xpcom/translation/translate.js @@ -1450,7 +1450,7 @@ Zotero.Translate.Web.prototype._getParameters = function() { return [this.docume Zotero.Translate.Web.prototype._prepareTranslation = function() { this._itemSaver = new Zotero.Translate.ItemSaver(this._libraryID, Zotero.Translate.ItemSaver[(this._saveAttachments ? "ATTACHMENT_MODE_DOWNLOAD" : "ATTACHMENT_MODE_IGNORE")], 1, - this.document, this._cookieSandbox); + this.document, this._cookieSandbox, this.location); this.newItems = []; } @@ -1672,8 +1672,18 @@ Zotero.Translate.Import.prototype._loadTranslatorPrepareIO = function(translator */ Zotero.Translate.Import.prototype._prepareTranslation = function() { this._progress = undefined; + + var baseURI = null; + if(this.location) { + try { + baseURI = Components.classes["@mozilla.org/network/io-service;1"]. + getService(Components.interfaces.nsIIOService).newFileURI(this.location); + } catch(e) {} + } + this._itemSaver = new Zotero.Translate.ItemSaver(this._libraryID, - Zotero.Translate.ItemSaver[(this._saveAttachments ? "ATTACHMENT_MODE_FILE" : "ATTACHMENT_MODE_IGNORE")]); + Zotero.Translate.ItemSaver[(this._saveAttachments ? "ATTACHMENT_MODE_FILE" : "ATTACHMENT_MODE_IGNORE")], + undefined, undefined, undefined, baseURI); this.newItems = []; this.newCollections = []; } diff --git a/chrome/content/zotero/xpcom/translation/translate_item.js b/chrome/content/zotero/xpcom/translation/translate_item.js index 842018900..69617bb13 100644 --- a/chrome/content/zotero/xpcom/translation/translate_item.js +++ b/chrome/content/zotero/xpcom/translation/translate_item.js @@ -24,7 +24,7 @@ */ Zotero.Translate.ItemSaver = function(libraryID, attachmentMode, forceTagType, document, - cookieSandbox) { + cookieSandbox, baseURI) { // initialize constants this.newItems = []; this.newCollections = []; @@ -66,7 +66,20 @@ Zotero.Translate.ItemSaver = function(libraryID, attachmentMode, forceTagType, d // force tag types if requested this._forceTagType = forceTagType; + // to set cookies on downloaded files this._cookieSandbox = cookieSandbox; + + // the URI to which other URIs are assumed to be relative + if(typeof baseURI === "object" && baseURI instanceof Components.interfaces.nsIURI) { + this._baseURI = baseURI; + } else { + // try to convert to a URI + this._baseURI = null; + try { + this._baseURI = Components.classes["@mozilla.org/network/io-service;1"]. + getService(Components.interfaces.nsIIOService).newURI(baseURI, null, null); + } catch(e) {}; + } }; Zotero.Translate.ItemSaver.ATTACHMENT_MODE_IGNORE = 0; @@ -231,7 +244,7 @@ Zotero.Translate.ItemSaver.prototype = { var IOService = Components.classes["@mozilla.org/network/io-service;1"]. getService(Components.interfaces.nsIIOService); try { - var uri = IOService.newURI(attachment.path, "", null); + var uri = IOService.newURI(attachment.path, "", this._baseURI); } catch (e) { var msg = "Error parsing attachment path: " + attachment.path; From 867760e0be1f00b53296ca1b129e02d6894fb0f2 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Mon, 2 Apr 2012 18:09:10 -0400 Subject: [PATCH 28/29] pushEventQueue removed in Fx 14 (https://bugzilla.mozilla.org/show_bug.cgi?id=719154) --- chrome/content/zotero/fileInterface.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/fileInterface.js b/chrome/content/zotero/fileInterface.js index 9fb8b4d2e..d74c8af86 100644 --- a/chrome/content/zotero/fileInterface.js +++ b/chrome/content/zotero/fileInterface.js @@ -626,7 +626,12 @@ var Zotero_File_Interface = new function() { if(window.zoteroLastRepaint && (now - window.zoteroLastRepaint) < 100) return // Start a nested event queue - Zotero.mainThread.pushEventQueue(null); + // TODO Remove when Fx > 14 + var eventQueuePushed = "pushEventQueue" in Zotero.mainThread; + if(eventQueuePushed) { + Zotero.mainThread.pushEventQueue(null); + } + try { // Add the redraw event onto event queue window.QueryInterface(Components.interfaces.nsIInterfaceRequestor) @@ -637,7 +642,7 @@ var Zotero_File_Interface = new function() { Zotero.mainThread.processNextEvent(false); } finally { // Close nested event queue - Zotero.mainThread.popEventQueue(); + if(eventQueuePushed) Zotero.mainThread.popEventQueue(); } window.zoteroLastRepaint = now; From 8f0296baf349107faf5a49230d363eee07544ad5 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Mon, 2 Apr 2012 18:54:58 -0400 Subject: [PATCH 29/29] Fix newlines in preferences file --- defaults/preferences/zotero.js | 334 ++++++++++++++++----------------- 1 file changed, 167 insertions(+), 167 deletions(-) diff --git a/defaults/preferences/zotero.js b/defaults/preferences/zotero.js index 58863f19e..0a1db94b3 100644 --- a/defaults/preferences/zotero.js +++ b/defaults/preferences/zotero.js @@ -1,167 +1,167 @@ -// These are DEFAULT prefs for the install. -// -// Add new user-adjustable hidden preferences to -// http://www.zotero.org/documentation/hidden_prefs - -pref("extensions.zotero.firstRun2", true); -pref("extensions.zotero@chnm.gmu.edu.description", "chrome://zotero/locale/zotero.properties"); - -pref("extensions.zotero.useDataDir", false); -pref("extensions.zotero.dataDir", ''); -pref("extensions.zotero.lastDataDir", ''); -pref("extensions.zotero.debug.log",false); -pref("extensions.zotero.debug.stackTrace", false); -pref("extensions.zotero.debug.store",false); -pref("extensions.zotero.debug.store.limit",500000); -pref("extensions.zotero.debug.store.submitSize",10000000); -pref("extensions.zotero.debug.store.submitLineLength",10000); -pref("extensions.zotero.debug.level",5); -pref("extensions.zotero.debug.time", false); -pref("extensions.zotero.automaticScraperUpdates",true); -pref("extensions.zotero.zoteroDotOrgVersionHeader", true); -pref("extensions.zotero.cacheTranslatorData",true); -pref("extensions.zotero.showIn", 1); -pref("extensions.zotero.statusBarIcon", 2); -pref("extensions.zotero.browserContentContextMenu", true); -pref("extensions.zotero.openURL.resolver","http://worldcatlibraries.org/registry/gateway"); -pref("extensions.zotero.openURL.version","1.0"); -pref("extensions.zotero.parseEndNoteMIMETypes",true); -pref("extensions.zotero.automaticSnapshots",true); -pref("extensions.zotero.downloadAssociatedFiles",true); -pref("extensions.zotero.reportTranslationFailure",true); -pref("extensions.zotero.automaticTags",true); -pref("extensions.zotero.fontSize", "1.0"); -pref("extensions.zotero.recursiveCollections", false); -pref("extensions.zotero.attachmentRenameFormatString", '{%c - }{%y - }{%t{50}}'); -pref("extensions.zotero.capitalizeTitles", false); -pref("extensions.zotero.launchNonNativeFiles", false); -pref("extensions.zotero.sortNotesChronologically", false); -pref("extensions.zotero.sortAttachmentsChronologically", false); -pref("extensions.zotero.showTrashWhenEmpty", true); -pref("extensions.zotero.trashAutoEmptyDays", 30); -pref("extensions.zotero.viewOnDoubleClick", true); - -pref("extensions.zotero.groups.copyChildLinks", true); -pref("extensions.zotero.groups.copyChildFileAttachments", true); -pref("extensions.zotero.groups.copyChildNotes", true); - -pref("extensions.zotero.backup.numBackups", 2); -pref("extensions.zotero.backup.interval", 1440); - -pref("extensions.zotero.lastCreatorFieldMode",0); -pref("extensions.zotero.lastAbstractExpand",0); -pref("extensions.zotero.lastRenameAssociatedFile", false); -pref("extensions.zotero.lastViewedFolder", 'L'); -pref("extensions.zotero.lastLongTagMode", 0); -pref("extensions.zotero.lastLongTagDelimiter", ";"); - -//Tag Cloud -pref("extensions.zotero.tagCloud", false); - -// Keyboard shortcuts -pref("extensions.zotero.keys.overrideGlobal", false); -pref("extensions.zotero.keys.openZotero", 'Z'); -pref("extensions.zotero.keys.toggleFullscreen", 'F'); -pref("extensions.zotero.keys.library", 'L'); -pref("extensions.zotero.keys.quicksearch", 'K'); -pref("extensions.zotero.keys.newItem", 'N'); -pref("extensions.zotero.keys.newNote", 'O'); -pref("extensions.zotero.keys.toggleTagSelector", 'T'); -pref("extensions.zotero.keys.copySelectedItemCitationsToClipboard", 'A'); -pref("extensions.zotero.keys.copySelectedItemsToClipboard", 'C'); -pref("extensions.zotero.keys.importFromClipboard", 'V'); - -// Fulltext indexing -pref("extensions.zotero.fulltext.textMaxLength", 500000); -pref("extensions.zotero.fulltext.pdfMaxPages", 100); -pref("extensions.zotero.search.useLeftBound", true); - -// Notes -pref("extensions.zotero.note.fontFamily", "Lucida Grande, Tahoma, Verdana, Helvetica, sans-serif"); -pref("extensions.zotero.note.fontSize", "11"); -pref("extensions.zotero.note.css", ""); - -// Reports -pref("extensions.zotero.report.includeAllChildItems", true); -pref("extensions.zotero.report.combineChildItems", true); - -// Export and citation settings -pref("extensions.zotero.export.lastTranslator", '14763d24-8ba0-45df-8f52-b8d1108e7ac9'); -pref("extensions.zotero.export.translatorSettings", 'true,false'); -pref("extensions.zotero.export.lastStyle", 'http://www.zotero.org/styles/chicago-note-bibliography'); -pref("extensions.zotero.export.bibliographySettings", 'save-as-rtf'); -pref("extensions.zotero.export.bibliographyLocale", ''); -pref("extensions.zotero.export.citePaperJournalArticleURL", false); -pref("extensions.zotero.export.displayCharsetOption", false); -pref("extensions.zotero.import.charset", "auto"); -pref("extensions.zotero.rtfScan.lastInputFile", ""); -pref("extensions.zotero.rtfScan.lastOutputFile", ""); - -pref("extensions.zotero.export.quickCopy.setting", 'bibliography=http://www.zotero.org/styles/chicago-note-bibliography'); -pref("extensions.zotero.export.quickCopy.dragLimit", 50); -pref("extensions.zotero.export.quickCopy.quoteBlockquotes.plainText", true); -pref("extensions.zotero.export.quickCopy.quoteBlockquotes.richText", true); -pref("extensions.zotero.export.quickCopy.compatibility.indentBlockquotes", true); -pref("extensions.zotero.export.quickCopy.compatibility.word", false); - -// Integration settings -pref("extensions.zotero.integration.port", 50001); -pref("extensions.zotero.integration.autoRegenerate", -1); // -1 = ask; 0 = no; 1 = yes -pref("extensions.zotero.integration.useClassicAddCitationDialog", false); -pref("extensions.zotero.integration.keepAddCitationDialogRaised", false); - -// Connector settings -pref("extensions.zotero.httpServer.enabled", false); // TODO enabled for testing only -pref("extensions.zotero.httpServer.port", 23119); // ascii "ZO" - -// Zeroconf -pref("extensions.zotero.zeroconf.server.enabled", false); - -// Zotero Commons -pref("extensions.zotero.commons.enabled", false); -pref("extensions.zotero.commons.accessKey", ''); -pref("extensions.zotero.commons.secretKey", ''); - -// Annotation settings -pref("extensions.zotero.annotations.warnOnClose", true); - -// Sync -pref("extensions.zotero.sync.autoSync", true); -pref("extensions.zotero.sync.server.username", ''); -pref("extensions.zotero.sync.server.compressData", true); -pref("extensions.zotero.sync.storage.enabled", true); -pref("extensions.zotero.sync.storage.protocol", "zotero"); -pref("extensions.zotero.sync.storage.verified", false); -pref("extensions.zotero.sync.storage.scheme", 'https'); -pref("extensions.zotero.sync.storage.url", ''); -pref("extensions.zotero.sync.storage.username", ''); -pref("extensions.zotero.sync.storage.maxDownloads", 4); -pref("extensions.zotero.sync.storage.maxUploads", 4); -pref("extensions.zotero.sync.storage.deleteDelayDays", 30); -pref("extensions.zotero.sync.storage.groups.enabled", true); - -// Proxy -pref("extensions.zotero.proxies.autoRecognize", true); -pref("extensions.zotero.proxies.transparent", true); -pref("extensions.zotero.proxies.disableByDomain", false); -pref("extensions.zotero.proxies.disableByDomainString", ".edu"); - -// Data layer purging -pref("extensions.zotero.purge.creators", false); -pref("extensions.zotero.purge.fulltext", false); -pref("extensions.zotero.purge.items", false); -pref("extensions.zotero.purge.tags", false); - -// Zotero pane persistent data -pref("extensions.zotero.pane.persist", ''); - -// Domains allowed to import, separated by a semicolon -pref("extensions.zotero.ingester.allowedSites", ""); - -// Connector -pref("extensions.zotero.connector.repo.lastCheck.localTime", 0); -pref("extensions.zotero.connector.repo.lastCheck.repoTime", 0); - -// File/URL opening executable if launch() fails -pref("extensions.zotero.fallbackLauncher.unix", "/usr/bin/xdg-open"); -pref("extensions.zotero.fallbackLauncher.windows", ""); \ No newline at end of file +// These are DEFAULT prefs for the install. +// +// Add new user-adjustable hidden preferences to +// http://www.zotero.org/documentation/hidden_prefs + +pref("extensions.zotero.firstRun2", true); +pref("extensions.zotero@chnm.gmu.edu.description", "chrome://zotero/locale/zotero.properties"); + +pref("extensions.zotero.useDataDir", false); +pref("extensions.zotero.dataDir", ''); +pref("extensions.zotero.lastDataDir", ''); +pref("extensions.zotero.debug.log",false); +pref("extensions.zotero.debug.stackTrace", false); +pref("extensions.zotero.debug.store",false); +pref("extensions.zotero.debug.store.limit",500000); +pref("extensions.zotero.debug.store.submitSize",10000000); +pref("extensions.zotero.debug.store.submitLineLength",10000); +pref("extensions.zotero.debug.level",5); +pref("extensions.zotero.debug.time", false); +pref("extensions.zotero.automaticScraperUpdates",true); +pref("extensions.zotero.zoteroDotOrgVersionHeader", true); +pref("extensions.zotero.cacheTranslatorData",true); +pref("extensions.zotero.showIn", 1); +pref("extensions.zotero.statusBarIcon", 2); +pref("extensions.zotero.browserContentContextMenu", true); +pref("extensions.zotero.openURL.resolver","http://worldcatlibraries.org/registry/gateway"); +pref("extensions.zotero.openURL.version","1.0"); +pref("extensions.zotero.parseEndNoteMIMETypes",true); +pref("extensions.zotero.automaticSnapshots",true); +pref("extensions.zotero.downloadAssociatedFiles",true); +pref("extensions.zotero.reportTranslationFailure",true); +pref("extensions.zotero.automaticTags",true); +pref("extensions.zotero.fontSize", "1.0"); +pref("extensions.zotero.recursiveCollections", false); +pref("extensions.zotero.attachmentRenameFormatString", '{%c - }{%y - }{%t{50}}'); +pref("extensions.zotero.capitalizeTitles", false); +pref("extensions.zotero.launchNonNativeFiles", false); +pref("extensions.zotero.sortNotesChronologically", false); +pref("extensions.zotero.sortAttachmentsChronologically", false); +pref("extensions.zotero.showTrashWhenEmpty", true); +pref("extensions.zotero.trashAutoEmptyDays", 30); +pref("extensions.zotero.viewOnDoubleClick", true); + +pref("extensions.zotero.groups.copyChildLinks", true); +pref("extensions.zotero.groups.copyChildFileAttachments", true); +pref("extensions.zotero.groups.copyChildNotes", true); + +pref("extensions.zotero.backup.numBackups", 2); +pref("extensions.zotero.backup.interval", 1440); + +pref("extensions.zotero.lastCreatorFieldMode",0); +pref("extensions.zotero.lastAbstractExpand",0); +pref("extensions.zotero.lastRenameAssociatedFile", false); +pref("extensions.zotero.lastViewedFolder", 'L'); +pref("extensions.zotero.lastLongTagMode", 0); +pref("extensions.zotero.lastLongTagDelimiter", ";"); + +//Tag Cloud +pref("extensions.zotero.tagCloud", false); + +// Keyboard shortcuts +pref("extensions.zotero.keys.overrideGlobal", false); +pref("extensions.zotero.keys.openZotero", 'Z'); +pref("extensions.zotero.keys.toggleFullscreen", 'F'); +pref("extensions.zotero.keys.library", 'L'); +pref("extensions.zotero.keys.quicksearch", 'K'); +pref("extensions.zotero.keys.newItem", 'N'); +pref("extensions.zotero.keys.newNote", 'O'); +pref("extensions.zotero.keys.toggleTagSelector", 'T'); +pref("extensions.zotero.keys.copySelectedItemCitationsToClipboard", 'A'); +pref("extensions.zotero.keys.copySelectedItemsToClipboard", 'C'); +pref("extensions.zotero.keys.importFromClipboard", 'V'); + +// Fulltext indexing +pref("extensions.zotero.fulltext.textMaxLength", 500000); +pref("extensions.zotero.fulltext.pdfMaxPages", 100); +pref("extensions.zotero.search.useLeftBound", true); + +// Notes +pref("extensions.zotero.note.fontFamily", "Lucida Grande, Tahoma, Verdana, Helvetica, sans-serif"); +pref("extensions.zotero.note.fontSize", "11"); +pref("extensions.zotero.note.css", ""); + +// Reports +pref("extensions.zotero.report.includeAllChildItems", true); +pref("extensions.zotero.report.combineChildItems", true); + +// Export and citation settings +pref("extensions.zotero.export.lastTranslator", '14763d24-8ba0-45df-8f52-b8d1108e7ac9'); +pref("extensions.zotero.export.translatorSettings", 'true,false'); +pref("extensions.zotero.export.lastStyle", 'http://www.zotero.org/styles/chicago-note-bibliography'); +pref("extensions.zotero.export.bibliographySettings", 'save-as-rtf'); +pref("extensions.zotero.export.bibliographyLocale", ''); +pref("extensions.zotero.export.citePaperJournalArticleURL", false); +pref("extensions.zotero.export.displayCharsetOption", false); +pref("extensions.zotero.import.charset", "auto"); +pref("extensions.zotero.rtfScan.lastInputFile", ""); +pref("extensions.zotero.rtfScan.lastOutputFile", ""); + +pref("extensions.zotero.export.quickCopy.setting", 'bibliography=http://www.zotero.org/styles/chicago-note-bibliography'); +pref("extensions.zotero.export.quickCopy.dragLimit", 50); +pref("extensions.zotero.export.quickCopy.quoteBlockquotes.plainText", true); +pref("extensions.zotero.export.quickCopy.quoteBlockquotes.richText", true); +pref("extensions.zotero.export.quickCopy.compatibility.indentBlockquotes", true); +pref("extensions.zotero.export.quickCopy.compatibility.word", false); + +// Integration settings +pref("extensions.zotero.integration.port", 50001); +pref("extensions.zotero.integration.autoRegenerate", -1); // -1 = ask; 0 = no; 1 = yes +pref("extensions.zotero.integration.useClassicAddCitationDialog", false); +pref("extensions.zotero.integration.keepAddCitationDialogRaised", false); + +// Connector settings +pref("extensions.zotero.httpServer.enabled", false); // TODO enabled for testing only +pref("extensions.zotero.httpServer.port", 23119); // ascii "ZO" + +// Zeroconf +pref("extensions.zotero.zeroconf.server.enabled", false); + +// Zotero Commons +pref("extensions.zotero.commons.enabled", false); +pref("extensions.zotero.commons.accessKey", ''); +pref("extensions.zotero.commons.secretKey", ''); + +// Annotation settings +pref("extensions.zotero.annotations.warnOnClose", true); + +// Sync +pref("extensions.zotero.sync.autoSync", true); +pref("extensions.zotero.sync.server.username", ''); +pref("extensions.zotero.sync.server.compressData", true); +pref("extensions.zotero.sync.storage.enabled", true); +pref("extensions.zotero.sync.storage.protocol", "zotero"); +pref("extensions.zotero.sync.storage.verified", false); +pref("extensions.zotero.sync.storage.scheme", 'https'); +pref("extensions.zotero.sync.storage.url", ''); +pref("extensions.zotero.sync.storage.username", ''); +pref("extensions.zotero.sync.storage.maxDownloads", 4); +pref("extensions.zotero.sync.storage.maxUploads", 4); +pref("extensions.zotero.sync.storage.deleteDelayDays", 30); +pref("extensions.zotero.sync.storage.groups.enabled", true); + +// Proxy +pref("extensions.zotero.proxies.autoRecognize", true); +pref("extensions.zotero.proxies.transparent", true); +pref("extensions.zotero.proxies.disableByDomain", false); +pref("extensions.zotero.proxies.disableByDomainString", ".edu"); + +// Data layer purging +pref("extensions.zotero.purge.creators", false); +pref("extensions.zotero.purge.fulltext", false); +pref("extensions.zotero.purge.items", false); +pref("extensions.zotero.purge.tags", false); + +// Zotero pane persistent data +pref("extensions.zotero.pane.persist", ''); + +// Domains allowed to import, separated by a semicolon +pref("extensions.zotero.ingester.allowedSites", ""); + +// Connector +pref("extensions.zotero.connector.repo.lastCheck.localTime", 0); +pref("extensions.zotero.connector.repo.lastCheck.repoTime", 0); + +// File/URL opening executable if launch() fails +pref("extensions.zotero.fallbackLauncher.unix", "/usr/bin/xdg-open"); +pref("extensions.zotero.fallbackLauncher.windows", "");