From 41006d20ef993aa980d6f0e3dc1ff03e06caaa09 Mon Sep 17 00:00:00 2001 From: Jacques Distler Date: Wed, 14 Jan 2009 22:55:59 -0600 Subject: [PATCH] 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 ? --- lib/wiki_content.rb | 3 ++- test/unit/page_renderer_test.rb | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/wiki_content.rb b/lib/wiki_content.rb index 5ed9768c..5f04fb09 100644 --- a/lib/wiki_content.rb +++ b/lib/wiki_content.rb @@ -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 diff --git a/test/unit/page_renderer_test.rb b/test/unit/page_renderer_test.rb index c4093538..0da31ac1 100644 --- a/test/unit/page_renderer_test.rb +++ b/test/unit/page_renderer_test.rb @@ -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 "

\\ " + + "a b" + + "

", + test_renderer(main).display_content + end + private def add_sample_pages