diff options
author | Albert Krewinkel <albert@zeitkraut.de> | 2020-06-25 20:04:09 +0200 |
---|---|---|
committer | Albert Krewinkel <albert@zeitkraut.de> | 2020-06-25 20:31:33 +0200 |
commit | 9e6e9a72218e8c408e151bf8b169f44a8c55eb40 (patch) | |
tree | f23a3fbe465857e9d257aa8c092cc126236452dc /test | |
parent | f1c678a97eef702bf37ddfdf5af977b4ba5b02a6 (diff) | |
download | pandoc-9e6e9a72218e8c408e151bf8b169f44a8c55eb40.tar.gz |
Org reader: honor tex export option
The `tex` export option can be set with `#+OPTION: tex:nil` and allows
three settings:
- `t` causes LaTeX fragments to be parsed as TeX or added as raw TeX,
- `nil` removes all LaTeX fragments from the document, and
- `verbatim` treats LaTeX as text.
The default is `t`.
Closes: #4070
Diffstat (limited to 'test')
-rw-r--r-- | test/Tests/Readers/Org/Directive.hs | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/test/Tests/Readers/Org/Directive.hs b/test/Tests/Readers/Org/Directive.hs index 79e09ea1c..9e571473b 100644 --- a/test/Tests/Readers/Org/Directive.hs +++ b/test/Tests/Readers/Org/Directive.hs @@ -162,6 +162,79 @@ tests = ] =?> headerWith ("headline", [], mempty) 1 "Headline" + , testGroup "LaTeX" + [ testGroup "Include LaTeX fragments" + [ "Inline command" =: + T.unlines [ "#+OPTIONS: tex:t" + , "Hello \\emph{Name}" + ] =?> + para ("Hello" <> space <> emph "Name") + + , "Alpha" =: + T.unlines [ "#+OPTIONS: tex:t" + , "\\alpha" + ] =?> + para "α" + + , "equation environment" =: + T.unlines [ "#+OPTIONS: tex:t" + , "\\begin{equation}" + , "f(x) = x^2" + , "\\end{equation}" + ] =?> + rawBlock "latex" (T.unlines [ "\\begin{equation}" + , "f(x) = x^2" + , "\\end{equation}" + ]) + ] + + , testGroup "Ignore LaTeX fragments" + [ "Inline command" =: + T.unlines [ "#+OPTIONS: tex:nil" + , "Hello \\emph{Emphasised}" + ] =?> + para "Hello" + + , "MathML symbol (alpha)" =: + T.unlines [ "#+OPTIONS: tex:nil" + , "\\alpha" + ] =?> + para "α" + + , "equation environment" =: + T.unlines [ "#+OPTIONS: tex:nil" + , "\\begin{equation}" + , "f(x) = x^2" + , "\\end{equation}" + ] =?> + (mempty :: Blocks) + ] + + , testGroup "Verbatim LaTeX" + [ "Inline command" =: + T.unlines [ "#+OPTIONS: tex:verbatim" + , "Hello \\emph{Emphasised}" + ] =?> + para "Hello \\emph{Emphasised}" + + , "MathML symbol (alpha)" =: + T.unlines [ "#+OPTIONS: tex:verbatim" + , "\\alpha" + ] =?> + para "α" + + , "equation environment" =: + T.unlines [ "#+OPTIONS: tex:verbatim" + , "\\begin{equation}" + , "f(x) = x^2" + , "\\end{equation}" + ] =?> + para (str "\\begin{equation}" <> softbreak <> + str "f(x) = x^2" <> softbreak <> + str "\\end{equation}") + ] + ] + , testGroup "planning information" [ "include planning info after headlines" =: T.unlines [ "#+OPTIONS: p:t" |