[commit: haddock] master, wip/api-annots-ghc-7.10-3: Do not insert anchor for section headings in contents box (5d04e31)

git at git.haskell.org git at git.haskell.org
Wed Jul 8 08:38:24 UTC 2015


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

On branches: master,wip/api-annots-ghc-7.10-3
Link       : http://git.haskell.org/haddock.git/commitdiff/5d04e313cc52ecf88b0fd0b3d0d39ce6a8dc7406

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

commit 5d04e313cc52ecf88b0fd0b3d0d39ce6a8dc7406
Author: watashi <zejun.wu at gmail.com>
Date:   Sun Apr 26 16:35:28 2015 -0700

    Do not insert anchor for section headings in contents box


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

5d04e313cc52ecf88b0fd0b3d0d39ce6a8dc7406
 .gitignore                                         |  3 ++
 .../src/Haddock/Backends/Xhtml/DocMarkup.hs        |  5 ++-
 html-test/ref/{IgnoreExports.html => Bug387.html}  | 52 +++++++++++++---------
 html-test/src/Bug387.hs                            | 12 +++++
 4 files changed, 51 insertions(+), 21 deletions(-)

diff --git a/.gitignore b/.gitignore
index 6b8d26e..2d3f451 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,3 +12,6 @@
 /doc/configure
 tags
 TAGS
+
+.cabal-sandbox
+cabal.sandbox.config
diff --git a/haddock-api/src/Haddock/Backends/Xhtml/DocMarkup.hs b/haddock-api/src/Haddock/Backends/Xhtml/DocMarkup.hs
index e807eb9..c23f3f0 100644
--- a/haddock-api/src/Haddock/Backends/Xhtml/DocMarkup.hs
+++ b/haddock-api/src/Haddock/Backends/Xhtml/DocMarkup.hs
@@ -62,7 +62,10 @@ parHtmlMarkup qual insertAnchors ppId = Markup {
                                   then anchor ! [href url]
                                        << fromMaybe url mLabel
                                   else toHtml $ fromMaybe url mLabel,
-  markupAName                = \aname -> namedAnchor aname << "",
+  markupAName                = \aname
+                               -> if insertAnchors
+                                  then namedAnchor aname << ""
+                                  else noHtml,
   markupPic                  = \(Picture uri t) -> image ! ([src uri] ++ fromMaybe [] (return . title <$> t)),
   markupProperty             = pre . toHtml,
   markupExample              = examplesToHtml,
diff --git a/html-test/ref/IgnoreExports.html b/html-test/ref/Bug387.html
similarity index 73%
copy from html-test/ref/IgnoreExports.html
copy to html-test/ref/Bug387.html
index c257217..2d2009b 100644
--- a/html-test/ref/IgnoreExports.html
+++ b/html-test/ref/Bug387.html
@@ -3,13 +3,13 @@
 ><head
   ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
      /><title
-    >IgnoreExports</title
+    >Bug387</title
     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"
      /><script src="haddock-util.js" type="text/javascript"
     ></script
     ><script type="text/javascript"
     >//<![CDATA[
-window.onload = function () {pageLoad();setSynopsis("mini_IgnoreExports.html");};
+window.onload = function () {pageLoad();setSynopsis("mini_Bug387.html");};
 //]]>
 </script
     ></head
@@ -39,7 +39,21 @@ window.onload = function () {pageLoad();setSynopsis("mini_IgnoreExports.html");}
 	    ></tr
 	  ></table
 	><p class="caption"
-	>IgnoreExports</p
+	>Bug387</p
+	></div
+      ><div id="table-of-contents"
+      ><p class="caption"
+	>Contents</p
+	><ul
+	><li
+	  ><a href=""
+	    >Section1</a
+	    ></li
+	  ><li
+	  ><a href=""
+	    >Section2</a
+	    ></li
+	  ></ul
 	></div
       ><div id="synopsis"
       ><p id="control.syn" class="caption expander" onclick="toggleSection('syn')"
@@ -47,44 +61,42 @@ window.onload = function () {pageLoad();setSynopsis("mini_IgnoreExports.html");}
 	><ul id="section.syn" class="hide" onclick="toggleSection('syn')"
 	><li class="src short"
 	  ><a href=""
-	    >foo</a
+	    >test1</a
 	    > :: <a href=""
 	    >Int</a
 	    ></li
 	  ><li class="src short"
 	  ><a href=""
-	    >bar</a
+	    >test2</a
 	    > :: <a href=""
 	    >Int</a
 	    ></li
 	  ></ul
 	></div
       ><div id="interface"
-      ><h1
-	>Documentation</h1
+      ><h1 id="g:1"
+	>Section1<a name="a:section1"
+	  ></a
+	  ></h1
 	><div class="top"
 	><p class="src"
-	  ><a name="v:foo" class="def"
-	    >foo</a
+	  ><a name="v:test1" class="def"
+	    >test1</a
 	    > :: <a href=""
 	    >Int</a
 	    ></p
-	  ><div class="doc"
-	  ><p
-	    >documentation for foo</p
-	    ></div
 	  ></div
+	><h1 id="g:2"
+	>Section2<a name="a:section2"
+	  ></a
+	  ></h1
 	><div class="top"
 	><p class="src"
-	  ><a name="v:bar" class="def"
-	    >bar</a
+	  ><a name="v:test2" class="def"
+	    >test2</a
 	    > :: <a href=""
 	    >Int</a
 	    ></p
-	  ><div class="doc"
-	  ><p
-	    >documentation for bar</p
-	    ></div
 	  ></div
 	></div
       ></div
@@ -92,7 +104,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_IgnoreExports.html");}
     ><p
       >Produced by <a href=""
 	>Haddock</a
-	> version 2.15.0</p
+	> version 2.16.1</p
       ></div
     ></body
   ></html
diff --git a/html-test/src/Bug387.hs b/html-test/src/Bug387.hs
new file mode 100644
index 0000000..d9fed34
--- /dev/null
+++ b/html-test/src/Bug387.hs
@@ -0,0 +1,12 @@
+module Bug387
+  ( -- * Section1#a:section1#
+    test1
+    -- * Section2#a:section2#
+  , test2
+  ) where
+
+test1 :: Int
+test1 = 223
+
+test2 :: Int
+test2 = 42



More information about the ghc-commits mailing list