aboutsummaryrefslogtreecommitdiff
path: root/src/HaddockUtil.hs
diff options
context:
space:
mode:
authorkrasimir <unknown>2004-07-27 22:59:35 +0000
committerkrasimir <unknown>2004-07-27 22:59:35 +0000
commitf183618bf9c523800ae84d0cb72c65b7ef22aa0b (patch)
tree6e2403e95c9517005e8d59ee4ad5be4cec24b7bf /src/HaddockUtil.hs
parent1d7bc432f61f221c16ecf96903a56a7e5724a587 (diff)
[haddock @ 2004-07-27 22:58:23 by krasimir]
Add basic support for Microsoft HTML Help 2.0
Diffstat (limited to 'src/HaddockUtil.hs')
-rw-r--r--src/HaddockUtil.hs23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/HaddockUtil.hs b/src/HaddockUtil.hs
index ce22ee24..5ce61011 100644
--- a/src/HaddockUtil.hs
+++ b/src/HaddockUtil.hs
@@ -15,10 +15,11 @@ module HaddockUtil (
-- * Filename utilities
basename, dirname, splitFilename3,
isPathSeparator, pathSeparator,
- moduleHtmlFile,
+ moduleHtmlFile, nameHtmlRef,
+ cssFile, iconFile, jsFile, plusFile, minusFile,
-- * Miscellaneous utilities
- getProgramName, bye, die, dieMsg, mapSnd, mapMaybeM,
+ getProgramName, bye, die, dieMsg, mapSnd, mapMaybeM, escapeStr,
-- * HTML cross reference mapping
html_xrefs_ref, html_xrefs,
@@ -37,11 +38,13 @@ import Monad
import RegexString
import FiniteMap
import IOExts
+import URI ( escapeString, unreserved )
#else
import Text.Regex
import Data.FiniteMap
import Data.IORef
import System.IO.Unsafe ( unsafePerformIO )
+import Network.URI ( escapeString, unreserved )
#endif
-- -----------------------------------------------------------------------------
@@ -271,6 +274,19 @@ moduleHtmlFile :: FilePath -> String -> FilePath
moduleHtmlFile "" mod0 = mod0 ++ ".html" -- ToDo: Z-encode filename?
moduleHtmlFile dir mod0 = dir ++ pathSeparator : mod0 ++ ".html"
+nameHtmlRef :: FilePath -> String -> HsName -> String
+nameHtmlRef fp mdl str = moduleHtmlFile fp mdl ++ '#':escapeStr (hsAnchorNameStr str)
+
+-- -----------------------------------------------------------------------------
+-- Files we need to copy from our $libdir
+
+cssFile, iconFile, jsFile, plusFile,minusFile :: String
+cssFile = "haddock.css"
+iconFile = "haskell_icon.gif"
+jsFile = "haddock.js"
+plusFile = "plus.jpg"
+minusFile = "minus.jpg"
+
-----------------------------------------------------------------------------
-- misc.
@@ -297,6 +313,9 @@ mapMaybeM :: Monad m => (a -> m b) -> Maybe a -> m (Maybe b)
mapMaybeM _ Nothing = return Nothing
mapMaybeM f (Just a) = f a >>= return . Just
+escapeStr :: String -> String
+escapeStr str = escapeString str unreserved
+
-----------------------------------------------------------------------------
-- HTML cross references