From 3cd9016f5263741a38b904d1dad474abff8c2f3e Mon Sep 17 00:00:00 2001 From: David Waern Date: Sat, 10 Nov 2007 17:19:48 +0000 Subject: FIX: contents and index should include external package modules when --gen-contents/--gen-index --- src/Haddock/Backends/Html.hs | 4 ++-- src/Haddock/Types.hs | 4 ++-- src/Main.hs | 29 ++++++++++++++++++----------- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/Haddock/Backends/Html.hs b/src/Haddock/Backends/Html.hs index acd3dd93..a3c8470f 100644 --- a/src/Haddock/Backends/Html.hs +++ b/src/Haddock/Backends/Html.hs @@ -75,14 +75,14 @@ ppHtml doctitle maybe_package ifaces odir prologue maybe_html_help_format when (not (isJust maybe_contents_url)) $ ppHtmlContents odir doctitle maybe_package maybe_html_help_format maybe_index_url maybe_source_url maybe_wiki_url - (map toInstalledInterface visible_ifaces) + (map toInstalledIface visible_ifaces) False -- we don't want to display the packages in a single-package contents prologue when (not (isJust maybe_index_url)) $ ppHtmlIndex odir doctitle maybe_package maybe_html_help_format maybe_contents_url maybe_source_url maybe_wiki_url - (map toInstalledInterface visible_ifaces) + (map toInstalledIface visible_ifaces) when (not (isJust maybe_contents_url && isJust maybe_index_url)) $ ppHtmlHelpFiles doctitle maybe_package ifaces odir maybe_html_help_format [] diff --git a/src/Haddock/Types.hs b/src/Haddock/Types.hs index e1fd5b4a..e46ddf9e 100644 --- a/src/Haddock/Types.hs +++ b/src/Haddock/Types.hs @@ -170,8 +170,8 @@ data InstalledInterface = InstalledInterface { -- | Convert an 'Interface' to an 'InstalledInterface' -toInstalledInterface :: Interface -> InstalledInterface -toInstalledInterface interface = InstalledInterface { +toInstalledIface :: Interface -> InstalledInterface +toInstalledIface interface = InstalledInterface { instMod = ifaceMod interface, instInfo = ifaceInfo interface, instDocMap = ifaceRnDocMap interface, diff --git a/src/Main.hs b/src/Main.hs index 443466de..c342430b 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -121,10 +121,12 @@ main = handleTopExceptions $ do -- render the interfaces updateHTMLXRefs packages - render flags interfaces + let ifaceFiles = map fst packages + let installedIfaces = concatMap ifInstalledIfaces ifaceFiles + render flags interfaces installedIfaces -- last but not least, dump the interface file! - dumpInterfaceFile (map toInstalledInterface interfaces) homeLinks flags + dumpInterfaceFile (map toInstalledIface interfaces) homeLinks flags ------------------------------------------------------------------------------- @@ -133,8 +135,8 @@ main = handleTopExceptions $ do -- | Render the interfaces with whatever backend is specified in the flags -render :: [Flag] -> [Interface] -> IO () -render flags interfaces = do +render :: [Flag] -> [Interface] -> [InstalledInterface] -> IO () +render flags interfaces installedIfaces = do let title = case [str | Flag_Heading str <- flags] of [] -> "" @@ -181,27 +183,32 @@ render flags interfaces = do prologue <- getPrologue flags let - visibleMods = [ m | m <- interfaces, OptHide `notElem` (ifaceOptions m) ] - installedIfaces = map toInstalledInterface visibleMods - packageName = (Just . modulePkgStr . ifaceMod . head) visibleMods + -- visible home-module interfaces + visibleIfaces = [ m | m <- interfaces, OptHide `notElem` (ifaceOptions m) ] + + -- *all* visible interfaces including external package modules + allVisibleIfaces = map toInstalledIface visibleIfaces + ++ installedIfaces + + packageName = (Just . modulePkgStr . ifaceMod . head) visibleIfaces when (Flag_GenIndex `elem` flags) $ do ppHtmlIndex odir title packageName maybe_html_help_format maybe_contents_url maybe_source_urls maybe_wiki_urls - installedIfaces + allVisibleIfaces copyHtmlBits odir libdir css_file when (Flag_GenContents `elem` flags && Flag_GenIndex `elem` flags) $ do - ppHtmlHelpFiles title packageName visibleMods odir maybe_html_help_format [] + ppHtmlHelpFiles title packageName visibleIfaces odir maybe_html_help_format [] when (Flag_GenContents `elem` flags) $ do ppHtmlContents odir title packageName maybe_html_help_format maybe_index_url maybe_source_urls maybe_wiki_urls - installedIfaces True prologue + allVisibleIfaces True prologue copyHtmlBits odir libdir css_file when (Flag_Html `elem` flags) $ do - ppHtml title packageName visibleMods odir + ppHtml title packageName visibleIfaces odir prologue maybe_html_help_format maybe_source_urls maybe_wiki_urls maybe_contents_url maybe_index_url -- cgit v1.2.3