From 69422327f934c04795bd9d3438847babe1cc785d Mon Sep 17 00:00:00 2001 From: simonmar Date: Mon, 10 Nov 2003 14:41:06 +0000 Subject: [haddock @ 2003-11-10 14:41:05 by simonmar] Re-exporting names from a different package is problematic, because we don't have access to the full documentation for the entity. Currently Haddock just ignores entities with no documentation, but this results in bogus-looking empty documentation for many of the modules in the haskell98 package. So: - the documentation will now just list the name, as a link pointing to the location of the actual documentation. - now we don't attempt to link to these re-exported entities if they are referred to by the current module. Additionally: - If there is no documentation in the current module, include just the Synopsis section (rather than just the documentation section, as it was before). This just looks nicer and was on the TODO list. --- src/HaddockHtml.hs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/HaddockHtml.hs') diff --git a/src/HaddockHtml.hs b/src/HaddockHtml.hs index 9c3be7b3..6a9f193e 100644 --- a/src/HaddockHtml.hs +++ b/src/HaddockHtml.hs @@ -383,6 +383,7 @@ ifaceToHtml _ iface exports = numberSectionHeadings (iface_exports iface) has_doc (ExportDecl _ d _) = isJust (declDoc d) + has_doc (ExportNoDecl _ _ _) = False has_doc (ExportModule _) = False has_doc _ = True @@ -399,8 +400,6 @@ ifaceToHtml _ iface -- omit the synopsis if there are no documentation annotations at all synopsis - | no_doc_at_all = Html.emptyTable - | otherwise = (tda [theclass "section1"] << toHtml "Synopsis") s15 (tda [theclass "body"] << vanillaTable << @@ -411,14 +410,15 @@ ifaceToHtml _ iface -- if the documentation doesn't begin with a section header, then -- add one ("Documentation"). maybe_doc_hdr - | not (no_doc_at_all) = + | no_doc_at_all = Html.emptyTable + | otherwise = case exports of [] -> Html.emptyTable ExportGroup _ _ _ : _ -> Html.emptyTable _ -> tda [ theclass "section1" ] << toHtml "Documentation" - | otherwise = Html.emptyTable - bdy = map (processExport False) exports + bdy | no_doc_at_all = [] + | otherwise = map (processExport False) exports ppModuleContents :: [ExportItem] -> HtmlTable ppModuleContents exports @@ -459,6 +459,10 @@ processExport _ (ExportGroup lev id0 doc) = ppDocGroup lev (namedAnchor id0 << docToHtml doc) processExport summary (ExportDecl x decl insts) = doDecl summary x decl insts +processExport summmary (ExportNoDecl _ y []) + = declBox (ppHsQName y) +processExport summmary (ExportNoDecl _ y subs) + = declBox (ppHsQName y <+> parenList (map ppHsQName subs)) processExport _ (ExportDoc doc) = docBox (docToHtml doc) processExport _ (ExportModule (Module mdl)) -- cgit v1.2.3