Ticket #1278: 03-firstref-punct.patch

File 03-firstref-punct.patch, 2.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  
    759759                                        if(variables[j] == "locator") { 
    760760                                                // special case for locator 
    761761                                                var text = citationItem && citationItem.locator ? citationItem.locator : ""; 
     762                                        } else if(variables[j] == "firstref") { 
     763                                                // note number of first reference to this citation 
     764                                                var text = citationItem && citationItem.firstref ? citationItem.firstref : 0; 
    762765                                        } else if(citationItem && citationItem._csl && citationItem._csl[variables[j]]) { 
    763766                                                // override if requested 
    764767                                                var text = citationItem._csl[variables[j]]; 
     
    10371040                                         
    10381041                                        // inspect variables 
    10391042                                        var done = false; 
    1040                                         var attributes = ["variable", "is-date", "is-numeric", "is-plural", "type", "disambiguate", "locator", "position"]; 
     1043                                        var attributes = ["variable", "is-date", "is-numeric", "is-plural", "type", "disambiguate", "locator", "context", "position", "firstref"]; 
    10411044                                        for(var k=0; !done && k<attributes.length; k++) { 
    10421045                                                var attribute = attributes[k]; 
    10431046                                                 
     
    10851088                                                                        exists = (variables[j] == "true" && item.getProperty("disambiguate-condition")) 
    10861089                                                                                || (variables[j] == "false" && !item.getProperty("disambiguate-condition")); 
    10871090                                                                } else if(attribute == "locator") { 
    1088                                                                         exists = citationItem && citationItem.locator && 
    1089                                                                                 (citationItem.locatorType == variables[j] 
    1090                                                                                 || (!citationItem.locatorType && variables[j] == "page")); 
     1091 
     1092                                                                    exists = citationItem && citationItem.locator && 
     1093                                                                        (citationItem.locatorType == variables[j] 
     1094                                                                         || (!citationItem.locatorType && variables[j] == "page")); 
     1095                                                                } else if (attribute == "context") { 
     1096 
     1097                                                                    if(variables[j] == "prefix-punctuation") { 
     1098                                                                        exists = citationItem && citationItem.prefixPunctuation; 
     1099                                                                    } 
    10911100                                                                } else {        // attribute == "position" 
    10921101                                                                        if(variables[j] == "first") { 
    10931102                                                                                exists = !citationItem 
     
    15701579 * itemID 
    15711580 */ 
    15721581Zotero.CSL.CitationItem = function(item) { 
     1582        var prefixPunctuation; 
    15731583        if(item) { 
    15741584                this.item = item; 
    15751585                this.itemID = item.id;