diff --git a/chrome/content/zotero/xpcom/citeproc.js b/chrome/content/zotero/xpcom/citeproc.js index c44a87f38..79bd20143 100644 --- a/chrome/content/zotero/xpcom/citeproc.js +++ b/chrome/content/zotero/xpcom/citeproc.js @@ -1515,7 +1515,7 @@ CSL.dateParser = function (txt) { }; CSL.Engine = function (sys, style, lang, xmlmode) { var attrs, langspec, localexml, locale; - this.processor_version = "1.0.59"; + this.processor_version = "1.0.61"; this.csl_version = "1.0"; this.sys = sys; this.sys.xml = new CSL.System.Xml.Parsing(); @@ -1527,6 +1527,9 @@ CSL.Engine = function (sys, style, lang, xmlmode) { this.setAbbreviations = function (nick) { this.transform.setAbbreviations(nick); }; + this.setParseNames = function (val) { + this.opt['parse-names'] = val; + }; this.opt = new CSL.Engine.Opt(); this.tmp = new CSL.Engine.Tmp(); this.build = new CSL.Engine.Build(); @@ -1993,6 +1996,7 @@ CSL.Engine.Opt = function () { this["et-al-subsequent-min"] = false; this["et-al-subsequent-use-first"] = false; this["demote-non-dropping-particle"] = "display-and-sort"; + this["parse-names"] = true; this.citation_number_slug = false; }; CSL.Engine.Tmp = function () { @@ -4143,7 +4147,7 @@ CSL.Node.names = { llen = nameset.names.length; for (ppos = 0; ppos < llen; ppos += 1) { name = nameset.names[ppos]; - if (name["parse-names"]) { + if (name["parse-names"] || state.opt["parse-names"]) { state.parseName(name); } if (name.family && name.family.length && name.family.slice(0, 1) === '"' && name.family.slice(-1)) { @@ -6442,14 +6446,14 @@ CSL.Util.Names.initNameSlices = function (state) { }; CSL.Engine.prototype.parseName = function (name) { var m, idx; - if (! name["non-dropping-particle"]) { + if (! name["non-dropping-particle"] && name.family) { m = name.family.match(/^([ a-z]+\s+)/); if (m) { name.family = name.family.slice(m[1].length); name["non-dropping-particle"] = m[1].replace(/\s+$/, ""); } } - if (! name.suffix) { + if (!name.suffix && name.given) { m = name.given.match(/(\s*,!*\s*)/); if (m) { idx = name.given.indexOf(m[1]); @@ -6460,7 +6464,7 @@ CSL.Engine.prototype.parseName = function (name) { name.given = name.given.slice(0, idx); } } - if (! name["dropping-particle"]) { + if (! name["dropping-particle"] && name.given) { m = name.given.match(/^(\s+[ a-z]*[a-z])$/); if (m) { name.given = name.given.slice(0, m[1].length * -1); @@ -7818,6 +7822,9 @@ CSL.Registry.NameReg = function (state) { }; evalname = function (item_id, nameobj, namenum, request_base, form, initials) { var pos, len, items, param; + if ((!form || 'long' == form) && 'string' !== typeof initials) { + return 2; + } set_keys(this.state, item_id, nameobj); if ("undefined" === typeof this.namereg[pkey] || "undefined" === typeof this.namereg[pkey].ikey[ikey]) { return request_base;