aboutsummaryrefslogtreecommitdiff
path: root/src/Main.hs
diff options
context:
space:
mode:
authorsimonmar <unknown>2003-11-06 12:39:47 +0000
committersimonmar <unknown>2003-11-06 12:39:47 +0000
commit0a09c293d3d2294363a86f41bc74c3f5df123a08 (patch)
treef8e6cc8cc967de6d16d0be67390db1ed9504095d /src/Main.hs
parenta2bca16d0c180768949a8f30592bb072c907b965 (diff)
[haddock @ 2003-11-06 12:39:46 by simonmar]
- Add definition lists, marked up like this: -- | This is a definition list: -- -- [@foo@] The description of @foo@. -- -- [@bar@] The description of @bar@. Cunningly, the [] characters are not treated specially unless a [ is found at the beginning of a paragraph, in which case the ] becomes special in the following text. - Add --use-contents and --gen-contents, along the lines of --use-index and --gen-index added yesterday. Now we can generate a combined index and contents for the whole of the hierarchical libraries, and in theory the index/contents on the system could be updated as new packages are added.
Diffstat (limited to 'src/Main.hs')
-rw-r--r--src/Main.hs30
1 files changed, 22 insertions, 8 deletions
diff --git a/src/Main.hs b/src/Main.hs
index 25d6cc16..3d5f97b4 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -80,6 +80,8 @@ data Flag
| Flag_Help
| Flag_Verbose
| Flag_Version
+ | Flag_UseContents String
+ | Flag_GenContents
| Flag_UseIndex String
| Flag_GenIndex
deriving (Eq)
@@ -119,6 +121,10 @@ options =
"output version information and exit",
Option ['v'] ["verbose"] (NoArg Flag_Verbose)
"increase verbosity",
+ Option [] ["use-contents"] (ReqArg Flag_UseContents "URL")
+ "use a separately-generated HTML contents page",
+ Option [] ["gen-contents"] (NoArg Flag_GenContents)
+ "generate an HTML contents from specified interfaces",
Option [] ["use-index"] (ReqArg Flag_UseIndex "URL")
"use a separately-generated HTML index",
Option [] ["gen-index"] (NoArg Flag_GenIndex)
@@ -167,6 +173,11 @@ run flags files = do
no_implicit_prelude = Flag_NoImplicitPrelude `elem` flags
verbose = Flag_Verbose `elem` flags
+ maybe_contents_url =
+ case [url | Flag_UseContents url <- flags] of
+ [] -> Nothing
+ us -> Just (last us)
+
maybe_index_url =
case [url | Flag_UseIndex url <- flags] of
[] -> Nothing
@@ -178,15 +189,17 @@ run flags files = do
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)
+ writeIORef saved_flags flags
+
+ when (Flag_GenContents `elem` flags) $ do
+ ppHtmlContents odir title maybe_index_url
+ (map fst (concat read_ifaces_s)) prologue
+ copyHtmlBits odir libdir css_file
+
+ when (Flag_GenIndex `elem` flags) $ do
+ ppHtmlIndex odir title maybe_contents_url (concat read_ifaces_s)
copyHtmlBits odir libdir css_file
- else do
- writeIORef saved_flags flags
parsed_mods <- mapM parse_file files
let read_ifaces = concat read_ifaces_s
@@ -225,7 +238,8 @@ run flags files = do
when (Flag_Html `elem` flags) $ do
ppHtml title source_url these_mod_ifaces odir
- prologue (Flag_MSHtmlHelp `elem` flags) maybe_index_url
+ prologue (Flag_MSHtmlHelp `elem` flags)
+ maybe_contents_url maybe_index_url
copyHtmlBits odir libdir css_file
-- dump an interface if requested