aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/src/Haddock/Backends/Xhtml.hs
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@cs.stanford.edu>2017-03-13 03:13:10 -0700
committerEdward Z. Yang <ezyang@cs.stanford.edu>2017-03-15 22:50:46 -0700
commit2067a2d0afa9cef381d26fb7140b67c62f433fc0 (patch)
treeb898484dbe7bbdc61ab10f9e9ca32921396ee1e7 /haddock-api/src/Haddock/Backends/Xhtml.hs
parent930cfbe58e2e87f5a4d431d89a3c204934e6e858 (diff)
Render signature module tree separately from modules.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Diffstat (limited to 'haddock-api/src/Haddock/Backends/Xhtml.hs')
-rw-r--r--haddock-api/src/Haddock/Backends/Xhtml.hs17
1 files changed, 16 insertions, 1 deletions
diff --git a/haddock-api/src/Haddock/Backends/Xhtml.hs b/haddock-api/src/Haddock/Backends/Xhtml.hs
index 9fd55e49..520dafcb 100644
--- a/haddock-api/src/Haddock/Backends/Xhtml.hs
+++ b/haddock-api/src/Haddock/Backends/Xhtml.hs
@@ -256,13 +256,20 @@ ppHtmlContents dflags odir doctitle _maybe_package
themes mathjax_url maybe_index_url
maybe_source_url maybe_wiki_url ifaces showPkgs prologue debug qual = do
let tree = mkModuleTree dflags showPkgs
- [(instMod iface, toInstalledDescription iface) | iface <- ifaces]
+ [(instMod iface, toInstalledDescription iface)
+ | iface <- ifaces
+ , not (instIsSig iface)]
+ sig_tree = mkModuleTree dflags showPkgs
+ [(instMod iface, toInstalledDescription iface)
+ | iface <- ifaces
+ , instIsSig iface]
html =
headHtml doctitle Nothing themes mathjax_url +++
bodyHtml doctitle Nothing
maybe_source_url maybe_wiki_url
Nothing maybe_index_url << [
ppPrologue qual doctitle prologue,
+ ppSignatureTree qual sig_tree,
ppModuleTree qual tree
]
createDirectoryIfMissing True odir
@@ -278,7 +285,13 @@ ppPrologue qual title (Just doc) =
divDescription << (h1 << title +++ docElement thediv (rdrDocToHtml qual doc))
+ppSignatureTree :: Qualification -> [ModuleTree] -> Html
+ppSignatureTree qual ts =
+ divModuleList << (sectionName << "Signatures" +++ mkNodeList qual [] "n" ts)
+
+
ppModuleTree :: Qualification -> [ModuleTree] -> Html
+ppModuleTree _ [] = mempty
ppModuleTree qual ts =
divModuleList << (sectionName << "Modules" +++ mkNodeList qual [] "n" ts)
@@ -345,6 +358,8 @@ flatModuleTree ifaces =
ppHtmlContentsFrame :: FilePath -> String -> Themes -> Maybe String
-> [InstalledInterface] -> Bool -> IO ()
ppHtmlContentsFrame odir doctitle themes maybe_mathjax_url ifaces debug = do
+ -- TODO: Arguably should split up signatures and modules here too...
+ -- but who uses frames? Fix this if someone complains. -- ezyang
let mods = flatModuleTree ifaces
html =
headHtml doctitle Nothing themes maybe_mathjax_url +++