From 1a7ccb86bb10ebc44e17c90ac5e27e7783958a22 Mon Sep 17 00:00:00 2001 From: simonmar Date: Wed, 5 Nov 2003 17:16:05 +0000 Subject: [haddock @ 2003-11-05 17:16:04 by simonmar] Support for generating a single unified index for several packages. --use-index=URL turns off normal index generation, causes Index links to point to URL. --gen-index generates an combined index from the specified interfaces. Currently doesn't work exactly right, because the interfaces don't contain the iface_reexported info. I'll need to fix that up. --- src/Main.hs | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'src/Main.hs') diff --git a/src/Main.hs b/src/Main.hs index c6afd9d3..f3ccde26 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -80,6 +80,8 @@ data Flag | Flag_Help | Flag_Verbose | Flag_Version + | Flag_UseIndex String + | Flag_GenIndex deriving (Eq) options :: [OptDescr Flag] @@ -116,7 +118,11 @@ options = Option ['V'] ["version"] (NoArg Flag_Version) "output version information and exit", Option ['v'] ["verbose"] (NoArg Flag_Verbose) - "increase verbosity" + "increase verbosity", + Option [] ["use-index"] (ReqArg Flag_UseIndex "URL") + "use a separately-generated HTML index", + Option [] ["gen-index"] (NoArg Flag_GenIndex) + "generate an HTML index from specified interfaces" ] saved_flags :: IORef [Flag] @@ -161,12 +167,25 @@ run flags files = do no_implicit_prelude = Flag_NoImplicitPrelude `elem` flags verbose = Flag_Verbose `elem` flags + maybe_index_url = + case [url | Flag_UseIndex url <- flags] of + [] -> Nothing + us -> Just (last us) + prologue <- getPrologue flags read_ifaces_s <- mapM readIface (map snd ifaces_to_read) updateHTMLXRefs (map fst ifaces_to_read) read_ifaces_s + if Flag_GenIndex `elem` flags + then do + when (not (null files)) $ + die ("--gen-index: expected no additional file arguments") + ppHtmlIndex odir title (concat read_ifaces_s) + copyHtmlBits odir libdir css_file + else do + writeIORef saved_flags flags parsed_mods <- mapM parse_file files @@ -204,9 +223,10 @@ run flags files = do fmToList (iface_sub i)) | (mdl, i) <- these_mod_ifaces ]) - when (Flag_Html `elem` flags) $ - ppHtml title source_url these_mod_ifaces odir css_file - libdir prologue (Flag_MSHtmlHelp `elem` flags) + when (Flag_Html `elem` flags) $ do + ppHtml title source_url these_mod_ifaces odir + prologue (Flag_MSHtmlHelp `elem` flags) maybe_index_url + copyHtmlBits odir libdir css_file -- dump an interface if requested case dump_iface of -- cgit v1.2.3