aboutsummaryrefslogtreecommitdiff
path: root/src/HaddockHtml.hs
diff options
context:
space:
mode:
authorsimonmar <unknown>2002-05-08 11:21:56 +0000
committersimonmar <unknown>2002-05-08 11:21:56 +0000
commit1283a3c195ed226fc6d1c84a25de1d42d556cfad (patch)
tree75a32fa4aacf1f3eda3ab912dd71ea58961178e4 /src/HaddockHtml.hs
parentadc8107866e9371b7b20e4e3985f9eca2e8ba52c (diff)
[haddock @ 2002-05-08 11:21:56 by simonmar]
Add a facility for specifying options that affect Haddock's treatment of the module. Options are given at the top of the module in a comma-separated list, beginning with '-- #'. eg. -- # prune, hide, ignore-exports Options currently available, with their meanings: prune: ignore declarations which have no documentation annotations ignore-exports: act as if the export list were not specified (i.e. export everything local to the module). hide: do not include this module in the generated documentation, but propagate any exported definitions to modules which re-export them. There's a slight change in the semantics for re-exporting a full module by giving 'module M' in the export list: if module M does not have the 'hide' option, then the documentation will now just contain a reference to module M rather than the full inlined contents of that module. These features, and some other changes in the pipeline, are the result of discussions between myself and Manuel Chakravarty <chak@cse.unsw.edu.au> (author of IDoc) yesterday. Also: some cleanups, use a Writer monad to collect error messages in some places instead of just printing them with trace.
Diffstat (limited to 'src/HaddockHtml.hs')
-rw-r--r--src/HaddockHtml.hs14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/HaddockHtml.hs b/src/HaddockHtml.hs
index 5059070e..7d7700a4 100644
--- a/src/HaddockHtml.hs
+++ b/src/HaddockHtml.hs
@@ -48,14 +48,17 @@ ppHtml title source_url ifaces odir maybe_css libdir = do
icon_file = libdir ++ pathSeparator:iconFile
icon_destination = odir ++ pathSeparator:iconFile
+ visible_ifaces = filter visible ifaces
+ visible (m,i) = OptHide `notElem` iface_options i
+
css_contents <- readFile css_file
writeFile css_destination css_contents
icon_contents <- readFile icon_file
writeFile icon_destination icon_contents
- ppHtmlContents odir title source_url (map fst ifaces)
- ppHtmlIndex odir title ifaces
- mapM_ (ppHtmlModule odir title source_url) ifaces
+ ppHtmlContents odir title source_url (map fst visible_ifaces)
+ ppHtmlIndex odir title visible_ifaces
+ mapM_ (ppHtmlModule odir title source_url) visible_ifaces
moduleHtmlFile :: String -> FilePath
moduleHtmlFile mod = mod ++ ".html" -- ToDo: Z-encode filename?
@@ -359,8 +362,6 @@ ppModuleContents exports
process :: Int -> [ExportItem] -> ([Html],[ExportItem])
process n [] = ([], [])
- process n (ExportDecl _ : rest) = process n rest
- process n (ExportDoc _ : rest) = process n rest
process n items@(ExportGroup lev id doc : rest)
| lev <= n = ( [], items )
| otherwise = ( html:sections, rest2 )
@@ -369,6 +370,7 @@ ppModuleContents exports
+++ mk_subsections subsections
(subsections, rest1) = process lev rest
(sections, rest2) = process n rest1
+ process n (_ : rest) = process n rest
mk_subsections [] = noHtml
mk_subsections ss = ddef << dlist << concatHtml ss
@@ -392,6 +394,8 @@ processExport doc_map summary (ExportDecl decl)
processExport doc_map summary (ExportDoc doc)
| summary = Html.emptyTable
| otherwise = docBox (markup htmlMarkup doc)
+processExport doc_map summary (ExportModule (Module mod))
+ = declBox (toHtml "module" <+> ppHsModule mod)
ppDocGroup lev doc
| lev == 1 = tda [ theclass "section1" ] << doc