Performance
OK. This is a better way: define a custom TreeWalker which converts named entities to utf-8 as it goes. This avoids having to do an extra tree traversal in sanitize_rexml, AND avoids the trainwreck that is html5/inputstream.rb.
This commit is contained in:
parent
198d7847bd
commit
1911d18f65
3 changed files with 81 additions and 12 deletions
|
@ -77,9 +77,9 @@ module Engines
|
|||
@content.options[:renderer].s5_theme = my_content.s5_theme
|
||||
sanitize_xhtml(my_content.to_s5)
|
||||
else
|
||||
html = sanitize_xhtml(Maruku.new(@content.delete("\r"),
|
||||
html = sanitize_rexml(Maruku.new(@content.delete("\r"),
|
||||
{:math_enabled => true,
|
||||
:math_numbered => ['\\[','\\begin{equation}']}).to_html)
|
||||
:math_numbered => ['\\[','\\begin{equation}']}).to_html_tree)
|
||||
html.gsub(/\A<div class="maruku_wrapper_div">\n?(.*?)\n?<\/div>\Z/m, '\1')
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue