Performance

My REXML::Element.to_ncr (and REXML::Element.to_utf8) is horribly slow. For long documents, it proves more efficient to serialize to a string, apply String.to_ncr (or String.to_utf8) and then Sanitize the string.
This commit is contained in:
Jacques Distler 2007-10-13 16:32:04 -05:00
parent 0eb1ab56b0
commit 198d7847bd
5 changed files with 121 additions and 16 deletions

View file

@ -77,9 +77,9 @@ module Engines
@content.options[:renderer].s5_theme = my_content.s5_theme
sanitize_xhtml(my_content.to_s5)
else
html = sanitize_rexml(Maruku.new(@content.delete("\r"),
html = sanitize_xhtml(Maruku.new(@content.delete("\r"),
{:math_enabled => true,
:math_numbered => ['\\[','\\begin{equation}']}).to_html_tree)
:math_numbered => ['\\[','\\begin{equation}']}).to_html)
html.gsub(/\A<div class="maruku_wrapper_div">\n?(.*?)\n?<\/div>\Z/m, '\1')
end