From 9728087302a03143624d030642770f17be1eb097 Mon Sep 17 00:00:00 2001 From: krasimir Date: Tue, 9 Jul 2002 16:33:33 +0000 Subject: [haddock @ 2002-07-09 16:33:31 by krasimir] 'Microsoft HTML Help' support --- src/HaddockHtml.hs | 30 ++++-------------------------- 1 file changed, 4 insertions(+), 26 deletions(-) (limited to 'src/HaddockHtml.hs') diff --git a/src/HaddockHtml.hs b/src/HaddockHtml.hs index 209d9689..a503d50f 100644 --- a/src/HaddockHtml.hs +++ b/src/HaddockHtml.hs @@ -10,6 +10,8 @@ import Prelude hiding (div) import HaddockVersion import HaddockTypes import HaddockUtil +import HaddockModuleTree +import HaddockHH import HsSyn import IO @@ -69,12 +71,10 @@ ppHtml title source_url ifaces odir maybe_css libdir inst_maps prologue = do ppHtmlContents odir title source_url (map fst visible_ifaces) prologue ppHtmlIndex odir title visible_ifaces + ppHHContents odir (map fst visible_ifaces) + ppHHIndex odir visible_ifaces mapM_ (ppHtmlModule odir title source_url inst_maps) visible_ifaces -moduleHtmlFile :: FilePath -> String -> FilePath -moduleHtmlFile "" mod = mod ++ ".html" -- ToDo: Z-encode filename? -moduleHtmlFile dir mod = dir ++ pathSeparator : mod ++ ".html" - contentsHtmlFile = "index.html" indexHtmlFile = "doc-index.html" subIndexHtmlFile k a = "doc-index-" ++ k:a:".html" @@ -198,28 +198,6 @@ mkLeaf s ss True = anchor ! [href (moduleHtmlFile "" mod)] << toHtml s (s':ss') = reverse (s:ss) -- reconstruct the module name -data ModuleTree = Node String Bool [ModuleTree] - -mkModuleTree :: [Module] -> [ModuleTree] -mkModuleTree mods = foldr addToTrees [] (map splitModule mods) - -addToTrees :: [String] -> [ModuleTree] -> [ModuleTree] -addToTrees [] ts = ts -addToTrees ss [] = mkSubTree ss -addToTrees (s1:ss) (t@(Node s2 leaf subs) : ts) - | s1 > s2 = t : addToTrees (s1:ss) ts - | s1 == s2 = Node s2 (leaf || null ss) (addToTrees ss subs) : ts - | otherwise = mkSubTree (s1:ss) ++ t : ts - -mkSubTree [] = [] -mkSubTree (s:ss) = [Node s (null ss) (mkSubTree ss)] - -splitModule :: Module -> [String] -splitModule (Module mod) = split mod - where split mod = case break (== '.') mod of - (s1, '.':s2) -> s1 : split s2 - (s1, _) -> [s1] - -- --------------------------------------------------------------------------- -- Generate the index -- cgit v1.2.3