diff options
author | Vincent Berthoux <twinside@gmail.com> | 2015-01-21 23:11:12 +0100 |
---|---|---|
committer | Mateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk> | 2015-01-22 19:59:58 +0000 |
commit | 41e146b93456e5181df479952f066d747d8dcb83 (patch) | |
tree | b492be843ad65db79e628ac54ed166ad3f5ed28d /haddock-library | |
parent | 279a662adc83dba2e24bd0b99f7da9d63455f840 (diff) |
Filter '\r' from comments due to Windows problems.
On Windows this was causing newline to be rendered twice in code blocks.
Closes #359, fixes #356.
Diffstat (limited to 'haddock-library')
-rw-r--r-- | haddock-library/src/Documentation/Haddock/Parser.hs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/haddock-library/src/Documentation/Haddock/Parser.hs b/haddock-library/src/Documentation/Haddock/Parser.hs index b7ab85b0..5c607a1a 100644 --- a/haddock-library/src/Documentation/Haddock/Parser.hs +++ b/haddock-library/src/Documentation/Haddock/Parser.hs @@ -93,7 +93,8 @@ parseParas input = case parseParasState input of } parseParasState :: String -> (ParserState, DocH mod Identifier) -parseParasState = parse (p <* skipSpace) . encodeUtf8 . (++ "\n") +parseParasState = + parse (p <* skipSpace) . encodeUtf8 . (++ "\n") . filter (/= '\r') where p :: Parser (DocH mod Identifier) p = docConcat <$> paragraph `sepBy` many (skipHorizontalSpace *> "\n") @@ -105,7 +106,7 @@ parseParagraphs input = case parseParasState input of -- | Parse a text paragraph. Actually just a wrapper over 'parseStringBS' which -- drops leading whitespace and encodes the string to UTF8 first. parseString :: String -> DocH mod Identifier -parseString = parseStringBS . encodeUtf8 . dropWhile isSpace +parseString = parseStringBS . encodeUtf8 . dropWhile isSpace . filter (/= '\r') parseStringBS :: BS.ByteString -> DocH mod Identifier parseStringBS = snd . parse p |