[commit: haddock] 2.17.3.1-spanfix, alexbiehl-patch-1, ghc-8.0, ghc-head, ghc-head1, headdock-library-1.4.5, ie_avails, master, pr-filter-maps, pr/cabal-desc, travis, v2.17, v2.17.3, v2.18, wip/new-tree-one-param, wip/rae, wip/remove-frames, wip/remove-frames1, wip/revert-ttg-2017-11-20, wip/ttg-2017-10-13, wip/ttg-2017-10-31, wip/ttg-2017-11-06, wip/ttg2-2017-11-10, wip/ttg3-2017-11-12, wip/ttg4-constraints-2017-11-13: Fix #280. Parsing of module header (f6e5d57)

git at git.haskell.org git at git.haskell.org
Mon Nov 20 21:02:17 UTC 2017


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

On branches: 2.17.3.1-spanfix,alexbiehl-patch-1,ghc-8.0,ghc-head,ghc-head1,headdock-library-1.4.5,ie_avails,master,pr-filter-maps,pr/cabal-desc,travis,v2.17,v2.17.3,v2.18,wip/new-tree-one-param,wip/rae,wip/remove-frames,wip/remove-frames1,wip/revert-ttg-2017-11-20,wip/ttg-2017-10-13,wip/ttg-2017-10-31,wip/ttg-2017-11-06,wip/ttg2-2017-11-10,wip/ttg3-2017-11-12,wip/ttg4-constraints-2017-11-13
Link       : http://git.haskell.org/haddock.git/commitdiff/f6e5d57bee5a7bf5d74d26982db64fa8a56f17bd

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

commit f6e5d57bee5a7bf5d74d26982db64fa8a56f17bd
Author: Sebastian Meric de Bellefon <Sebastian.MericdeBellefon at tritondigital.com>
Date:   Sun May 15 01:12:28 2016 -0400

    Fix #280. Parsing of module header
    
    The initial newlines were counted as indentation spaces, thus disturbing the parsing of next lines


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

f6e5d57bee5a7bf5d74d26982db64fa8a56f17bd
 .../src/Haddock/Interface/ParseModuleHeader.hs     |  2 +-
 .../ref/{DeprecatedModule.html => Bug280.html}     | 45 +++++++++++-----------
 html-test/src/Bug280.hs                            | 11 ++++++
 3 files changed, 35 insertions(+), 23 deletions(-)

diff --git a/haddock-api/src/Haddock/Interface/ParseModuleHeader.hs b/haddock-api/src/Haddock/Interface/ParseModuleHeader.hs
index e7d2a08..768a31c 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/DeprecatedModule.html b/html-test/ref/Bug280.html
similarity index 68%
copy from html-test/ref/DeprecatedModule.html
copy to html-test/ref/Bug280.html
index 0811319..f154f30 100644
--- a/html-test/ref/DeprecatedModule.html
+++ b/html-test/ref/Bug280.html
@@ -1,17 +1,18 @@
+<!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
-    >DeprecatedModule</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"
-    >//
-window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedModule.html");};
-//
+    >//<![CDATA[
+window.onload = function () {pageLoad();setSynopsis("mini_Bug280.html");};
+//]]>
 </script
     ></head
   ><body
@@ -27,47 +28,47 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedModule.
 	  ></li
 	></ul
       ><p class="caption empty"
-      ></p
+      > </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"
-	>DeprecatedModule</p
+	>Bug280</p
 	></div
       ><div id="description"
       ><p class="caption"
 	>Description</p
 	><div class="doc"
-	><div class="warning"
-	  ><p
-	    >Deprecated: Use <a href="#"
-	      >Foo</a
-	      > instead</p
-	    ></div
-	  ><p
-	  >Documentation for <a href="#"
-	    >DeprecatedModule</a
-	    >.</p
-	  ></div
+		><p
+		>The module description</p
+		></div
 	></div
       ><div id="interface"
       ><h1
 	>Documentation</h1
 	><div class="top"
 	><p class="src"
-	  ><a id="v:foo" class="def"
-	    >foo</a
-	    > :: <a href="#"
-	    >Int</a
-	    > <a href="#" class="selflink"
+	  ><a id="v:x" class="def"
+	    >x</a
+	    > :: [<a href="#"
+	    >Char</a
+	    >] <a href="#" class="selflink"
 	    >#</a
 	    ></p
 	  ></div
diff --git a/html-test/src/Bug280.hs b/html-test/src/Bug280.hs
new file mode 100644
index 0000000..ac27e2e
--- /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 = ""



More information about the ghc-commits mailing list