diff --git a/chrome/content/zotero/bindings/tagselector.xml b/chrome/content/zotero/bindings/tagselector.xml index c03a3f797..956a16321 100644 --- a/chrome/content/zotero/bindings/tagselector.xml +++ b/chrome/content/zotero/bindings/tagselector.xml @@ -644,7 +644,7 @@ if (result && newName.value) { // Add other ids with same tag - var ids = Zotero.Tags.getIDs(oldName); + var ids = Zotero.Tags.getIDs(oldName, this.libraryID); for (var i=0; i lBound && lineLengths[i] < uBound) { + if(cleanedLineLengths[i] > lBound && cleanedLineLengths[i] < uBound) { // Strip quotation marks so they don't mess up search query quoting - var line = lines[i].replace('"', ''); + var line = cleanedLines[i].replace('"', ''); this._goodLines.push(line); } } diff --git a/chrome/content/zotero/xpcom/citeproc.js b/chrome/content/zotero/xpcom/citeproc.js index 7f90adae4..f11fdf2fa 100644 --- a/chrome/content/zotero/xpcom/citeproc.js +++ b/chrome/content/zotero/xpcom/citeproc.js @@ -57,6 +57,7 @@ if (!Array.indexOf) { }; } var CSL = { + PROCESSOR_VERSION: "1.0.342", STATUTE_SUBDIV_GROUPED_REGEX: /((?:^| )(?:art|ch|Ch|subch|p|pp|para|subpara|pt|r|sec|subsec|Sec|sch|tit)\.)/g, STATUTE_SUBDIV_PLAIN_REGEX: /(?:(?:^| )(?:art|ch|Ch|subch|p|pp|para|subpara|pt|r|sec|subsec|Sec|sch|tit)\.)/, STATUTE_SUBDIV_STRINGS: { @@ -2204,7 +2205,7 @@ CSL.DateParser = function () { }; CSL.Engine = function (sys, style, lang, forceLang) { var attrs, langspec, localexml, locale; - this.processor_version = "1.0.339"; + this.processor_version = CSL.PROCESSOR_VERSION; this.csl_version = "1.0"; this.sys = sys; this.sys.xml = new CSL.System.Xml.Parsing(); @@ -8113,6 +8114,10 @@ CSL.Node.text = { if (!this.decorations.length || this.decorations[0][0] !== "@" + this.variables[0]) { this.decorations = [["@" + this.variables[0], "true"]].concat(this.decorations); } + } else { + if (this.decorations.length && this.decorations[0][0] === "@" + this.variables[0]) { + this.decorations = this.decorations.slice(1); + } } state.output.append(value, this, false, false, true); } @@ -9362,7 +9367,7 @@ CSL.Transform = function (state) { } return function (state, Item, item, usedOrig) { var primary, secondary, tertiary, primary_tok, group_tok, key; - if (!variables[0]) { + if (!variables[0] || (!Item[variables[0]] && !Item[alternative_varname])) { return null; } var slot = {primary:false, secondary:false, tertiary:false}; @@ -11404,19 +11409,17 @@ CSL.Output.Formatters.sentence = function (state, string) { return CSL.Output.Formatters.undoppelString(str); }; CSL.Output.Formatters["capitalize-all"] = function (state, string) { - var str, strings, len, pos; - str = CSL.Output.Formatters.doppelString(string, CSL.TAG_ESCAPE); - strings = str.string.split(" "); - len = strings.length; - for (pos = 0; pos < len; pos += 1) { - if (strings[pos].length > 1) { + var str = CSL.Output.Formatters.doppelString(string, CSL.TAG_ESCAPE); + var strings = str.string.split(" "); + for (var i = 0, ilen = strings.length; i < ilen; i += 1) { + if (strings[i].length > 1) { if (state.opt.development_extensions.allow_force_lowercase) { - strings[pos] = strings[pos].slice(0, 1).toUpperCase() + strings[pos].substr(1).toLowerCase(); + strings[i] = strings[i].slice(0, 1).toUpperCase() + strings[i].substr(1).toLowerCase(); } else { - strings[pos] = strings[pos].slice(0, 1).toUpperCase() + strings[pos].substr(1); + strings[i] = strings[i].slice(0, 1).toUpperCase() + strings[i].substr(1); } - } else if (strings[pos].length === 1) { - strings[pos] = strings[pos].toUpperCase(); + } else if (strings[i].length === 1) { + strings[i] = strings[i].toUpperCase(); } } str.string = strings.join(" "); @@ -11964,18 +11967,11 @@ CSL.Registry.prototype.renumber = function () { for (pos = 0; pos < len; pos += 1) { item = this.reflist[pos]; item.seq = (pos + 1); - var hasTaints = false; - for (var key in this.state.tmp.taintedItemIDs) { - hasTaints = true; - break; + if (this.state.opt.update_mode === CSL.NUMERIC && item.seq != this.oldseq[item.id]) { + this.state.tmp.taintedItemIDs[item.id] = true; } - if (hasTaints && item.seq != this.oldseq[item.id]) { - if (this.state.opt.update_mode === CSL.NUMERIC) { - this.state.tmp.taintedItemIDs[item.id] = true; - } - if (this.state.opt.bib_mode === CSL.NUMERIC) { - this.return_data.bibchange = true; - } + if (this.state.opt.bib_mode === CSL.NUMERIC && item.seq != this.oldseq[item.id]) { + this.return_data.bibchange = true; } } if (this.state.opt.citation_number_sort_direction === CSL.DESCENDING diff --git a/chrome/content/zotero/xpcom/integration.js b/chrome/content/zotero/xpcom/integration.js index e7d384e20..0fbd0fbae 100644 --- a/chrome/content/zotero/xpcom/integration.js +++ b/chrome/content/zotero/xpcom/integration.js @@ -2655,6 +2655,7 @@ Zotero.Integration.Session.prototype.updateCitations = function(callback) { index = parseInt(index); var citation = this.citationsByIndex[index]; + if(!citation) continue; if(citation.properties.delete) { deleteCitations[index] = true; continue; diff --git a/chrome/content/zotero/xpcom/rdf/serialize.js b/chrome/content/zotero/xpcom/rdf/serialize.js index 3e28a6d3f..aa053ed1e 100644 --- a/chrome/content/zotero/xpcom/rdf/serialize.js +++ b/chrome/content/zotero/xpcom/rdf/serialize.js @@ -758,7 +758,7 @@ $rdf.Serializer = function () { var attrs = ''; if(subject.termType == 'bnode') { - if(sz.incoming[subject].length != 1) { // not an anonymous bnode + if(!sz.incoming[subject] || sz.incoming[subject].length != 1) { // not an anonymous bnode attrs = ' rdf:nodeID="' + subject.toNT().slice(2) + '"'; } } else { diff --git a/chrome/content/zotero/xpcom/utilities.js b/chrome/content/zotero/xpcom/utilities.js index 4b8b9549f..0fee1d80d 100644 --- a/chrome/content/zotero/xpcom/utilities.js +++ b/chrome/content/zotero/xpcom/utilities.js @@ -1399,7 +1399,7 @@ Zotero.Utilities = { var isZoteroItem = item instanceof Zotero.Item, zoteroType; for(var type in CSL_TYPE_MAPPINGS) { - if(CSL_TYPE_MAPPINGS[zoteroType] == item.type) { + if(CSL_TYPE_MAPPINGS[type] == cslItem.type) { zoteroType = type; break; } @@ -1484,11 +1484,37 @@ Zotero.Utilities = { if(Zotero.ItemFields.isValidForType(fieldID, itemTypeID)) { var date = ""; if(cslDate.literal) { - date = cslDate.literal; - } else if(cslDate.year) { - if(cslDate.month) cslDate.month--; - date = Zotero.Date.formatDate(cslDate); - if(cslDate.season) date = cslDate.season+date; + if(variable === "accessed") { + date = strToISO(cslDate.literal); + } else { + date = cslDate.literal; + } + } else { + var newDate = Zotero.Utilities.deepCopy(cslDate);; + if(cslDate.dateParts && typeof cslDate.dateParts == "object") { + if(cslDate.dateParts[0]) newDate.year = cslDate.dateParts[0]; + if(cslDate.dateParts[1]) newDate.month = cslDate.dateParts[1]; + if(cslDate.dateParts[2]) newDate.day = cslDate.dateParts[2]; + } + + if(newDate.year) { + if(variable === "accessed") { + // Need to convert to SQL + var date = Zotero.Utilities.lpad(newDate.year, "0", 4); + if(newDate.month) { + date += "-"+Zotero.Utilities.lpad(newDate.month+1, "0", 2); + if(newDate.day) { + date += "-"+Zotero.Utilities.lpad(newDate.day, "0", 2); + } + } + } else { + if(newDate.month) newDate.month--; + date = Zotero.Date.formatDate(newDate); + if(newDate.season) { + date = newDate.season+" "+date; + } + } + } } if(isZoteroItem) {