From 64d30b1db8d571bc3b0d8947a81c59b4bd353417 Mon Sep 17 00:00:00 2001 From: krasimir Date: Fri, 30 Jul 2004 22:15:47 +0000 Subject: [haddock @ 2004-07-30 22:15:45 by krasimir] more stuffs - support for separated compilation of packages - the contents page now uses DHTML TreeView - fixed copyFile bug --- src/HaddockHH2.hs | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'src/HaddockHH2.hs') diff --git a/src/HaddockHH2.hs b/src/HaddockHH2.hs index 2fb673b9..df739384 100644 --- a/src/HaddockHH2.hs +++ b/src/HaddockHH2.hs @@ -12,16 +12,16 @@ import Data.List import Data.Char #endif +import Maybe ( fromMaybe ) import HaddockModuleTree import HaddockUtil import HaddockTypes -ppHH2Contents :: FilePath -> String -> [(Module,Interface)] -> IO () -ppHH2Contents odir package ifaces = do +ppHH2Contents :: FilePath -> Maybe String -> [ModuleTree] -> IO () +ppHH2Contents odir maybe_package tree = do let contentsHH2File = package++".HxT" - tree = mkModuleTree (map (\(mod,_) -> (mod,Nothing)) ifaces) --TODO: packages doc = text "" $$ text "" $$ @@ -30,6 +30,8 @@ ppHH2Contents odir package ifaces = do text "" writeFile (odir ++ pathSeparator:contentsHH2File) (render doc) where + package = fromMaybe "pkg" maybe_package + ppModuleTree :: [String] -> [ModuleTree] -> Doc ppModuleTree ss [x] = ppNode ss x ppModuleTree ss (x:xs) = ppNode ss x $$ ppModuleTree ss xs @@ -59,8 +61,8 @@ ppHH2Contents odir package ifaces = do ----------------------------------------------------------------------------------- -ppHH2Index :: FilePath -> String -> [(Module,Interface)] -> IO () -ppHH2Index odir package ifaces = do +ppHH2Index :: FilePath -> Maybe String -> [(Module,Interface)] -> IO () +ppHH2Index odir maybe_package ifaces = do let indexKHH2File = package++"K.HxK" indexNHH2File = package++"N.HxK" @@ -80,7 +82,9 @@ ppHH2Index odir package ifaces = do text "" writeFile (odir ++ pathSeparator:indexKHH2File) (render docK) writeFile (odir ++ pathSeparator:indexNHH2File) (render docN) - where + where + package = fromMaybe "pkg" maybe_package + index :: [(HsName, [Module])] index = fmToList (foldr getIfaceIndex emptyFM ifaces) @@ -103,8 +107,8 @@ ppHH2Index odir package ifaces = do ----------------------------------------------------------------------------------- -ppHH2Files :: FilePath -> String -> [(Module,Interface)] -> IO () -ppHH2Files odir package ifaces = do +ppHH2Files :: FilePath -> Maybe String -> [(Module,Interface)] -> IO () +ppHH2Files odir maybe_package ifaces = do let filesHH2File = package++".HxF" doc = text "" $$ @@ -114,14 +118,16 @@ ppHH2Files odir package ifaces = do text "text contentsHtmlFile<>text "\"/>" $$ text "text indexHtmlFile<>text "\"/>" $$ ppIndexFiles chars $$ - text "text cssFile <>text "\"/>") $$ + text "text cssFile <>text "\"/>" $$ text "text iconFile <>text "\"/>" $$ text "text jsFile <>text "\"/>" $$ text "text plusFile <>text "\"/>" $$ - text "text minusFile<>text "\"/>" $$ + text "text minusFile<>text "\"/>") $$ text "" writeFile (odir ++ pathSeparator:filesHH2File) (render doc) where + package = fromMaybe "pkg" maybe_package + ppMods [] = empty ppMods ((Module mdl,_):ifaces) = text " text (moduleHtmlFile "" mdl) <> text "\"/>" $$ @@ -140,15 +146,16 @@ ppHH2Files odir package ifaces = do ----------------------------------------------------------------------------------- -ppHH2Collection :: FilePath -> String -> [(Module,Interface)] -> IO () -ppHH2Collection odir package ifaces = do +ppHH2Collection :: FilePath -> String -> Maybe String -> IO () +ppHH2Collection odir doctitle maybe_package = do let + package = fromMaybe "pkg" maybe_package collectionHH2File = package++".HxC" doc = text "" $$ text "" $$ - text " text package <> text "\">" $$ + text " text doctitle <> text "\">" $$ nest 4 (text "" $$ nest 4 (text " text package <> text ".HxF\"/>") $$ text "" $$ -- cgit v1.2.3