Fix the "Backslashes in Included Equations" Bug

See
  http://golem.ph.utexas.edu/instiki/revision/Known+Bugs?rev=3#IncludedEqs

Who knew that

      @pre_rendered = String.new(self)

was not the same as

      @pre_rendered = String.new
      @pre_rendered = self

?
This commit is contained in:
Jacques Distler 2009-01-14 22:55:59 -06:00
parent 074711d4c5
commit 41006d20ef
2 changed files with 13 additions and 1 deletions

View file

@ -177,7 +177,8 @@ class WikiContent < String
def pre_render!
unless @pre_rendered
@chunks_by_type[Include].each{|chunk| chunk.unmask }
@pre_rendered = String.new(self)
@pre_rendered = String.new
@pre_rendered = self
end
@pre_rendered
end

View file

@ -626,6 +626,17 @@ END_THM
test_renderer(main).display_content_for_export
end
def test_rendering_included_page_backslashes_in_equations
included = @web.add_page('Included', '\\\\ $\begin{matrix} a \\\\ b\end{matrix}$', Time.now, 'AnAuthor', test_renderer)
main = @web.add_page('Main', '[[!include Included]]', Time.now, 'AnAuthor', test_renderer)
assert_equal "<p>\\ <math class='maruku-mathml' display='inline' " +
"xmlns='http://www.w3.org/1998/Math/MathML'><mrow><mtable rowspacing='0.5ex'>" +
"<mtr><mtd><mi>a</mi></mtd></mtr> <mtr><mtd><mi>b</mi></mtd></mtr></mtable>" +
"</mrow></math></p>",
test_renderer(main).display_content
end
private
def add_sample_pages