diff options
Diffstat (limited to 'src/Tests/Readers/Markdown.hs')
-rw-r--r-- | src/Tests/Readers/Markdown.hs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/Tests/Readers/Markdown.hs b/src/Tests/Readers/Markdown.hs index feec8fa65..941762bd0 100644 --- a/src/Tests/Readers/Markdown.hs +++ b/src/Tests/Readers/Markdown.hs @@ -8,10 +8,14 @@ import Tests.Arbitrary() import Text.Pandoc.Builder -- import Text.Pandoc.Shared ( normalize ) import Text.Pandoc +import Data.Sequence (singleton) markdown :: String -> Pandoc markdown = readMarkdown defaultParserState{ stateStandalone = True } +markdownSmart :: String -> Pandoc +markdownSmart = readMarkdown defaultParserState{ stateSmart = True } + infix 5 =: (=:) :: ToString c => String -> (String, c) -> Test @@ -40,6 +44,22 @@ tests = [ testGroup "inline code" "`*` {.haskell .special x=\"7\"}" =?> para (codeWith ("",["haskell","special"],[("x","7")]) "*") ] + , testGroup "smart punctuation" + [ test markdownSmart "quote before ellipses" + ("'...hi'" + =?> para (singleQuoted (singleton Ellipses +++ "hi"))) + ] + , testGroup "mixed emphasis and strong" + [ "emph and strong emph alternating" =: + "*xxx* ***xxx*** xxx\n*xxx* ***xxx*** xxx" + =?> para (emph "xxx" +++ space +++ strong (emph "xxx") +++ + space +++ "xxx" +++ space +++ + emph "xxx" +++ space +++ strong (emph "xxx") +++ + space +++ "xxx") + , "emph with spaced strong" =: + "*x **xx** x*" + =?> para (emph ("x" +++ space +++ strong "xx" +++ space +++ "x")) + ] , testGroup "footnotes" [ "indent followed by newline and flush-left text" =: "[^1]\n\n[^1]: my note\n\n \nnot in note\n" @@ -47,6 +67,19 @@ tests = [ testGroup "inline code" , "indent followed by newline and indented text" =: "[^1]\n\n[^1]: my note\n \n in note\n" =?> para (note (para "my note" +++ para "in note")) + , "recursive note" =: + "[^1]\n\n[^1]: See [^1]\n" + =?> para (note (para "See [^1]")) + ] + , testGroup "lhs" + [ test (readMarkdown defaultParserState{stateLiterateHaskell = True}) + "inverse bird tracks and html" $ + "> a\n\n< b\n\n<div>\n" + =?> codeBlockWith ("",["sourceCode","literate","haskell"],[]) "a" + +++ + codeBlockWith ("",["sourceCode","haskell"],[]) "b" + +++ + rawBlock "html" "<div>\n\n" ] -- the round-trip properties frequently fail -- , testGroup "round trip" |