[commit: haddock] master, wip/api-annot-tweaks-7.10, wip/api-annots-ghc-7.10-3: Filter '\r' from comments due to Windows problems. (41e146b)

git at git.haskell.org git at git.haskell.org
Wed Jul 8 08:37:22 UTC 2015


Repository : ssh://git@git.haskell.org/haddock

On branches: master,wip/api-annot-tweaks-7.10,wip/api-annots-ghc-7.10-3
Link       : http://git.haskell.org/haddock.git/commitdiff/41e146b93456e5181df479952f066d747d8dcb83

>---------------------------------------------------------------

commit 41e146b93456e5181df479952f066d747d8dcb83
Author: Vincent Berthoux <twinside at gmail.com>
Date:   Wed Jan 21 23:11:12 2015 +0100

    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.


>---------------------------------------------------------------

41e146b93456e5181df479952f066d747d8dcb83
 haddock-library/src/Documentation/Haddock/Parser.hs | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/haddock-library/src/Documentation/Haddock/Parser.hs b/haddock-library/src/Documentation/Haddock/Parser.hs
index b7ab85b..5c607a1 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



More information about the ghc-commits mailing list