Ticket #771: scaps-rev2.patch
| File scaps-rev2.patch, 1.5 KB (added by fbennett, 7 years ago) |
|---|
-
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 var l = output.split(/(<\/?span[^>]*>)/); 167 var current_level = 0; 168 var tag_level = new Array(); 169 for (var pos=1; pos<l.length; pos+=2){ 170 var tag = l[pos]; 171 if (tag.slice(1,2) == "/"){ 172 current_level += -1; 173 if (current_level == tag_level[(tag_level.length-1)]){ 174 tag_level.pop(); 175 l[pos] = "\\scaps0 "; 176 } 177 } else { 178 if (l[pos].match(/small-caps/)){ 179 l[pos] = "\\scaps "; 180 tag_level.push(current_level); 181 } 182 current_level += 1; 183 }; 184 }; 185 output = l.join(""); 167 186 output = output.replace("<p>", "", "g"); 168 187 output = output.replace("</p>", "\\par ", "g"); 169 188 output = output.replace(/<\/?div[^>]*>/g, ""); … … 236 255 html = html.replace(this._rtfMap[needle], needle, "g"); 237 256 } 238 257 } 258 html = html.replace("\\scaps ", "<span style=\"font-variant:small-caps\">", "g"); 259 html = html.replace("\\scaps0 ", "</span>", "g"); 239 260 html = '<div style="'+bodyStyle+'"><p>'+html.replace("\par ", "</p><p>")+"</p></div>"; 240 261 Zotero.debug("setting content to "+html); 241 262 }