Ticket #771: scaps-rev1.patch
| File scaps-rev1.patch, 1.5 KB (added by fbennett, 7 years ago) |
|---|
-
chrome/content/zotero/bindings/styled-textbox.xml
163 163 for(var needle in this._rtfMap) { 164 164 output = output.replace(needle, this._rtfMap[needle], "g"); 165 165 } 166 166 while (output.match(/<span[^>]*small-caps[^>]*>/)){ 167 var l = output.split(/<span[^>]*small-caps[^>]*>/); 168 for (var pos=1; pos<l.length; pos+=1){ 169 var spanmatch = l[pos].match(/<span[^>]*>/g); 170 var lx = l[pos].split("</span>"); 171 if (spanmatch){ 172 var mymid = lx.slice(0,spanmatch.length).join("</span>"); 173 var myend = lx.slice(spanmatch.length).join("\\scaps0 "); 174 l[pos] = mymid + "\\scaps0 " + myend; 175 } else { 176 l[pos] = lx.join("\\scaps0 "); 177 } 178 } 179 output = l.join("\\scaps "); 180 } 167 181 output = output.replace("<p>", "", "g"); 168 182 output = output.replace("</p>", "\\par ", "g"); 169 183 output = output.replace(/<\/?div[^>]*>/g, ""); … … 236 250 html = html.replace(this._rtfMap[needle], needle, "g"); 237 251 } 238 252 } 253 html = html.replace("\\scaps ", "<span style=\"font-variant:small-caps\">", "g"); 254 html = html.replace("\\scaps0 ", "</span>", "g"); 239 255 html = '<div style="'+bodyStyle+'"><p>'+html.replace("\par ", "</p><p>")+"</p></div>"; 240 256 Zotero.debug("setting content to "+html); 241 257 }