Skip to content
Snippets Groups Projects
Commit 7d2106e1 authored by Mateusz Kowalczyk's avatar Mateusz Kowalczyk Committed by Herbert Valerio Riedel
Browse files

Fix @ code blocks

In cases where we had some horizontal space before the closing ‘@’, the
parser would not accept the block as a code block and we'd get ugly
output.
parent cf73b006
No related branches found
No related tags found
5 merge requests!38Make --no-tmp-comp-dir the default,!37Adapt to latest xhtml version, various optimizations,!31Support HsToken in DataDecl and ClassDecl,!12Drop orphan instance when defined upstream.,!10Haddock interfaces produced from `.hi` files
...@@ -365,6 +365,7 @@ codeblock d = ...@@ -365,6 +365,7 @@ codeblock d =
where where
p isNewline c p isNewline c
| isNewline && c == '@' = Nothing | isNewline && c == '@' = Nothing
| isNewline && isSpace c = Just isNewline
| otherwise = Just $ c == '\n' | otherwise = Just $ c == '\n'
hyperlink :: Parser (Doc a) hyperlink :: Parser (Doc a)
......
...@@ -410,6 +410,14 @@ spec = before initStaticOpts $ do ...@@ -410,6 +410,14 @@ spec = before initStaticOpts $ do
, "@" , "@"
] `shouldParseTo` DocCodeBlock "foo\n@\nbar\n" ] `shouldParseTo` DocCodeBlock "foo\n@\nbar\n"
it "accepts horizontal space before the @" $ do
unlines [ " @"
, " foo"
, ""
, " bar"
, " @"
] `shouldParseTo` DocCodeBlock " foo\n\n bar\n "
it "accepts unicode" $ do it "accepts unicode" $ do
"@foo 灼眼のシャナ bar@" `shouldParseTo` DocCodeBlock "foo 灼眼のシャナ bar" "@foo 灼眼のシャナ bar@" `shouldParseTo` DocCodeBlock "foo 灼眼のシャナ bar"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment