diff options
author | davve <davve@dtek.chalmers.se> | 2006-08-19 20:07:55 +0000 |
---|---|---|
committer | davve <davve@dtek.chalmers.se> | 2006-08-19 20:07:55 +0000 |
commit | a7d3efef2e17273fb28a3d711d00843c1c875a17 (patch) | |
tree | c441da71c6e5cf4fb12e0303f204d3e7759e3494 /src/HaddockUtil.hs | |
parent | 7ef7e7beb6e79166dec2f31cfbd16f7170066a6b (diff) |
Adapt to latest GHC
Diffstat (limited to 'src/HaddockUtil.hs')
-rw-r--r-- | src/HaddockUtil.hs | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/HaddockUtil.hs b/src/HaddockUtil.hs index 185a4cb7..7fe6f796 100644 --- a/src/HaddockUtil.hs +++ b/src/HaddockUtil.hs @@ -20,6 +20,7 @@ module HaddockUtil ( -- * Miscellaneous utilities getProgramName, bye, die, dieMsg, noDieMsg, mapSnd, mapMaybeM, escapeStr, + moduleString, mkModuleNoPkg, -- * HTML cross reference mapping html_xrefs_ref, @@ -41,6 +42,8 @@ import SrcLoc import Name import OccName import Binary +import Module +import PackageConfig ( stringToPackageId ) import Control.Monad ( liftM, MonadPlus(..) ) import Data.Char ( isAlpha, isSpace, toUpper, ord ) @@ -144,15 +147,16 @@ isPathSeparator ch = ch == '/' #endif -moduleHtmlFile :: String -> FilePath +moduleHtmlFile :: Module -> FilePath moduleHtmlFile mdl = - case Map.lookup (mkModule mdl) html_xrefs of + case Map.lookup mdl html_xrefs of Nothing -> mdl' ++ ".html" Just fp0 -> pathJoin [fp0, mdl' ++ ".html"] where - mdl' = map (\c -> if c == '.' then '-' else c) mdl + mdl' = map (\c -> if c == '.' then '-' else c) + (moduleNameString (moduleName mdl)) -nameHtmlRef :: String -> Name -> String +nameHtmlRef :: Module -> Name -> String nameHtmlRef mdl str = moduleHtmlFile mdl ++ '#':escapeStr (anchorNameStr str) contentsHtmlFile, indexHtmlFile :: String @@ -224,6 +228,12 @@ escapeStr = flip escapeString unreserved escapeStr = escapeURIString isUnreserved #endif +moduleString :: Module -> String +moduleString = moduleNameString . moduleName + +mkModuleNoPkg :: String -> Module +mkModuleNoPkg str = mkModule (stringToPackageId "") (mkModuleName str) + ----------------------------------------------------------------------------- -- HTML cross references |