Ticket #1278: 09-reset-first-reference.patch

File 09-reset-first-reference.patch, 2.6 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  
    11201120                                                                    exists = citationItem && citationItem.locator && 
    11211121                                                                        (citationItem.locatorType == variables[j] 
    11221122                                                                         || (!citationItem.locatorType && variables[j] == "page")); 
     1123                                                                } else if (attribute == "reset-first" ) { 
     1124                                                                        // weird register adjustments here, not sure why 
     1125                                                                        // it needs to be set this way, but this works, and 
     1126                                                                        // every other arrangement didn't. 
     1127                                                                        if ( !Zotero.CSL.Global.lastFirstRef[citationItem.itemID] || citationItem.thisRef - Zotero.CSL.Global.lastFirstRef[citationItem.itemID] < 0 ) { 
     1128                                                                                Zotero.CSL.Global.lastFirstRef[citationItem.itemID] = citationItem.thisRef-1; 
     1129                                                                        } 
     1130                                                                        if ( citationItem.thisRef - Zotero.CSL.Global.lastFirstRef[citationItem.itemID] >= variables[j] ) { 
     1131                                                                                Zotero.CSL.Global.lastFirstRef[citationItem.itemID] = citationItem.thisRef; 
     1132                                                                                exists = true; 
     1133                                                                        } else { 
     1134                                                                                exists = false; 
     1135                                                                        } 
    11231136                                                                } else if (attribute == "context") { 
    11241137 
    11251138                                                                    if(variables[j] == "prefix-punctuation") { 
    1126                                                                         exists = citationItem && citationItem.prefixPunctuation; 
    1127                                                                     } 
     1139                                                                                exists = citationItem && citationItem.prefixPunctuation; 
     1140                                                                    } else if(variables[j] == "same-note") { 
     1141                                                                                exists = citationItem && citationItem.distanceToLastRef == 0; 
     1142                                                                        } 
    11281143                                                                } else {        // attribute == "position" 
    11291144                                                                        if(variables[j] == "first") { 
    11301145                                                                                exists = !citationItem 
     
    13571372        this.cleanXML = cleanXML; 
    13581373        this.parseLocales = parseLocales; 
    13591374         
     1375        /* 
     1376         * Mutable register for tracking most recent full citation 
     1377         * (for op cit, Bluebook statutory references) 
     1378         * 
     1379         */ 
     1380        this.lastFirstRef = new Object(); 
     1381                 
    13601382        default xml namespace = "http://purl.org/net/xbiblio/csl"; with({}); 
    13611383        this.ns = "http://purl.org/net/xbiblio/csl"; 
    13621384         
     
    13781400         * initializes CSL interpreter 
    13791401         */ 
    13801402        function init() { 
     1403 
    13811404                if(!Zotero.CSL.Global._xmlLang) { 
    13821405                        var prefix = "chrome://zotero/content/locale/csl/locales-"; 
    13831406                        var ext = ".xml";