From f6e5d57bee5a7bf5d74d26982db64fa8a56f17bd Mon Sep 17 00:00:00 2001 From: Sebastian Meric de Bellefon Date: Sun, 15 May 2016 01:12:28 -0400 Subject: Fix #280. Parsing of module header The initial newlines were counted as indentation spaces, thus disturbing the parsing of next lines --- .../src/Haddock/Interface/ParseModuleHeader.hs | 2 +- html-test/ref/Bug280.html | 81 ++++++++++++++++++++++ html-test/src/Bug280.hs | 11 +++ 3 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 html-test/ref/Bug280.html create mode 100644 html-test/src/Bug280.hs diff --git a/haddock-api/src/Haddock/Interface/ParseModuleHeader.hs b/haddock-api/src/Haddock/Interface/ParseModuleHeader.hs index e7d2a085..768a31ce 100644 --- a/haddock-api/src/Haddock/Interface/ParseModuleHeader.hs +++ b/haddock-api/src/Haddock/Interface/ParseModuleHeader.hs @@ -76,7 +76,7 @@ parseKey :: String -> String -> Maybe (String,String) parseKey key toParse0 = do let - (spaces0,toParse1) = extractLeadingSpaces toParse0 + (spaces0,toParse1) = extractLeadingSpaces (dropWhile (`elem` ['\r', '\n']) toParse0) indentation = spaces0 afterKey0 <- extractPrefix key toParse1 diff --git a/html-test/ref/Bug280.html b/html-test/ref/Bug280.html new file mode 100644 index 00000000..f154f300 --- /dev/null +++ b/html-test/ref/Bug280.html @@ -0,0 +1,81 @@ + +Bug280

 

CopyrightFoo, + Bar, + Baz
Safe HaskellSafe

Bug280

Description

The module description

Documentation

x :: [Char] #

diff --git a/html-test/src/Bug280.hs b/html-test/src/Bug280.hs new file mode 100644 index 00000000..ac27e2e5 --- /dev/null +++ b/html-test/src/Bug280.hs @@ -0,0 +1,11 @@ +{-| +Copyright: Foo, + Bar, + Baz + +The module description +-} +-- The module header can start with newlines. They are not taken into account for the indentation level +module Bug280 where + +x = "" -- cgit v1.2.3