aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Méric de Bellefon <arnaudpourseb@gmail.com>2016-05-28 17:28:15 -0400
committerSebastian Méric de Bellefon <arnaudpourseb@gmail.com>2016-05-28 17:28:15 -0400
commitef0993f8905b88339202339789c0a6432e28da77 (patch)
treeca5eee062ba5a0907dd9a8533be7261be12cbfca
parentb0b23711fadb0ef2a7b0ade55286097bfa76e9ca (diff)
parentf6e5d57bee5a7bf5d74d26982db64fa8a56f17bd (diff)
Merge pull request #504 from Helkafen/issue-280
Fix #280. Parsing of module header
-rw-r--r--haddock-api/src/Haddock/Interface/ParseModuleHeader.hs2
-rw-r--r--html-test/ref/Bug280.html81
-rw-r--r--html-test/src/Bug280.hs11
3 files changed, 93 insertions, 1 deletions
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 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+><head
+ ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
+ /><title
+ >Bug280</title
+ ><link href="#" rel="stylesheet" type="text/css" title="Ocean"
+ /><script src="haddock-util.js" type="text/javascript"
+ ></script
+ ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"
+ ></script
+ ><script type="text/javascript"
+ >//<![CDATA[
+window.onload = function () {pageLoad();setSynopsis("mini_Bug280.html");};
+//]]>
+</script
+ ></head
+ ><body
+ ><div id="package-header"
+ ><ul class="links" id="page-menu"
+ ><li
+ ><a href="#"
+ >Contents</a
+ ></li
+ ><li
+ ><a href="#"
+ >Index</a
+ ></li
+ ></ul
+ ><p class="caption empty"
+ >&nbsp;</p
+ ></div
+ ><div id="content"
+ ><div id="module-header"
+ ><table class="info"
+ ><tr
+ ><th
+ >Copyright</th
+ ><td
+ >Foo,
+ Bar,
+ Baz</td
+ ></tr
+ ><tr
+ ><th
+ >Safe Haskell</th
+ ><td
+ >Safe</td
+ ></tr
+ ></table
+ ><p class="caption"
+ >Bug280</p
+ ></div
+ ><div id="description"
+ ><p class="caption"
+ >Description</p
+ ><div class="doc"
+ ><p
+ >The module description</p
+ ></div
+ ></div
+ ><div id="interface"
+ ><h1
+ >Documentation</h1
+ ><div class="top"
+ ><p class="src"
+ ><a id="v:x" class="def"
+ >x</a
+ > :: [<a href="#"
+ >Char</a
+ >] <a href="#" class="selflink"
+ >#</a
+ ></p
+ ></div
+ ></div
+ ></div
+ ><div id="footer"
+ ></div
+ ></body
+ ></html
+>
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 = ""