Ticket #1278: 06-joins.patch

File 06-joins.patch, 1.7 KB (added by fbennett, 8 years ago)
  • chrome/content/zotero/xpcom/csl.js

    Only in zotero-trunk/chrome/content/zotero: addCitationDialog.js.orig
    Only in zotero-trunk/chrome/content/zotero: addCitationDialog.js.rej
    diff -r -u zotero-trunk.orig/chrome/content/zotero/xpcom/csl.js zotero-trunk/chrome/content/zotero/xpcom/csl.js
    old new  
    269269                        if(Zotero.CSL._textCharRegexp.test(prefix[prefix.length-1])) prefix += " "; 
    270270                         
    271271                        citationString.append(prefix); 
     272                        citationString.has_prefix = true; 
    272273                } 
    273274                 
    274275                this._processElements(citationItem.item, context.layout, citationString, 
    275276                        context, citationItem, ignore); 
    276277                 
    277278                // add suffix 
     279                var hasSuffixPunctuation; 
    278280                if(citationItem.suffix) { 
    279281                        var suffix = citationItem.suffix; 
     282                        var sfx = suffix.replace(/^\s*/g, "").replace(/\s*$/g, ""); 
     283                        var pnct = Zotero.CSL.FormattedString._punctuation; 
     284                        if (pnct.indexOf(sfx[sfx.length-1]) != -1) { 
     285                            hasSuffixPunctuation = true; 
     286                        } else { 
     287                            hasSuffixPunctuation = false; 
     288                        } 
    280289                         
    281290                        // add space to suffix if last char is alphanumeric 
    282291                        if(Zotero.CSL._textCharRegexp.test(suffix[0])) suffix = " "+suffix; 
     
    285294                } 
    286295                 
    287296                string.concat(citationString); 
     297                string.hasSuffixPunctuation = hasSuffixPunctuation; 
    288298        } 
    289299         
    290300        var returnString = string.clone();