diff --git a/chrome/content/zotero/xpcom/cite.js b/chrome/content/zotero/xpcom/cite.js index caed89fdd4..3a67128739 100644 --- a/chrome/content/zotero/xpcom/cite.js +++ b/chrome/content/zotero/xpcom/cite.js @@ -408,8 +408,9 @@ Zotero.Cite.getAbbreviation = new function() { for(var j=0; j0 && newWord === undefined; k--) { newWord = cat[lcWord.substr(0, k)+"-"]; - if(newWord && word.length - newWord.length < 1) { - newWord = undefined; - } } } } - + + // Don't substitute with a longer word + if(newWord && !exactMatch && word.length - newWord.length < 1) { + newWord = word; + } + // Fall back to full word if(newWord === undefined) newWord = word; - + + // Don't discard last word (e.g. Climate of the Past => Clim. Past) + if(!newWord && words.length<=j+2) newWord = word; + words[j] = newWord.substr(0, 1).toUpperCase() + newWord.substr(1); } abbreviation = words.join("").replace(/\s+/g, " ").trim(); @@ -439,10 +450,8 @@ Zotero.Cite.getAbbreviation = new function() { } } - if(!abbreviation || abbreviation === key) { - Zotero.debug("No abbreviation found for "+key); - return; - } + if(!abbreviation) abbreviation = key; //this should never happen, but just in case + Zotero.debug("Abbreviated "+key+" as "+abbreviation); // Add to jurisdiction object