From 2689f923350e8d2fbc614f02807b88fd526a4c1c Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Fri, 19 Dec 2008 23:15:52 +0000 Subject: [PATCH] Fixes #1265, Year suffix disambiguation doesn't scale Patch seems to work (tested with "2007z", "2007aa", "2007ab") -- applying to branch and trunk --- chrome/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 index 69c08ce34..88a0cb309 100644 --- 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