Update to latest HTML5lib, Add Maruku testdir

Sync with the latest html5lib.
Having the Maruku unit tests on-hand may be useful for debugging; so let's include them.
This commit is contained in:
Jacques Distler 2008-01-08 00:01:35 -06:00
parent ebc409e1a0
commit 1085168bbf
337 changed files with 21290 additions and 72 deletions

View file

@ -0,0 +1,40 @@
body {
max-width: 36em;
}
div.maruku-equation {
display: block;
padding-top: 0.5em;
padding-bottom: 0.5em;
}
div.maruku-equation span.maruku-eq-number {
float: right;
padding-right: 2em;
}
div.maruku-equation div.maruku-eq-tex {
font-size: 70%;
float: left;
margin-top: -3em;
padding: .5em;
border: dashed 1px pink;
}
div.maruku-equation div.maruku-eq-tex:hover {
float: none;
display: block;
padding: 3em;
/*background-color: lightgray;*/
}
div.maruku-equation div.maruku-eq-tex code {
display: none;
background-color: #ffe;
padding: 1em;
}
div.maruku-equation div.maruku-eq-tex:hover code {
display: block !important;
}

View file

@ -0,0 +1,2 @@
%\def\text{\textrm}
\usepackage{amssymb,amsmath}

7
vendor/plugins/maruku/tests/math/run.sh vendored Executable file
View file

@ -0,0 +1,7 @@
#
ruby -I../../lib use_itex.rb < private.txt
# creates the pdf
ruby -I../../lib ../../bin/maruku --pdf private.txt

View file

@ -0,0 +1,46 @@
LaTeX preamble: preamble.tex
CSS: math.css
Here are some formulas:
* $\alpha$
* $x^{n}+y^{n} \neq z^{n}$
Some inline maths: $\sum_{n=1}^\infty \frac{(-1)^n}{n} = \ln 2$.
Some display maths:
\[ \sum_{n=1}^\infty \frac{1}{n} \]
\[ \sum_{n=1}^\infty \frac{1}{n} \text{ is divergent, but } \lim_{n \to \infty} \sum_{i=1}^n \frac{1}{i} - \ln n \text{ exists.} \] (a)
Some random AMSTeX symbols - thanks to Robin Snader for adding these:
$$ \beth \Subset \bigtriangleup \smallsmile \bumpeq \ggg \pitchfork $$
Note that $\hat g$ , $J$, and $\gamma_1\gamma_2$ all restrict to
$x_1 \overline{x_2} \oplus x_2 \overline{x_1}$ and that this module
is linear in $x_1$ and $x_2$.
See label \eqref{a}.
$$ \href{#hello}{\alpha+\beta} $$
## Cross references ##
The following are 4 equations, labeled A,B,C,D:
$$ \alpha $$ (A)
\[
\beta
\] (B)
$$ \gamma \label{C} $$
\[
\delta \label{D}
\]
You can now refer to (eq:A), (eq:B), \eqref{C}, \eqref{D}.

View file

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
"http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">
<html xmlns:svg='http://www.w3.org/2000/svg' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
<head><meta content='application/xhtml+xml;charset=utf-8' http-equiv='Content-type' /><title></title><link href='math.css' rel='stylesheet' type='text/css' /></head>
<body>
<p>Here are some formulas:</p>
<ul>
<li><math display='inline' xmlns='http://www.w3.org/1998/Math/MathML'><mi>&alpha;</mi></math></li>
<li><math display='inline' xmlns='http://www.w3.org/1998/Math/MathML'><msup><mi>x</mi> <mi>n</mi></msup><mo>+</mo><msup><mi>y</mi> <mi>n</mi></msup><mo>&ne;</mo><msup><mi>z</mi> <mi>n</mi></msup></math></li>
</ul>
<p>Some inline maths: <math display='inline' xmlns='http://www.w3.org/1998/Math/MathML'><msubsup><mo rspace='thinmathspace' lspace='thinmathspace'>&Sum;</mo> <mrow><mi>n</mi><mo>=</mo><mn>1 </mn></mrow> <mn>&infin;</mn></msubsup><mfrac><mrow><mo stretchy='false'>(</mo><mo rspace='0em' lspace='verythinmathspace'>&minus;</mo><mn>1 </mn><msup><mo stretchy='false'>)</mo> <mi>n</mi></msup></mrow><mi>n</mi></mfrac><mo>=</mo><mi>ln</mi><mn>2 </mn></math>.</p>
<p>Some display maths:</p>
<div class='maruku-equation'><math display='block' xmlns='http://www.w3.org/1998/Math/MathML'><munderover><mo rspace='thinmathspace' lspace='thinmathspace'>&Sum;</mo> <mrow><mi>n</mi><mo>=</mo><mn>1 </mn></mrow> <mn>&infin;</mn></munderover><mfrac><mn>1 </mn><mi>n</mi></mfrac></math><div class='maruku-eq-tex'><code style='display: none'> \sum_{n=1}^\infty \frac{1}{n} </code></div></div><div class='maruku-equation' id='eq:a'><span class='maruku-eq-number'>(1)</span><math display='block' xmlns='http://www.w3.org/1998/Math/MathML'><munderover><mo rspace='thinmathspace' lspace='thinmathspace'>&Sum;</mo> <mrow><mi>n</mi><mo>=</mo><mn>1 </mn></mrow> <mn>&infin;</mn></munderover><mfrac><mn>1 </mn><mi>n</mi></mfrac><mtext> is divergent, but </mtext><munder><mi>lim</mi> <mrow><mi>n</mi><mo>&rightarrow;</mo><mn>&infin;</mn></mrow></munder><munderover><mo rspace='thinmathspace' lspace='thinmathspace'>&Sum;</mo> <mrow><mi>i</mi><mo>=</mo><mn>1 </mn></mrow> <mi>n</mi></munderover><mfrac><mn>1 </mn><mi>i</mi></mfrac><mo>&minus;</mo><mi>ln</mi><mi>n</mi><mtext> exists.</mtext></math><div class='maruku-eq-tex'><code style='display: none'> \sum_{n=1}^\infty \frac{1}{n} \text{ is divergent, but } \lim_{n \to \infty} \sum_{i=1}^n \frac{1}{i} - \ln n \text{ exists.} </code></div></div>
<p>Some random AMSTeX symbols - thanks to Robin Snader for adding these:</p>
<div class='maruku-equation'><math display='block' xmlns='http://www.w3.org/1998/Math/MathML'><mi>&beth;</mi><mo>&Subset;</mo><mo>&bigtriangleup;</mo><mo rspace='thinmathspace' lspace='0em'>smallsmile</mo><mo>&bumpeq;</mo><mo>&ggg;</mo><mo>&pitchfork;</mo></math><div class='maruku-eq-tex'><code style='display: none'> \beth \Subset \bigtriangleup \smallsmile \bumpeq \ggg \pitchfork </code></div></div>
<p>Note that <math display='inline' xmlns='http://www.w3.org/1998/Math/MathML'><mover><mi>g</mi><mo stretchy='false'>&#x302;</mo></mover></math> , <math display='inline' xmlns='http://www.w3.org/1998/Math/MathML'><mi>J</mi></math>, and <math display='inline' xmlns='http://www.w3.org/1998/Math/MathML'><msub><mi>&gamma;</mi> <mn>1 </mn></msub><msub><mi>&gamma;</mi> <mn>2 </mn></msub></math> all restrict to</p>
<p><math display='inline' xmlns='http://www.w3.org/1998/Math/MathML'><msub><mi>x</mi> <mn>1 </mn></msub><mover><mrow><msub><mi>x</mi> <mn>2 </mn></msub></mrow><mo>&OverBar;</mo></mover><mo>&oplus;</mo><msub><mi>x</mi> <mn>2 </mn></msub><mover><mrow><msub><mi>x</mi> <mn>1 </mn></msub></mrow><mo>&OverBar;</mo></mover></math> and that this module is linear in <math display='inline' xmlns='http://www.w3.org/1998/Math/MathML'><msub><mi>x</mi> <mn>1 </mn></msub></math> and <math display='inline' xmlns='http://www.w3.org/1998/Math/MathML'><msub><mi>x</mi> <mn>2 </mn></msub></math>.</p>
<p>See label <a href='#eq:a' class='maruku-eqref'>(1)</a>.</p>
<div class='maruku-equation'><math display='block' xmlns='http://www.w3.org/1998/Math/MathML'><mrow xlink:href='#hello' xmlns:xlink='http://www.w3.org/1999/xlink' xlink:type='simple'><mrow><mi>&alpha;</mi><mo>+</mo><mi>&beta;</mi></mrow></mrow></math><div class='maruku-eq-tex'><code style='display: none'> \href{#hello}{\alpha+\beta} </code></div></div>
<h2 id='cross_references'>Cross references</h2>
<p>The following are 4 equations, labeled A,B,C,D:</p>
<div class='maruku-equation' id='eq:A'><span class='maruku-eq-number'>(2)</span><math 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' id='eq:B'><span class='maruku-eq-number'>(3)</span><math 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' id='eq:C'><span class='maruku-eq-number'>(4)</span><math 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:D'><span class='maruku-eq-number'>(5)</span><math display='block' xmlns='http://www.w3.org/1998/Math/MathML'><mi>&delta;</mi></math><div class='maruku-eq-tex'><code style='display: none'> \delta
</code></div></div>
<p>You can now refer to <a href='#eq:A' class='maruku-eqref'>(2)</a>, <a href='#eq:B' class='maruku-eqref'>(3)</a>, <a href='#eq:C' class='maruku-eqref'>(4)</a>, <a href='#eq:D' class='maruku-eqref'>(5)</a>.</p>
<div class='maruku_signature'><hr /><span style='font-size: small; font-style: italic'>Created by <a href='http://maruku.rubyforge.org' title='Maruku: a Markdown-superset interpreter for Ruby'>Maruku</a> at 21:13 on Sunday, January 14th, 2007.</span></div></body></html>

View file

@ -0,0 +1,34 @@
# run this as:
# ruby -I../../lib use_itex.rb < private.txt
require 'maruku'
module MaRuKu; module Out; module HTML
def to_html_inline_math_itex
# You can: either return a REXML::Element
# return Element.new 'div'
# or return an empty array on error
# return []
# or have a string parsed by REXML:
tex = self.math
tex.gsub!('&','&amp;')
mathml = "<code>#{tex}</code>"
return Document.new(mathml).root
end
def to_html_equation_itex
return to_html_inline_math_itex
end
end end end
MaRuKu::Globals[:html_math_engine] = 'itex'
doc = Maruku.new($stdin.read, {:on_error => :raise})
File.open('output.xhtml','w') do |f|
f.puts doc.to_html_document
end