From f4dfc13eabb45d59d82debc3bf60663440063319 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Sat, 9 Oct 2010 04:13:51 +0000 Subject: [PATCH] update to citeproc-js 1.0.63 (I think; the code itself still says 1.0.61, but this should be the latest revision available on bitbucket) Form Frank's release notes: citeproc-js 1.0.63: Fix appendCitationCluster() to return a simple string, and required by Zotero RTF Scan or any similar utility. citeproc-js 1.0.62: Block needless initialization of names where the full name is requested and initialization is not. citeproc-js 1.0.61: Block needless initialization of names where form is long, no initialization is requested, and last names are identical. citeproc-js 1.0.60: Turn on the parsing of name prefixes and suffixes by default. (This change should make CSL 1.0 name prefix and suffix handling designed by Rintze Zelle available to existing applications, without complex changes to the user interface.) --- chrome/content/zotero/xpcom/citeproc.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) 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;