2011-01-12 19:10:56 +01:00
|
|
|
module Tests.Readers.LaTeX (tests) where
|
2011-01-12 14:16:35 +01:00
|
|
|
|
|
|
|
import Text.Pandoc.Definition
|
|
|
|
import Test.Framework
|
2011-01-13 19:59:44 +01:00
|
|
|
import Tests.Helpers
|
2011-01-19 08:34:34 +01:00
|
|
|
import Text.Pandoc.Builder
|
|
|
|
import Text.Pandoc
|
|
|
|
|
|
|
|
latex :: String -> Pandoc
|
|
|
|
latex = readLaTeX defaultParserState{stateSmart = True}
|
2011-01-12 14:16:35 +01:00
|
|
|
|
|
|
|
tests :: [Test]
|
2011-01-13 20:11:55 +01:00
|
|
|
tests = [ testGroup "basic"
|
2011-01-19 08:34:34 +01:00
|
|
|
[ "simple" =:
|
|
|
|
latex "word" =?> str "wor d"
|
|
|
|
, "space" =:
|
|
|
|
latex "some text" =?> text "some text"
|
|
|
|
, "emphasized" =:
|
|
|
|
latex "\\emph{emphasized}" =?> (emph $ str "emphasized")
|
2011-01-13 20:11:55 +01:00
|
|
|
]
|
|
|
|
|
|
|
|
, testGroup "headers"
|
2011-01-19 08:34:34 +01:00
|
|
|
[ "level 1" =:
|
|
|
|
latex "\\section{header}" =?> header 1 (str "header")
|
|
|
|
, "level 2" =:
|
|
|
|
latex "\\subsection{header}" =?> header 2 (str "header")
|
|
|
|
, "level 3" =:
|
|
|
|
latex "\\subsubsection{header}" =?> header 3 (str "header")
|
|
|
|
, "emph" =:
|
|
|
|
latex "\\section{text \\emph{emph}}" =?>
|
|
|
|
header 1 (str "text2" +++ space +++ emph (str "emph"))
|
|
|
|
, "link" =:
|
|
|
|
latex "\\section{text \\href{/url}{link}}" =?>
|
|
|
|
header 1 (str "text" +++ space +++ link "/url" "" (str "link"))
|
2011-01-13 20:11:55 +01:00
|
|
|
]
|
2011-01-12 14:16:35 +01:00
|
|
|
]
|
|
|
|
|