diff --git a/chrome/content/zotero/bindings/styled-textbox.xml b/chrome/content/zotero/bindings/styled-textbox.xml index ab98b934f..8ad9d27ae 100644 --- a/chrome/content/zotero/bindings/styled-textbox.xml +++ b/chrome/content/zotero/bindings/styled-textbox.xml @@ -56,8 +56,6 @@ "":"\\b0 ", "":"\\b ", "":"\\b0 ", - "":"\\ul ", - "":"\\ul0 ", "
":"\x0B", "":"\\super ", "":"\\super0 ", @@ -68,6 +66,19 @@ ' ':"\t" }; + this._rtfRexMap = [ + ["", + /small-caps/, + "\\scaps ", + "\\scaps0 " + ], + ["", + /underline/, + "\\ul ", + "\\ul0 " + ] + ] + this._constructed = true; if (this._loadOnConstruct) { @@ -164,28 +175,29 @@ output = output.replace(needle, this._rtfMap[needle], "g"); } - // Preserve small caps - var l = output.split(/(<\/?span[^>]*>)/); - var current_level = 0; - var tag_level = []; - for (var pos=1; pos]*>)/); + var current_level = 0; + var tag_level = []; + for (var pos=1; pos", "", "g"); output = output.replace("

", "\\par ", "g"); output = output.replace(/<\/?div[^>]*>/g, ""); @@ -258,10 +270,10 @@ html = html.replace(this._rtfMap[needle], needle, "g"); } } - - html = html.replace("\\scaps ", "", "g"); - html = html.replace("\\scaps0 ", "", "g"); - + for each (var tagspec in this._rtfRexMap){ + html = html.replace(tagspec[2], tagspec[0], "g"); + html = html.replace(tagspec[3], "
", "g"); + } html = '

'+html.replace("\par ", "

")+"

"; Zotero.debug("setting content to "+html); }