Ticket #1712: citeproc-1.0.52.patch

File citeproc-1.0.52.patch, 2.6 KB (added by fbennett, 6 years ago)
  • chrome/content/zotero/bindings/styled-textbox.xml

    old new  
    5252                                this._rtfMap = { 
    5353                                        "\\":"\\\\", 
    5454                                        "<em>":"\\i ", 
    55                                         "</em>":"\\i0 ", 
     55                                        "</em>":"\\i0{}", 
    5656                                        "<i>":"\\i ", 
    57                                         "</i>":"\\i0 ", 
     57                                        "</i>":"\\i0{}", 
    5858                                        "<strong>":"\\b ", 
    59                                         "</strong>":"\\b0 ", 
     59                                        "</strong>":"\\b0{}", 
    6060                                        "<b>":"\\b ", 
    61                                         "</b>":"\\b0 ", 
     61                                        "</b>":"\\b0{}", 
    6262                                        "<br />":"\x0B", 
    6363                                        // there's no way to mimic a tab stop in CSS without 
    6464                                        // tables, which wouldn't work here. 
    65                                         '<span class="tab">&nbsp;</span>':"\\tab " 
     65                                        '<span class="tab">&nbsp;</span>':"\\tab{}" 
    6666                                }; 
    6767                                 
    6868                                this._rtfToHtmlMap = [ 
    69                                         [/\\uc0\{?\\u([0-9]+)\}? ?/g, function(wholeStr, aCode) { return String.fromCharCode(aCode) }], 
    70                                         ["\\t ", '<span class="tab">&nbsp;</span>'], 
    71                                         [/(?:\\par |\\\r?\n)/g, "</p><p>"], 
    72                                         [/\\super (.*?)\\nosupersub /g, "<sup>$1</sup>"], 
    73                                         [/\\sub (.*?)\\nosupersub /g, "<sub>$1</sub>"] 
     69                                        [/\\uc0\{?\\u([0-9]+)\}?(?:{}| )?/g, function(wholeStr, aCode) { return String.fromCharCode(aCode) }], 
     70                                        ["\\tab{}", '<span class="tab">&nbsp;</span>'], 
     71                                        [/(?:\\par{}|\\\r?\n)/g, "</p><p>"], 
     72                                        [/\\super (.*?)\\nosupersub{}/g, "<sup>$1</sup>"], 
     73                                        [/\\sub (.*?)\\nosupersub{}/g, "<sub>$1</sub>"] 
    7474                                ]; 
    7575                                 
    7676                                this._htmlToRtfMap = [ 
    7777                                        [/"(\w)/, "“$1"], 
    7878                                        [/([\w,.?!])"/, "$1”"], 
    7979                                        ["<p>", ""], 
    80                                         ["</p>", "\\par "], 
     80                                        ["</p>", "\\par{}"], 
    8181                                        [/<\/?div[^>]*>/g, ""], 
    8282                                        ["<sup>", "\\super "], 
    83                                         ["</sup>", "\\nosupersub "], 
     83                                        ["</sup>", "\\nosupersub{}"], 
    8484                                        ["<sub>", "\\sub "], 
    85                                         ["</sub>", "\\nosupersub "] 
     85                                        ["</sub>", "\\nosupersub{}"] 
    8686                                ]; 
    8787                                 
    8888                                this._rtfRexMap = [ 
    8989                                        ["<span style=\"font-variant:small-caps;\">", 
    9090                                         /small-caps/, 
    9191                                         "\\scaps ", 
    92                                          "\\scaps0 " 
     92                                         "\\scaps0{}" 
    9393                                        ], 
    9494                                        ["<span style=\"text-decoration:underline;\">", 
    9595                                         /underline/, 
    9696                                         "\\ul ", 
    97                                          "\\ul0 " 
     97                                         "\\ul0{}" 
    9898                                        ] 
    9999                                ] 
    100100 
     
    217217                                                output = Zotero.Utilities.prototype.unescapeHTML( 
    218218                                                                output.replace(" ", "&nbsp;", "g")) 
    219219                                                        .replace(highcharRe, 
    220                                                                 function(aChar) { return "\\uc0\\u"+aChar.charCodeAt(0).toString()+" " }); 
     220                                                                function(aChar) { return "\\uc0\\u"+aChar.charCodeAt(0).toString()+"{}" }); 
    221221 
    222                                                 if(output.substr(-4) == "\\par") output = output.substr(0, output.length-4); 
     222                                                if(output.substr(-4) == "\\par{}") output = output.substr(0, output.length-4); 
    223223                                        } 
    224224                                         
    225225                                        return output;