diff options
| author | Ben Gamari <ben@smart-cactus.org> | 2021-01-05 16:23:02 -0500 | 
|---|---|---|
| committer | Ben Gamari <ben@smart-cactus.org> | 2021-01-05 16:23:02 -0500 | 
| commit | 99f61534a470b84c424fde0835215de6a3b6d721 (patch) | |
| tree | 7152e5a53fe1c18e6fd5044d5aa3168ab99c3cc6 /haddock-api/src/Haddock/Backends/Xhtml.hs | |
| parent | 3e29ec51498dfe092b228889343dc8370ec0e64b (diff) | |
| parent | 1e56f63c3197e7ca1c1e506e083c2bad25d08793 (diff) | |
Merge commit '1e56f63c3197e7ca1c1e506e083c2bad25d08793' into ghc-9.0
Diffstat (limited to 'haddock-api/src/Haddock/Backends/Xhtml.hs')
| -rw-r--r-- | haddock-api/src/Haddock/Backends/Xhtml.hs | 15 | 
1 files changed, 13 insertions, 2 deletions
diff --git a/haddock-api/src/Haddock/Backends/Xhtml.hs b/haddock-api/src/Haddock/Backends/Xhtml.hs index 24b565fc..f8c22e0a 100644 --- a/haddock-api/src/Haddock/Backends/Xhtml.hs +++ b/haddock-api/src/Haddock/Backends/Xhtml.hs @@ -295,6 +295,10 @@ ppHtmlContents state odir doctitle _maybe_package            ]    createDirectoryIfMissing True odir    writeUtf8File (joinPath [odir, contentsHtmlFile]) (renderToString debug html) +  where +    -- Extract a module's short description. +    toInstalledDescription :: InstalledInterface -> Maybe (MDoc Name) +    toInstalledDescription = fmap mkMeta . hmi_description . instInfo  ppPrologue :: Maybe Package -> Qualification -> String -> Maybe (MDoc GHC.RdrName) -> Html @@ -304,6 +308,7 @@ ppPrologue pkg qual title (Just doc) =  ppSignatureTree :: Maybe Package -> Qualification -> [ModuleTree] -> Html +ppSignatureTree _ _ [] = mempty  ppSignatureTree pkg qual ts =    divModuleList << (sectionName << "Signatures" +++ mkNodeList pkg qual [] "n" ts) @@ -669,16 +674,22 @@ numberSectionHeadings = go 1    where go :: Int -> [ExportItem DocNameI] -> [ExportItem DocNameI]          go _ [] = []          go n (ExportGroup lev _ doc : es) -          = ExportGroup lev (show n) doc : go (n+1) es +          = case collectAnchors doc of +              [] -> ExportGroup lev (show n) doc : go (n+1) es +              (a:_) -> ExportGroup lev a doc : go (n+1) es          go n (other:es)            = other : go n es +        collectAnchors :: DocH (Wrap (ModuleName, OccName)) (Wrap DocName) -> [String] +        collectAnchors (DocAppend a b) = collectAnchors a ++ collectAnchors b +        collectAnchors (DocAName a) = [a] +        collectAnchors _ = []  processExport :: Bool -> LinksInfo -> Bool -> Maybe Package -> Qualification                -> ExportItem DocNameI -> Maybe Html  processExport _ _ _ _ _ ExportDecl { expItemDecl = L _ (InstD {}) } = Nothing -- Hide empty instances  processExport summary _ _ pkg qual (ExportGroup lev id0 doc) -  = nothingIf summary $ groupHeading lev id0 << docToHtml (Just id0) pkg qual (mkMeta doc) +  = nothingIf summary $ groupHeading lev id0 << docToHtmlNoAnchors (Just id0) pkg qual (mkMeta doc)  processExport summary links unicode pkg qual (ExportDecl decl pats doc subdocs insts fixities splice)    = processDecl summary $ ppDecl summary links decl pats doc insts fixities subdocs splice unicode pkg qual  processExport summary _ _ _ qual (ExportNoDecl y [])  | 
