www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 2689f923350e8d2fbc614f02807b88fd526a4c1c
parent bac79ed2acbcb2a4554b2bd2808f4067b59fdbc5
Author: Dan Stillman <dstillman@zotero.org>
Date:   Fri, 19 Dec 2008 23:15:52 +0000

Fixes #1265, Year suffix disambiguation doesn't scale

Patch seems to work (tested with "2007z", "2007aa", "2007ab") -- applying to branch and trunk



Diffstat:
Mchrome/content/zotero/xpcom/csl.js | 24+++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/chrome/content/zotero/xpcom/csl.js b/chrome/content/zotero/xpcom/csl.js @@ -2444,16 +2444,26 @@ Zotero.CSL.ItemSet.prototype.resort = function() { item.setProperty("disambiguate-add-year-suffix", "b"); } else { var newDisambiguate = ""; - if(lastDisambiguate.length > 1) { - newDisambiguate = oldLetter.substr(0, lastDisambiguate.length-1); - } - var charCode = lastDisambiguate.charCodeAt(lastDisambiguate.length-1); if(charCode == 122) { - // item is z; add another letter - newDisambiguate += "a"; - } else { + newDisambiguate = lastDisambiguate.replace(/z+$/, ""); + var consecutiveZs = lastDisambiguate.length-newDisambiguate.length; + if(newDisambiguate.length >= 1) { + var nonZCharCode = lastDisambiguate.charCodeAt(newDisambiguate.length-1); + newDisambiguate = newDisambiguate.substring(0,newDisambiguate.length-1); + newDisambiguate += String.fromCharCode(nonZCharCode+1); + for(i=0;i<consecutiveZs;i++) { + newDisambiguate += "a"; + } + } + else { + newDisambiguate = lastDisambiguate.replace(/z/g, "a"); + newDisambiguate += "a"; + } + } + else { // next lowercase letter + newDisambiguate = lastDisambiguate.substring(0,lastDisambiguate.length-1); newDisambiguate += String.fromCharCode(charCode+1); }