Hide Equations From WikiChunk Processing

WikiWord (and the like) could wreak havoc in equations. Protect them
(the way <a>, <pre> and <code> blocks are protected).

For some reason, this doesn't seem to work in inline equations.
Maruku is doing something funny there ... => one failing Unit Test.
This commit is contained in:
Jacques Distler 2009-01-14 16:11:07 -06:00
parent 4936bea13f
commit 074711d4c5
3 changed files with 55 additions and 3 deletions

View file

@ -229,7 +229,7 @@ END_THM
'* list 2'
].join("\n")
set_web_property :markup, :markdown
set_web_property :markup, :markdownMML
re = Regexp.new(
'<h1 id=\'markdown_heading_\d{1,4}\'>Markdown heading</h1>\n\n' +
"<p>h2. Textile heading</p>\n\n" +
@ -287,6 +287,49 @@ END_THM
'_should we go ThatWay or ThisWay _')
end
def test_content_with_wikiword_in_equations
assert_markup_parsed_as(
"<p>should we go <a class='existingWikiWord' href='../show/ThatWay'>" +
"That Way</a> or</p>\n<div class='maruku-equation' id='eq:eq1'>" +
"<math class='maruku-mathml' display='block' " +
"xmlns='http://www.w3.org/1998/Math/MathML'><mi>ThisWay</mi></math>" +
"<span class='maruku-eq-tex'><code style='display: none;'>ThisWay</code>" +
"</span><span class='maruku-eq-number'>(1)</span></div>",
"should we go ThatWay or \n\\[ThisWay\\]\n")
assert_markup_parsed_as(
"<p>should we go <a class='existingWikiWord' href='../show/ThatWay'>" +
"That Way</a> or</p>\n<div class='maruku-equation'>" +
"<math class='maruku-mathml' display='block' " +
"xmlns='http://www.w3.org/1998/Math/MathML'><mi>ThisWay</mi></math>" +
"<span class='maruku-eq-tex'><code style='display: none;'>ThisWay</code>" +
"</span></div>",
"should we go ThatWay or \n$$ThisWay$$\n")
assert_markup_parsed_as(
"<p>should we go <a class='existingWikiWord' href='../show/ThatWay'>" +
"That Way</a> or</p>\n<div class='maruku-equation'>" +
"<math class='maruku-mathml' display='block' " +
"xmlns='http://www.w3.org/1998/Math/MathML'><mi>ThisWay</mi><mi>$</mi>" +
"<mn>100 </mn><mi>ThatWay</mi></math>" +
"<span class='maruku-eq-tex'><code style='display: none;'>ThisWay \\$100 " +
"ThatWay</code></span></div>",
"should we go ThatWay or \n$$ThisWay \\$100 ThatWay $$\n")
assert_markup_parsed_as(
"<p>should we go <a class='existingWikiWord' href='../show/ThatWay'>" +
"That Way</a> or <math class='maruku-mathml' display='inline' " +
"xmlns='http://www.w3.org/1998/Math/MathML'><mi>ThisWay</mi></math> today.</p>",
"should we go ThatWay or <math class='maruku-mathml' display='inline' " +
"xmlns='http://www.w3.org/1998/Math/MathML'><mi>ThisWay</mi></math> today.")
assert_markup_parsed_as(
"<p>should we go <a class='existingWikiWord' href='../show/ThatWay'>" +
"That Way</a> or <math class='maruku-mathml' display='inline' " +
"xmlns='http://www.w3.org/1998/Math/MathML'><mi>ThisWay</mi></math>.</p>",
"should we go ThatWay or $ThisWay$.")
end
# wikiwords are invalid as styles, must be in "name: value" form
def test_content_with_wikiword_in_style_tag
assert_markup_parsed_as(