diff options
author | simonmar <unknown> | 2005-02-02 16:23:04 +0000 |
---|---|---|
committer | simonmar <unknown> | 2005-02-02 16:23:04 +0000 |
commit | d8450a233a8e9e0fabcd34e9daf53c82db4dd3bd (patch) | |
tree | 4d05856cf7d2181061b6deb5931a34756dec57c4 /src/HaddockDevHelp.hs | |
parent | a8c82f239a7fa8940abb35c32b82b4ebec9f6761 (diff) |
[haddock @ 2005-02-02 16:23:00 by simonmar]
Revamp the linking strategy in Haddock.
Now name resolution is done in two phases:
- first resolve everything to original names, like a Haskell compiler
would.
- then, figure out the "home" location for every entity, and point
all the links to there. The home location is the lowest non-hidden
module in the import hierarchy that documents the entity. If there
are multiple candidates, one is chosen at random.
Also:
- Haddock should not generate any HTML with dangling links any more.
Unlinked references are just rendered as plain text.
- Error reporting is better: if we can't find a link destination for
an entity reference, we now emit a warning.
Diffstat (limited to 'src/HaddockDevHelp.hs')
-rw-r--r-- | src/HaddockDevHelp.hs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/HaddockDevHelp.hs b/src/HaddockDevHelp.hs index 51e96ea0..390fb6f3 100644 --- a/src/HaddockDevHelp.hs +++ b/src/HaddockDevHelp.hs @@ -10,11 +10,13 @@ import Data.Maybe ( fromMaybe ) import Text.PrettyPrint -ppDevHelpFile :: FilePath -> String -> Maybe String -> [(Module,Interface)] -> IO () +ppDevHelpFile :: FilePath -> String -> Maybe String -> [Interface] -> IO () ppDevHelpFile odir doctitle maybe_package ifaces = do let devHelpFile = package++".devhelp" - tree = mkModuleTree [ (mod, iface_package iface, toDescription iface) - | (mod, iface) <- ifaces ] + tree = mkModuleTree [ (iface_module iface, + iface_package iface, + toDescription iface) + | iface <- ifaces ] doc = text "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>" $$ (text "<book xmlns=\"http://www.devhelp.net/book\" title=\""<>text doctitle<> @@ -56,9 +58,10 @@ ppDevHelpFile odir doctitle maybe_package ifaces = do index :: [(HsName, [Module])] index = Map.toAscList (foldr getIfaceIndex Map.empty ifaces) - getIfaceIndex (mdl,iface) fm = + getIfaceIndex iface fm = Map.unionWith (++) (Map.fromListWith (flip (++)) [(name, [mdl]) | (name, Qual mdl' _) <- Map.toAscList (iface_env iface), mdl == mdl']) fm - + where mdl = iface_module iface + ppList [] = empty ppList ((name,refs):mdls) = ppReference name refs $$ |