[commit: haddock] 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.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: Copyright holders shown on several lines. Fix #279 (5a9c393)

git at git.haskell.org git at git.haskell.org
Mon Nov 20 21:03:33 UTC 2017


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

On branches: 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.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/5a9c393c8f0f6d24fa185f4acbb39e40a0f534a6

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

commit 5a9c393c8f0f6d24fa185f4acbb39e40a0f534a6
Author: Sebastian Meric de Bellefon <arnaudpourseb at gmail.com>
Date:   Thu Jun 16 00:46:46 2016 -0400

    Copyright holders shown on several lines. Fix #279


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

5a9c393c8f0f6d24fa185f4acbb39e40a0f534a6
 haddock-api/src/Haddock/Backends/Xhtml.hs | 18 ++++++++++++++----
 html-test/ref/Bug280.html                 |  8 ++++----
 html-test/ref/Test.html                   |  2 +-
 3 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/haddock-api/src/Haddock/Backends/Xhtml.hs b/haddock-api/src/Haddock/Backends/Xhtml.hs
index 8252839..0958c2c 100644
--- a/haddock-api/src/Haddock/Backends/Xhtml.hs
+++ b/haddock-api/src/Haddock/Backends/Xhtml.hs
@@ -35,8 +35,8 @@ import Text.XHtml hiding ( name, title, p, quote )
 import Haddock.GhcUtils
 
 import Control.Monad         ( when, unless )
-import Data.Char             ( toUpper )
-import Data.List             ( sortBy, intercalate, isPrefixOf )
+import Data.Char             ( toUpper, isSpace )
+import Data.List             ( sortBy, intercalate, isPrefixOf, intersperse )
 import Data.Maybe
 import System.FilePath hiding ( (</>) )
 import System.Directory
@@ -201,8 +201,7 @@ moduleInfo iface =
         field info >>= \a -> return (th << fieldName <-> td << a)
 
       entries :: [HtmlTable]
-      entries = mapMaybe doOneEntry [
-          ("Copyright",hmi_copyright),
+      entries = maybeToList copyrightsTable ++ mapMaybe doOneEntry [
           ("License",hmi_license),
           ("Maintainer",hmi_maintainer),
           ("Stability",hmi_stability),
@@ -216,6 +215,14 @@ moduleInfo iface =
             Just Haskell98 -> Just "Haskell98"
             Just Haskell2010 -> Just "Haskell2010"
 
+          multilineRow :: String -> [String] -> HtmlTable
+          multilineRow title xs = (th ! [valign "top"]) << title <-> td << (toLines xs)
+            where toLines = mconcat . intersperse br . map toHtml
+
+          copyrightsTable :: Maybe HtmlTable
+          copyrightsTable = fmap (multilineRow "Copyright" . split) (hmi_copyright info)
+            where split = map (trim . filter (/= ',')) . lines
+
           extsForm
             | OptShowExtensions `elem` ifaceOptions iface =
               let fs = map (dropOpt . show) (hmi_extensions info)
@@ -648,6 +655,9 @@ processDecl :: Bool -> Html -> Maybe Html
 processDecl True = Just
 processDecl False = Just . divTopDecl
 
+trim :: String -> String
+trim = f . f
+  where f = reverse . dropWhile isSpace
 
 processDeclOneLiner :: Bool -> Html -> Maybe Html
 processDeclOneLiner True = Just
diff --git a/html-test/ref/Bug280.html b/html-test/ref/Bug280.html
index f154f30..92eb61b 100644
--- a/html-test/ref/Bug280.html
+++ b/html-test/ref/Bug280.html
@@ -34,12 +34,12 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug280.html");};
     ><div id="module-header"
       ><table class="info"
 	><tr
-	  ><th
+	  ><th valign="top"
 	    >Copyright</th
 	    ><td
-	    >Foo,
-           Bar,
-           Baz</td
+	    >Foo<br
+         />Bar<br
+         />Baz</td
 	    ></tr
 	  ><tr
 	  ><th
diff --git a/html-test/ref/Test.html b/html-test/ref/Test.html
index e493af2..a98b222 100644
--- a/html-test/ref/Test.html
+++ b/html-test/ref/Test.html
@@ -33,7 +33,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");
     ><div id="module-header"
       ><table class="info"
 	><tr
-	  ><th
+	  ><th valign="top"
 	    >Copyright</th
 	    ><td
 	    >(c) Simon Marlow 2002</td



More information about the ghc-commits mailing list