REXML is dead. Long live Nokogiri.

Modify Maruku to use Nokogiri instead of REXML.
Produces a 3-fold speedup in the #to_html method.
This commit is contained in:
Jacques Distler 2011-08-11 20:36:44 -05:00
parent 46da1f3aaf
commit 13a522525c
369 changed files with 1703 additions and 16342 deletions

View file

@ -0,0 +1,45 @@
Write a comment here
*** Parameters: ***
require 'maruku/ext/math';{}
*** Markdown input: ***
$$ x = y $$
$$ x
= y $$
$$
x = y $$
$$ x = y
$$
*** 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 ***
<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 ***

View file

@ -0,0 +1,46 @@
*** Parameters: ***
require 'maruku/ext/math'; {}
*** Markdown input: ***
Here are some formulas:
* $\alpha$
* $x^{n}+y^{n} \neq z^{n}$
That's it, nothing else is supported.
*** Output of inspect ***
md_el(:document,[
md_par(["Here are some formulas:"]),
md_el(:ul,[
md_el(:li_span,[md_el(:inline_math,[],{:math=>"\\alpha"},[])],{:want_my_paragraph=>false},[]),
md_el(:li_span,[md_el(:inline_math,[],{:math=>"x^{n}+y^{n} \\neq z^{n}"},[])],{:want_my_paragraph=>false},[])
],{},[]),
md_par(["That", md_entity("rsquo"), "s it, nothing else is supported."])
],{},[])
*** Output of to_html ***
<p>Here are some formulas:</p>
<ul>
<li><code class='maruku-mathml'>\alpha</code></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>
*** Output of to_latex ***
Here are some formulas:
\begin{itemize}%
\item $\alpha$
\item $x^{n}+y^{n} \neq z^{n}$
\end{itemize}
That'{}s it, nothing else is supported.
*** Output of to_md ***
Here are some formulas:
--
That s it, nothing else is supported.
*** Output of to_s ***
Here are some formulas:Thats it, nothing else is supported.

View file

@ -0,0 +1,45 @@
*** Parameters: ***
require 'maruku/ext/math'
{:math_numbered => ['\\['], :html_math_engine => 'itex2mml' }
*** Markdown input: ***
\[
\alpha
\]
\begin{equation}
\alpha
\end{equation}
\begin{equation} \beta
\end{equation}
\begin{equation} \gamma \end{equation}
*** 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 ***
<div class="maruku-equation" id="eq:eq1"><span class="maruku-eq-number">(1)</span><math xmlns="http://www.w3.org/1998/Math/MathML" display="block" class="maruku-mathml"><mi>&#x3B1;</mi></math><span class="maruku-eq-tex"><code style="display: none">\alpha</code></span></div><div class="maruku-equation"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block" class="maruku-mathml"><mi>&#x3B1;</mi></math><span class="maruku-eq-tex"><code style="display: none">\alpha</code></span></div><div class="maruku-equation"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block" class="maruku-mathml"><mi>&#x3B2;</mi></math><span class="maruku-eq-tex"><code style="display: none">\beta</code></span></div><div class="maruku-equation"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block" class="maruku-mathml"><mi>&#x3B3;</mi></math><span class="maruku-eq-tex"><code style="display: none">\gamma</code></span></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 ***

View file

@ -0,0 +1,25 @@
*** Parameters: ***
require 'maruku/ext/math'; {:math_enabled => false}
*** Markdown input: ***
This is not $math$.
\[ \alpha \]
*** Output of inspect ***
md_el(:document,[md_par(["This is not $math$."]), md_par(["[ \\alpha ]"])],{},[])
*** Output of to_html ***
<p>This is not $math$.</p>
<p>[ \alpha ]</p>
*** Output of to_latex ***
This is not \$math\$.
[ $\backslash$alpha ]
*** Output of to_md ***
This is not $math$.
[ \alpha ]
*** Output of to_s ***
This is not $math$.[ \alpha ]

View file

@ -0,0 +1,25 @@
Write a comment here
*** Parameters: ***
require 'maruku/ext/math';{:html_math_engine => 'itex2mml' }
*** Markdown input: ***
<table markdown='1'>
$\alpha$
<thead>
<td>$\beta$</td>
</thead>
</table>
*** Output of inspect ***
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><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline" class="maruku-mathml"><mi>&#x3B1;</mi></math><thead>
<td><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline" class="maruku-mathml"><mi>&#x3B2;</mi></math></td>
</thead>
</table>
*** Output of to_latex ***
*** Output of to_md ***
*** Output of to_s ***

View file

@ -0,0 +1,42 @@
Write a comment here
*** Parameters: ***
{}
*** Markdown input: ***
Symbol | Meaning | comments
------------|---------|---------
{:r} &alpha; | The first | I like it.
{:r} &aleph; | The first | I like it.
{:r: scope='row'}
*** Output of inspect ***
md_el(:document,[
md_el(:table,[
md_el(:head_cell,["Symbol"],{},[]),
md_el(:head_cell,["Meaning"],{},[]),
md_el(:head_cell,["comments"],{},[]),
md_el(:cell,[" ", md_entity("alpha")],{},[[:ref, "r"]]),
md_el(:cell,["The first"],{},[]),
md_el(:cell,["I like it."],{},[]),
md_el(:cell,[" ", md_entity("aleph")],{},[[:ref, "r"]]),
md_el(:cell,["The first"],{},[]),
md_el(:cell,["I like it."],{},[])
],{:align=>[:left, :left, :left]},[]),
md_el(:ald,[],{:ald=>[["scope", "row"]],:ald_id=>"r"},[])
],{},[])
*** Output of to_html ***
<table><thead><tr><th>Symbol</th><th>Meaning</th><th>comments</th></tr></thead><tbody><tr><th scope="row" style="text-align: left;"> &#945;</th><td style="text-align: left;">The first</td><td style="text-align: left;">I like it.</td>
</tr><tr><th scope="row" style="text-align: left;"> &aleph;</th><td style="text-align: left;">The first</td><td style="text-align: left;">I like it.</td>
</tr></tbody></table>
*** Output of to_latex ***
\begin{tabular}{l|l|l}
Symbol&Meaning&comments\\
\hline
$\alpha${}&The first&I like it.\\
&The first&I like it.\\
\end{tabular}
*** Output of to_md ***
SymbolMeaningcomments The firstI like it. The firstI like it.
*** Output of to_s ***
SymbolMeaningcomments The firstI like it. The firstI like it.