aboutsummaryrefslogtreecommitdiff
path: root/src/Main.hs
diff options
context:
space:
mode:
authorsimonmar <unknown>2003-11-05 17:16:05 +0000
committersimonmar <unknown>2003-11-05 17:16:05 +0000
commit1a7ccb86bb10ebc44e17c90ac5e27e7783958a22 (patch)
tree8b9758909202fbafd7d8ffa710b4b00200a8ec93 /src/Main.hs
parent01a25ca67470a1066b9aa46a2fcc99a278c18937 (diff)
[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.
Diffstat (limited to 'src/Main.hs')
-rw-r--r--src/Main.hs28
1 files changed, 24 insertions, 4 deletions
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