From eebd77829cff9dc5b8003a330907f65d2efc73d5 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Wed, 2 Mar 2011 11:18:38 -0800 Subject: Markdown+lhs reader: Require space after inverse bird tracks. The point of the change is to allow html tags to be used freely at the left margin of a markdown+lhs document. Thanks to Conal Elliot for the suggestion. --- src/Tests/Readers/Markdown.hs | 10 ++++++++++ src/Text/Pandoc/Readers/Markdown.hs | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Tests/Readers/Markdown.hs b/src/Tests/Readers/Markdown.hs index feec8fa65..9f393ac96 100644 --- a/src/Tests/Readers/Markdown.hs +++ b/src/Tests/Readers/Markdown.hs @@ -48,6 +48,16 @@ tests = [ testGroup "inline code" "[^1]\n\n[^1]: my note\n \n in note\n" =?> para (note (para "my note" +++ para "in note")) ] + , testGroup "lhs" + [ test (readMarkdown defaultParserState{stateLiterateHaskell = True}) + "inverse bird tracks and html" $ + "> a\n\n< b\n\n
\n" + =?> codeBlockWith ("",["sourceCode","literate","haskell"],[]) "a" + +++ + codeBlockWith ("",["sourceCode","haskell"],[]) "b" + +++ + rawBlock "html" "
\n\n" + ] -- the round-trip properties frequently fail -- , testGroup "round trip" -- [ property "p_markdown_round_trip" p_markdown_round_trip diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index 01cc5e2e8..d284fb25e 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -471,8 +471,10 @@ lhsCodeBlockBirdWith c = try $ do return $ intercalate "\n" lns' birdTrackLine :: Char -> GenParser Char st [Char] -birdTrackLine c = do +birdTrackLine c = try $ do char c + -- allow html tags on left margin: + when (c == '<') $ notFollowedBy letter manyTill anyChar newline -- cgit v1.2.3