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.
This commit is contained in:
John MacFarlane 2011-03-02 11:18:38 -08:00
parent 1ee0640c52
commit eebd77829c
2 changed files with 13 additions and 1 deletions

View file

@ -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

View file

@ -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