diff options
author | John MacFarlane <jgm@berkeley.edu> | 2011-03-02 11:18:38 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2011-03-02 12:47:17 -0800 |
commit | eebd77829cff9dc5b8003a330907f65d2efc73d5 (patch) | |
tree | 7682c12b9f8b474495e818a91367ccf845f5f2b4 /src | |
parent | 1ee0640c5275c9ee65e1eb6bdc57346dc24cd22d (diff) | |
download | pandoc-eebd77829cff9dc5b8003a330907f65d2efc73d5.tar.gz |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/Tests/Readers/Markdown.hs | 10 | ||||
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 4 |
2 files changed, 13 insertions, 1 deletions
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<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" -- [ 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 |