diff options
| author | Sebastian Méric de Bellefon <arnaudpourseb@gmail.com> | 2016-06-18 23:57:20 -0400 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-06-18 23:57:20 -0400 | 
| commit | 1cb73d6afaa2438dc67fa70fd3a8c64ba68343a0 (patch) | |
| tree | ed089f4dcaa2f73cace16cf0e0c63fbb9d86fb53 /haddock-api/src | |
| parent | 60f90cd279af21f9d1493cb089309b67ff513146 (diff) | |
| parent | 5a9c393c8f0f6d24fa185f4acbb39e40a0f534a6 (diff) | |
Merge pull request #533 from Helkafen/master
Copyright holders shown on several lines. Fix #279
Diffstat (limited to 'haddock-api/src')
| -rw-r--r-- | haddock-api/src/Haddock/Backends/Xhtml.hs | 18 | 
1 files changed, 14 insertions, 4 deletions
diff --git a/haddock-api/src/Haddock/Backends/Xhtml.hs b/haddock-api/src/Haddock/Backends/Xhtml.hs index 8252839c..0958c2cd 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  | 
