Fix Maruku Escaping Bug

Sync with latest Maruku (now on github).
lib/maruku/ext/math/mathml_engines/none.rb should
HTML-escape the TeX source code. No it does.
This commit is contained in:
Jacques Distler 2009-05-13 01:27:39 -05:00
parent ec7141942b
commit a84648cff1
20 changed files with 1725 additions and 136 deletions

View file

@ -1,6 +1,6 @@
Write a comment here
*** Parameters: ***
{}
require 'maruku/ext/math';{}
*** Markdown input: ***
$$ x = y $$
@ -16,42 +16,69 @@ $$
*** Output of inspect ***
md_el(:document,[
md_par(["$$ x = y $$"]),
md_el(:header,["$$ x"],{:level=>1},[]),
md_par(["$$ x = y $$"]),
md_par(["$$ x = y $$"])
md_el(:equation,[],{:label=>nil,:math=>" x = y ",:num=>nil},[]),
md_el(:equation,[],{:label=>nil,:math=>" x = y \n",:num=>nil},[]),
md_el(:equation,[],{:label=>nil,:math=>" x = y \n",:num=>nil},[]),
md_el(:equation,[],{:label=>nil,:math=>" x = y \n",:num=>nil},[])
],{},[])
*** Output of to_html ***
<p>$$ x = y $$</p>
<h1 id='_x'>$$ x</h1>
<p>$$ x = y $$</p>
<p>$$ x = y $$</p>
<div class='maruku-equation'><code class='maruku-mathml'> x = y </code><div class='maruku-eq-tex'><code style='display: none'>x = y</code></div></div><div class='maruku-equation'><code class='maruku-mathml'> x = y
</code><div class='maruku-eq-tex'><code style='display: none'>x = y</code></div></div><div class='maruku-equation'><code class='maruku-mathml'> x = y
</code><div class='maruku-eq-tex'><code style='display: none'>x = y</code></div></div><div class='maruku-equation'><code class='maruku-mathml'> x = y
</code><div class='maruku-eq-tex'><code style='display: none'>x = y</code></div></div>
*** Output of to_latex ***
\$\$ x = y \$\$
\hypertarget{_x}{}\section*{{\$\$ x}}\label{_x}
\$\$ x = y \$\$
\$\$ x = y \$\$
\begin{displaymath}
x = y
\end{displaymath}
\begin{displaymath}
x = y
\end{displaymath}
\begin{displaymath}
x = y
\end{displaymath}
\begin{displaymath}
x = y
\end{displaymath}
*** Output of to_md ***
$$ x = y $$
$$ x$$ x = y $$
$$ x = y $$
*** Output of to_s ***
$$ x = y $$$$ x$$ x = y $$$$ x = y $$
*** EOF ***
OK!
Failed tests: [:to_html]
*** Output of inspect ***
md_el(:document,[
md_el(:equation,[],{:label=>nil,:math=>" x = y ",:num=>nil},[]),
md_el(:equation,[],{:label=>nil,:math=>" x = y \n",:num=>nil},[]),
md_el(:equation,[],{:label=>nil,:math=>" x = y \n",:num=>nil},[]),
md_el(:equation,[],{:label=>nil,:math=>" x = y \n",:num=>nil},[])
],{},[])
*** Output of to_html ***
-----| WARNING | -----
<div class='maruku-equation'><code class='maruku-mathml'> x = y </code><span class='maruku-eq-tex'><code style='display: none'>x = y</code></span></div><div class='maruku-equation'><code class='maruku-mathml'> x = y
</code><span class='maruku-eq-tex'><code style='display: none'>x = y</code></span></div><div class='maruku-equation'><code class='maruku-mathml'> x = y
</code><span class='maruku-eq-tex'><code style='display: none'>x = y</code></span></div><div class='maruku-equation'><code class='maruku-mathml'> x = y
</code><span class='maruku-eq-tex'><code style='display: none'>x = y</code></span></div>
*** Output of to_latex ***
\begin{displaymath}
x = y
\end{displaymath}
\begin{displaymath}
x = y
\end{displaymath}
\begin{displaymath}
x = y
\end{displaymath}
\begin{displaymath}
x = y
\end{displaymath}
*** Output of to_md ***
*** Output of to_s ***
*** Output of Markdown.pl ***
(not used anymore)

View file

