Sanitize url refs in SVG attributes
Add some tests. Sync with latest HTML5lib (includes above sanitization improvements).
This commit is contained in:
parent
ae82f1be49
commit
5208bbf0af
28 changed files with 1277 additions and 735 deletions
4
test/fixtures/revisions.yml
vendored
4
test/fixtures/revisions.yml
vendored
|
@ -50,7 +50,7 @@ home_page_second_revision:
|
|||
updated_at: <%= Time.local(2004, 4, 4, 16, 50).to_formatted_s(:db) %>
|
||||
revised_at: <%= Time.local(2004, 4, 4, 16, 50).to_formatted_s(:db) %>
|
||||
page_id: 1
|
||||
content: HisWay would be MyWay $\sin(x)\begin{svg}<svg/>\end{svg}$ in kinda ThatWay in HisWay though MyWay \OverThere -- see SmartEngine in that SmartEngineGUI
|
||||
content: HisWay would be MyWay $\sin(x)\begin{svg}<svg/>\end{svg}\includegraphics[width=3em]{foo}$ in kinda ThatWay in HisWay though MyWay \OverThere -- see SmartEngine in that SmartEngineGUI
|
||||
author: DavidHeinemeierHansson
|
||||
|
||||
first_page_first_revision:
|
||||
|
@ -59,7 +59,7 @@ first_page_first_revision:
|
|||
updated_at: <%= Time.local(2004, 4, 4, 16, 55).to_formatted_s(:db) %>
|
||||
revised_at: <%= Time.local(2004, 4, 4, 16, 55).to_formatted_s(:db) %>
|
||||
page_id: 6
|
||||
content: HisWay would be MyWay $\sin(x)\begin{svg}<svg/>\end{svg}$ in kinda ThatWay in HisWay though MyWay \\OverThere -- see SmartEngine in that SmartEngineGUI
|
||||
content: HisWay would be MyWay $\sin(x)\begin{svg}<svg/>\end{svg}\includegraphics[width=3em]{foo}$ in kinda ThatWay in HisWay though MyWay \\OverThere -- see SmartEngine in that SmartEngineGUI
|
||||
author: DavidHeinemeierHansson
|
||||
|
||||
oak_first_revision:
|
||||
|
|
|
@ -867,7 +867,7 @@ class WikiControllerTest < Test::Unit::TestCase
|
|||
|
||||
\section*{HomePage}
|
||||
|
||||
HisWay would be MyWay $\sin(x) $ in kinda ThatWay in HisWay though MyWay $\backslash$OverThere --{} see SmartEngine in that SmartEngineGUI
|
||||
HisWay would be MyWay $\sin(x) \includegraphics[width=3em]{foo}$ in kinda ThatWay in HisWay though MyWay $\backslash$OverThere --{} see SmartEngine in that SmartEngineGUI
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -57,7 +57,13 @@ class PageRendererTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_markdown
|
||||
set_web_property :markup, :markdown
|
||||
set_web_property :markup, :markdownMML
|
||||
|
||||
assert_markup_parsed_as(
|
||||
%{<p>equation <span class="maruku-inline"><math class="maruku-mathml" } +
|
||||
%{display="inline" xmlns="http://www.w3.org/1998/Math/MathML">} +
|
||||
%{<mi>sin</mi><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo></math></span></p>},
|
||||
"equation $\\sin(x)$")
|
||||
|
||||
assert_markup_parsed_as(
|
||||
%{<h1 id="my_headline">My Headline</h1>\n\n<p>that <span class="newWikiWord">} +
|
||||
|
@ -70,13 +76,11 @@ class PageRendererTest < Test::Unit::TestCase
|
|||
"#My Headline#\n\nthat SmartEngineGUI")
|
||||
|
||||
assert_markup_parsed_as(
|
||||
%{ecuasi\303\263n <math xmlns='http://www.w3.org/1998/Math/MathML' display='inline'>} +
|
||||
%{<mi>sin</mi><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo></math>},
|
||||
"ecuasi\303\263n $\\sin(x)$")
|
||||
|
||||
assert_markup_parsed_as(
|
||||
%{ecuasi\303\263n <math xmlns='http://www.w3.org/1998/Math/MathML' display='block'>} +
|
||||
%{<mi>sin</mi><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo><semantics><annotation-xml encoding="SVG1.1"><svg/></annotation-xml></semantics></math>},
|
||||
%{<div class="maruku-equation"><math class="maruku-mathml" display="block" } +
|
||||
%{xmlns="http://www.w3.org/1998/Math/MathML"><mi>sin</mi><mo stretchy="false">} +
|
||||
%{(</mo><mi>x</mi><mo stretchy="false">)</mo><semantics><annotation-xml encoding="SVG1.1">} +
|
||||
%{<svg></svg></annotation-xml></semantics></math><div class="maruku-eq-tex"><code style="display: none;">} +
|
||||
%{\\sin(x) \\begin{svg}<svg></svg>\\end{svg}</code></div></div>},
|
||||
"$$\\sin(x) \\begin{svg}<svg/>\\end{svg}$$")
|
||||
|
||||
code_block = [
|
||||
|
@ -92,6 +96,14 @@ class PageRendererTest < Test::Unit::TestCase
|
|||
%{<p>This is a code block:</p>\n\n<pre><code>def a_method(arg)\n} +
|
||||
%{return ThatWay</code></pre>\n\n<p>Nice!</p>},
|
||||
code_block)
|
||||
|
||||
#FIXME
|
||||
assert_markup_parsed_as(
|
||||
%{<p>ecuasi\303\263n <span class="maruku-inline"><math class="maruku-mathml" } +
|
||||
%{display="inline" xmlns="http://www.w3.org/1998/Math/MathML">} +
|
||||
%{<mi>sin</mi><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo></math></span></p>},
|
||||
"ecuasi\303\263n $\\sin(x)$")
|
||||
|
||||
end
|
||||
|
||||
def test_markdown_hyperlink_with_slash
|
||||
|
|
|
@ -117,6 +117,6 @@ class PageTest < Test::Unit::TestCase
|
|||
assert_equal 3, @page.revisions(true).length, "Should have three revisions"
|
||||
@page.current_revision(true)
|
||||
@page.rollback(0, Time.now, '127.0.0.1', test_renderer)
|
||||
assert_equal "HisWay would be MyWay in kinda ThatWay in HisWay though MyWay \\\\OverThere -- see SmartEngine in that SmartEngineGUI", @page.current_revision(true).content
|
||||
assert_equal "HisWay would be MyWay $\\sin(x)\\begin{svg}<svg/>\\end{svg}\\includegraphics[width=3em]{foo}$ in kinda ThatWay in HisWay though MyWay \\\\OverThere -- see SmartEngine in that SmartEngineGUI", @page.current_revision(true).content
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue