From f53fb554fe0acf88d7c697236bbd1373e78f3d83 Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Wed, 13 Aug 2008 03:02:42 +0000 Subject: Support for display math; changed ASCIIMathML -> LaTeXMathML: Resolves Issue #47. + Added a DisplayMath/InlineMath selector to Math inlines. + Markdown parser yields DisplayMath for $$...$$. + LaTeX parser yields DisplayMath when appropriate. Removed mathBlock parsers, since the same effect is achieved by the math inline parsers, now that they handle display math. + Writers handle DisplayMath as appropriate for the format. + Changed -m option to use LaTeXMathML rather than ASCIIMathML. LaTeXMathML is closer to LaTeX in its display of math, and supports many non-math LaTeX environments. + Modified HTML writer to print raw TeX when LaTeXMathML is being used instead of suppressing it. + Removed ASCIIMathML files from data/ and added LaTeXMathML. + Replaced ASCIIMathML with LaTeXMathML in source files. + Modified README and pandoc man page source. + Modified web page. + Added --latexmathml option (kept --asciimathml as a synonym for backwards compatibility) + Modified tests accordingly; added new tests for display math. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1409 788f1e2b-df1e-0410-8736-df70ead52e1b --- tests/latex-reader.native | 14 +- tests/s5.fancy.html | 480 +++++++++++++++------------------------------- tests/s5.native | 2 +- tests/testsuite.native | 15 +- tests/testsuite.txt | 4 +- tests/writer.context | 5 +- tests/writer.docbook | 5 +- tests/writer.html | 4 +- tests/writer.latex | 5 +- tests/writer.man | 4 +- tests/writer.markdown | 4 +- tests/writer.mediawiki | 3 +- tests/writer.native | 15 +- tests/writer.opendocument | 5 +- tests/writer.rst | 4 +- tests/writer.rtf | 3 +- tests/writer.texinfo | 6 +- 17 files changed, 196 insertions(+), 382 deletions(-) (limited to 'tests') diff --git a/tests/latex-reader.native b/tests/latex-reader.native index 88756640f..42401cac2 100644 --- a/tests/latex-reader.native +++ b/tests/latex-reader.native @@ -274,13 +274,13 @@ Pandoc (Meta [Str "Pandoc",Space,Str "Test",Space,Str "Suite"] ["John MacFarlane , BulletList [ [ Para [TeX "\\cite[22-23]{smith.1899}"] ] , [ Para [TeX "\\doublespacing"] ] - , [ Para [Math "2+2=4"] ] - , [ Para [Math "x \\in y"] ] - , [ Para [Math "\\alpha \\wedge \\omega"] ] - , [ Para [Math "223"] ] - , [ Para [Math "p",Str "-",Str "Tree"] ] - , [ Para [Math "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"] ] - , [ Para [Str "Here",Apostrophe,Str "s",Space,Str "one",Space,Str "that",Space,Str "has",Space,Str "a",Space,Str "line",Space,Str "break",Space,Str "in",Space,Str "it:",Space,Math "\\alpha + \\omega \\times x^2",Str "."] ] ] + , [ Para [Math InlineMath "2+2=4"] ] + , [ Para [Math InlineMath "x \\in y"] ] + , [ Para [Math InlineMath "\\alpha \\wedge \\omega"] ] + , [ Para [Math InlineMath "223"] ] + , [ Para [Math InlineMath "p",Str "-",Str "Tree"] ] + , [ Para [Math InlineMath "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"] ] + , [ Para [Str "Here",Apostrophe,Str "s",Space,Str "one",Space,Str "that",Space,Str "has",Space,Str "a",Space,Str "line",Space,Str "break",Space,Str "in",Space,Str "it:",Space,Math InlineMath "\\alpha + \\omega \\times x^2",Str "."] ] ] , Para [Str "These",Space,Str "shouldn",Apostrophe,Str "t",Space,Str "be",Space,Str "math:"] , BulletList [ [ Para [Str "To",Space,Str "get",Space,Str "the",Space,Str "famous",Space,Str "equation,",Space,Str "write",Space,Code "$e = mc^2$",Str "."] ] diff --git a/tests/s5.fancy.html b/tests/s5.fancy.html index 486ef2ff5..e899b742e 100644 --- a/tests/s5.fancy.html +++ b/tests/s5.fancy.html @@ -9,151 +9,89 @@ /> +{window.onload=generic;}} diff --git a/tests/s5.native b/tests/s5.native index 5b6da6fcc..e314da12a 100644 --- a/tests/s5.native +++ b/tests/s5.native @@ -5,5 +5,5 @@ Pandoc (Meta [Str "My",Space,Str "S5",Space,Str "Document"] ["Sam Smith","Jen Jo , [ Plain [Str "second",Space,Str "bullet"] ] ] , Header 1 [Str "Math"] , BulletList - [ [ Plain [Math "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"] ] + [ [ Plain [Math InlineMath "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"] ] ] ] diff --git a/tests/testsuite.native b/tests/testsuite.native index 564faf0d8..875918b9e 100644 --- a/tests/testsuite.native +++ b/tests/testsuite.native @@ -282,14 +282,13 @@ Pandoc (Meta [Str "Pandoc",Space,Str "Test",Space,Str "Suite"] ["John MacFarlane , Header 1 [Str "LaTeX"] , BulletList [ [ Plain [TeX "\\cite[22-23]{smith.1899}"] ] - , [ Plain [TeX "\\doublespacing"] ] - , [ Plain [Math "2+2=4"] ] - , [ Plain [Math "x \\in y"] ] - , [ Plain [Math "\\alpha \\wedge \\omega"] ] - , [ Plain [Math "223"] ] - , [ Plain [Math "p",Str "-",Str "Tree"] ] - , [ Plain [Math "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"] ] - , [ Plain [Str "Here",Apostrophe,Str "s",Space,Str "one",Space,Str "that",Space,Str "has",Space,Str "a",Space,Str "line",Space,Str "break",Space,Str "in",Space,Str "it:",Space,Math "\\alpha + \\omega \\times x^2",Str "."] ] ] + , [ Plain [Math InlineMath "2+2=4"] ] + , [ Plain [Math InlineMath "x \\in y"] ] + , [ Plain [Math InlineMath "\\alpha \\wedge \\omega"] ] + , [ Plain [Math InlineMath "223"] ] + , [ Plain [Math InlineMath "p",Str "-",Str "Tree"] ] + , [ Plain [Str "Here",Apostrophe,Str "s",Space,Str "some",Space,Str "display",Space,Str "math:",Space,Math DisplayMath "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"] ] + , [ Plain [Str "Here",Apostrophe,Str "s",Space,Str "one",Space,Str "that",Space,Str "has",Space,Str "a",Space,Str "line",Space,Str "break",Space,Str "in",Space,Str "it:",Space,Math InlineMath "\\alpha + \\omega \\times x^2",Str "."] ] ] , Para [Str "These",Space,Str "shouldn",Apostrophe,Str "t",Space,Str "be",Space,Str "math:"] , BulletList [ [ Plain [Str "To",Space,Str "get",Space,Str "the",Space,Str "famous",Space,Str "equation,",Space,Str "write",Space,Code "$e = mc^2$",Str "."] ] diff --git a/tests/testsuite.txt b/tests/testsuite.txt index d55a93a4e..357739e08 100644 --- a/tests/testsuite.txt +++ b/tests/testsuite.txt @@ -467,13 +467,13 @@ Ellipses...and. . .and . . . . # LaTeX - \cite[22-23]{smith.1899} -- \doublespacing - $2+2=4$ - $x \in y$ - $\alpha \wedge \omega$ - $223$ - $p$-Tree -- $\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$ +- Here's some display math: + $$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$$ - Here's one that has a line break in it: $\alpha + \omega \times x^2$. diff --git a/tests/writer.context b/tests/writer.context index de0f36590..c5529a8df 100644 --- a/tests/writer.context +++ b/tests/writer.context @@ -629,8 +629,6 @@ Ellipses\ldots{}and\ldots{}and\ldots{}. \startitemize \item \cite[22-23]{smith.1899} -\item - \doublespacing \item $2+2=4$ \item @@ -642,7 +640,8 @@ Ellipses\ldots{}and\ldots{}and\ldots{}. \item $p$-Tree \item - $\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$ + Here's some display math: + \startformula \frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h} \stopformula \item Here's one that has a line break in it: $\alpha + \omega \times x^2$. diff --git a/tests/writer.docbook b/tests/writer.docbook index d2bcac18d..2371a2e1b 100644 --- a/tests/writer.docbook +++ b/tests/writer.docbook @@ -975,10 +975,6 @@ Blah - - - - 2+2=4 @@ -1006,6 +1002,7 @@ Blah + Here's some display math: \frac{d}{dx}f(x)=\limh → 0\frac{f(x+h)-f(x)}{h} diff --git a/tests/writer.html b/tests/writer.html index 8a4f62fee..d5f357423 100644 --- a/tests/writer.html +++ b/tests/writer.html @@ -718,8 +718,6 @@ Blah >LaTeX