diff options
author | Neil Mitchell <unknown> | 2008-06-16 07:13:48 +0000 |
---|---|---|
committer | Neil Mitchell <unknown> | 2008-06-16 07:13:48 +0000 |
commit | 43004293124cd3082ced37c1af5864b735a5768a (patch) | |
tree | 37c18df3aac8f38ef7ef31304b9854d5f1847281 | |
parent | f8d50701d2abc8fa5e89cf5d02e97f090dc769ee (diff) |
Change Hoogle to take the package name and package version separately
-rw-r--r-- | src/Haddock/Backends/Hoogle.hs | 20 | ||||
-rw-r--r-- | src/Main.hs | 7 |
2 files changed, 17 insertions, 10 deletions
diff --git a/src/Haddock/Backends/Hoogle.hs b/src/Haddock/Backends/Hoogle.hs index 4c9c7c66..94109d82 100644 --- a/src/Haddock/Backends/Hoogle.hs +++ b/src/Haddock/Backends/Hoogle.hs @@ -25,14 +25,18 @@ import Data.Maybe import System.FilePath -prefix = ["-- Hoogle documentation, generated by Haddock", - "-- See Hoogle, http://www.haskell.org/hoogle/"] - - -ppHoogle :: Maybe String -> [Interface] -> FilePath -> IO () -ppHoogle maybe_package ifaces odir = do - let filename = (fromMaybe "main" maybe_package) <.> "txt" - contents = prefix ++ concat [ppModule i | i <- ifaces, OptHide `notElem` ifaceOptions i] +prefix = ["-- Hoogle documentation, generated by Haddock" + ,"-- See Hoogle, http://www.haskell.org/hoogle/" + ,""] + + +ppHoogle :: String -> String -> [Interface] -> FilePath -> IO () +ppHoogle package version ifaces odir = do + let filename = package <.> "txt" + contents = prefix ++ + ["@package " ++ package] ++ + ["@version " ++ version | version /= ""] ++ + concat [ppModule i | i <- ifaces, OptHide `notElem` ifaceOptions i] writeFile (odir </> filename) (unlines contents) diff --git a/src/Main.hs b/src/Main.hs index 48c92a73..958eda13 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -203,7 +203,10 @@ render flags interfaces installedIfaces = do allVisibleIfaces = map toInstalledIface visibleIfaces ++ installedIfaces - packageStr = (Just . modulePkgStr . ifaceMod . head) visibleIfaces + packageMod = ifaceMod (head visibleIfaces) + packageStr = Just (modulePkgStr packageMod) + (pkgName,pkgVer) = modulePkgInfo packageMod + when (Flag_GenIndex `elem` flags) $ do ppHtmlIndex odir title packageStr maybe_html_help_format @@ -228,7 +231,7 @@ render flags interfaces installedIfaces = do copyHtmlBits odir libdir css_file when (Flag_Hoogle `elem` flags) $ do - ppHoogle packageStr visibleIfaces odir + ppHoogle pkgName pkgVer visibleIfaces odir ------------------------------------------------------------------------------- -- Reading and dumping interface files |