diff options
author | TG <tarik.graba@telecom-paristech.fr> | 2019-01-10 17:21:01 +0100 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2019-02-09 08:20:56 -0800 |
commit | 8fdeae2872d76e0d6cd996d595aa22d259074a91 (patch) | |
tree | 5c80cc075c4888ec13929f1ef2aae31846872a01 | |
parent | b8eeb0f4daeecdbed8ec077defd5114e731da06c (diff) | |
download | pandoc-8fdeae2872d76e0d6cd996d595aa22d259074a91.tar.gz |
AsciiDoc Writer: DisplayMath as asciidoc latexmath block
-rw-r--r-- | MANUAL.txt | 2 | ||||
-rw-r--r-- | src/Text/Pandoc/Writers/AsciiDoc.hs | 5 | ||||
-rw-r--r-- | test/writer.asciidoc | 6 |
3 files changed, 10 insertions, 3 deletions
diff --git a/MANUAL.txt b/MANUAL.txt index 5f5929974..8edd116a3 100644 --- a/MANUAL.txt +++ b/MANUAL.txt @@ -3513,7 +3513,7 @@ reStructuredText ~ It will be rendered using an [interpreted text role `:math:`]. AsciiDoc - ~ It will be rendered as `latexmath:[...]`. + ~ It will be rendered as `latexmath:[...]` when inline and `[latexmath]++++....++++` when in display mode. Texinfo ~ It will be rendered inside a `@math` command. diff --git a/src/Text/Pandoc/Writers/AsciiDoc.hs b/src/Text/Pandoc/Writers/AsciiDoc.hs index 7b417af47..c156a1908 100644 --- a/src/Text/Pandoc/Writers/AsciiDoc.hs +++ b/src/Text/Pandoc/Writers/AsciiDoc.hs @@ -414,7 +414,10 @@ inlineToAsciiDoc _ (Str str) = return $ text $ escapeString str inlineToAsciiDoc _ (Math InlineMath str) = return $ "latexmath:[$" <> text str <> "$]" inlineToAsciiDoc _ (Math DisplayMath str) = - return $ "latexmath:[\\[" <> text str <> "\\]]" + return $ + blankline <> "[latexmath]" $$ "++++" $$ + "\\[" <> text str <> "\\]" + $$ "++++" $$ blankline inlineToAsciiDoc _ il@(RawInline f s) | f == "asciidoc" = return $ text s | otherwise = do diff --git a/test/writer.asciidoc b/test/writer.asciidoc index 7d8d74aa6..2a162a81e 100644 --- a/test/writer.asciidoc +++ b/test/writer.asciidoc @@ -466,7 +466,11 @@ Ellipses…and…and…. * latexmath:[$223$] * latexmath:[$p$]-Tree * Here’s some display math: -latexmath:[\[\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}\]] + +[latexmath] +++++ +\[\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: latexmath:[$\alpha + \omega \times x^2$]. |