@ -22,9 +22,9 @@ md_el(:document,[
<p>Here are some formulas:</p>
<ul>
<li><span class='maruku-inline'><code class='maruku-mathml'>\alpha</code></span></li>
<li><code class='maruku-mathml'>\alpha</code></li>
<li><span class='maruku-inline'><code class='maruku-mathml'>x^{n}+y^{n} \neq z^{n}</code></span></li>
<li><code class='maruku-mathml'>x^{n}+y^{n} \neq z^{n}</code></li>
</ul>
<p>That&#8217;s it, nothing else is supported.</p>

View file

@ -25,12 +25,7 @@ md_el(:document,[
md_el(:equation,[],{:label=>nil,:math=>" \\gamma ",:num=>nil},[])
],{},[])
*** Output of to_html ***
<div class='maruku-equation' id='eq:eq1'><span class='maruku-eq-number'>(1)</span><math class='maruku-mathml' display='block' xmlns='http://www.w3.org/1998/Math/MathML'><mi>&alpha;</mi></math><div class='maruku-eq-tex'><code style='display: none'> \alpha
</code></div></div><div class='maruku-equation'><math class='maruku-mathml' display='block' xmlns='http://www.w3.org/1998/Math/MathML'><mi>&alpha;</mi></math><div class='maruku-eq-tex'><code style='display: none'> \alpha
</code></div></div><div class='maruku-equation'><math class='maruku-mathml' display='block' xmlns='http://www.w3.org/1998/Math/MathML'><mi>&beta;</mi></math><div class='maruku-eq-tex'><code style='display: none'> \beta
</code></div></div><div class='maruku-equation'><math class='maruku-mathml' display='block' xmlns='http://www.w3.org/1998/Math/MathML'><mi>&gamma;</mi></math><div class='maruku-eq-tex'><code style='display: none'> \gamma </code></div></div>
<div class='maruku-equation' id='eq:eq1'><math class='maruku-mathml' display='block' xmlns='http://www.w3.org/1998/Math/MathML'><mi>&alpha;</mi></math><span class='maruku-eq-tex'><code style='display: none'>\alpha</code></span><span class='maruku-eq-number'>(1)</span></div><div class='maruku-equation'><math class='maruku-mathml' display='block' xmlns='http://www.w3.org/1998/Math/MathML'><mi>&alpha;</mi></math><span class='maruku-eq-tex'><code style='display: none'>\alpha</code></span></div><div class='maruku-equation'><math class='maruku-mathml' display='block' xmlns='http://www.w3.org/1998/Math/MathML'><mi>&beta;</mi></math><span class='maruku-eq-tex'><code style='display: none'>\beta</code></span></div><div class='maruku-equation'><math class='maruku-mathml' display='block' xmlns='http://www.w3.org/1998/Math/MathML'><mi>&gamma;</mi></math><span class='maruku-eq-tex'><code style='display: none'>\gamma</code></span></div>
*** Output of to_latex ***
\begin{equation}
\alpha
@ -52,45 +47,9 @@ md_el(:document,[
OK!
Failed tests: [:to_html]
*** Output of inspect ***
md_el(:document,[
md_el(:equation,[],{:label=>"eq1",:math=>"\t\\alpha\n\n",:num=>1},[]),
md_el(:equation,[],{:label=>nil,:math=>"\t\\alpha\n\n",:num=>nil},[]),
md_el(:equation,[],{:label=>nil,:math=>" \\beta\n",:num=>nil},[]),
md_el(:equation,[],{:label=>nil,:math=>" \\gamma ",:num=>nil},[])
],{},[])
*** Output of to_html ***
-----| WARNING | -----
<div class='maruku-equation' id='eq:eq1'><span class='maruku-eq-number'>(1)</span><code class='maruku-mathml'> \alpha
</code><div class='maruku-eq-tex'><code style='display: none'> \alpha
</code></div></div><div class='maruku-equation'><code class='maruku-mathml'> \alpha
</code><div class='maruku-eq-tex'><code style='display: none'> \alpha
</code></div></div><div class='maruku-equation'><code class='maruku-mathml'> \beta
</code><div class='maruku-eq-tex'><code style='display: none'> \beta
</code></div></div><div class='maruku-equation'><code class='maruku-mathml'> \gamma </code><div class='maruku-eq-tex'><code style='display: none'> \gamma </code></div></div>
*** Output of to_latex ***
\begin{equation}
\alpha
\label{eq1}\end{equation}
\begin{displaymath}
\alpha
\end{displaymath}
\begin{displaymath}
\beta
\end{displaymath}
\begin{displaymath}
\gamma
\end{displaymath}
*** Output of to_md ***
*** Output of to_s ***
*** Output of Markdown.pl ***
(not used anymore)

View file

@ -1,6 +1,6 @@
Write a comment here
*** Parameters: ***
{}
require 'maruku/ext/math';{:html_math_engine => 'itex2mml' }
*** Markdown input: ***
<table markdown='1'>
$\alpha$
@ -13,8 +13,8 @@ md_el(:document,[
md_html("<table markdown='1'>\n\t$\\alpha$\n\t<thead>\n\t\t<td>$\\beta$</td>\n\t</thead>\n</table>")
],{},[])
*** Output of to_html ***
<table><span class='maruku-inline'><code class='maruku-mathml'>\alpha</code></span><thead>
<td><span class='maruku-inline'><code class='maruku-mathml'>\beta</code></span></td>
<table><math class='maruku-mathml' display='inline' xmlns='http://www.w3.org/1998/Math/MathML'><mi>&alpha;</mi></math><thead>
<td><math class='maruku-mathml' display='inline' xmlns='http://www.w3.org/1998/Math/MathML'><mi>&beta;</mi></math></td>
</thead>
</table>
*** Output of to_latex ***