Commit a088d7f2 authored by Roberto Zunino's avatar Roberto Zunino
Browse files

HsColour support

Integration of Cabal, HsColour, and Haddock.
(Also fixes bug #102)
parent 43aa212b
......@@ -54,6 +54,7 @@ module Distribution.Program(
, hsc2hsProgram
, c2hsProgram
, cpphsProgram
, hscolourProgram
, haddockProgram
, greencardProgram
, ldProgram
......@@ -102,7 +103,8 @@ instance Read ProgramConfiguration where
defaultProgramConfiguration :: ProgramConfiguration
defaultProgramConfiguration = progListToFM
[ haddockProgram
[ hscolourProgram
, haddockProgram
, pfesetupProgram
, ranlibProgram
, simpleProgram "runghc"
......@@ -179,6 +181,9 @@ c2hsProgram = simpleProgram "c2hs"
cpphsProgram :: Program
cpphsProgram = simpleProgram "cpphs"
hscolourProgram :: Program
hscolourProgram = (simpleProgram "hscolour"){ programBinName = "HsColour" }
haddockProgram :: Program
haddockProgram = simpleProgram "haddock"
......
......@@ -47,10 +47,8 @@ module Distribution.Setup (--parseArgs,
ConfigFlags(..), emptyConfigFlags, configureArgs,
CopyFlags(..), CopyDest(..), emptyCopyFlags,
InstallFlags(..), emptyInstallFlags,
HaddockFlags(..), emptyHaddockFlags,
BuildFlags(..), emptyBuildFlags,
CleanFlags(..), emptyCleanFlags,
PFEFlags(..),
HaddockFlags(..), emptyHaddockFlags, emptyCleanFlags,
BuildFlags(..), CleanFlags(..), PFEFlags(..),
MakefileFlags(..), emptyMakefileFlags,
RegisterFlags(..), emptyRegisterFlags,
SDistFlags(..),
......@@ -62,7 +60,7 @@ module Distribution.Setup (--parseArgs,
parseGlobalArgs, defaultCompilerFlavor,
parseConfigureArgs, parseBuildArgs, parseCleanArgs,
parseMakefileArgs,
parseHaddockArgs, parseProgramaticaArgs, parseTestArgs,
parseHscolourArgs, parseHaddockArgs, parseProgramaticaArgs, parseTestArgs,
parseInstallArgs, parseSDistArgs, parseRegisterArgs,
parseUnregisterArgs, parseCopyArgs,
reqPathArg, reqDirArg
......@@ -93,6 +91,7 @@ data Action = ConfigCmd ConfigFlags -- config
| BuildCmd -- build
| CleanCmd -- clean
| CopyCmd CopyDest -- copy (--destdir flag)
| HscolourCmd -- hscolour
| HaddockCmd -- haddock
| ProgramaticaCmd -- pfesetup
| InstallCmd -- install (install-prefix)
......@@ -240,14 +239,30 @@ emptyRegisterFlags = RegisterFlags { regUser = MaybeUserNone,
regWithHcPkg = Nothing,
regVerbose = normal }
data HscolourFlags = HscolourFlags {hscolourCSS :: Maybe FilePath
,hscolourExecutables :: Bool
,hscolourVerbose :: Verbosity}
deriving Show
emptyHscolourFlags :: HscolourFlags
emptyHscolourFlags = HscolourFlags {hscolourCSS = Nothing
,hscolourExecutables = False
,hscolourVerbose = normal}
data HaddockFlags = HaddockFlags {haddockHoogle :: Bool
,haddockHtmlLocation :: Maybe String
,haddockExecutables :: Bool
,haddockHscolour :: Bool
,haddockHscolourCss :: Maybe FilePath
,haddockVerbose :: Verbosity}
deriving Show
emptyHaddockFlags :: HaddockFlags
emptyHaddockFlags = HaddockFlags {haddockHoogle = False
,haddockHtmlLocation = Nothing
,haddockExecutables = False
,haddockHscolour = False
,haddockHscolourCss = Nothing
,haddockVerbose = normal}
data CleanFlags = CleanFlags {cleanSaveConf :: Bool
......@@ -312,8 +327,13 @@ data Flag a = GhcFlag | NhcFlag | HugsFlag | JhcFlag
| DestDir FilePath
-- For sdist:
| Snapshot
-- For hscolour:
| HscolourCss FilePath
| HscolourExecutables
-- For haddock:
| HaddockHoogle
| HaddockExecutables
| HaddockHscolour (Maybe FilePath)
| HaddockHtmlLocation String
-- For clean:
| SaveConfigure -- ^don't delete dist\/setup-config during clean
......@@ -408,7 +428,8 @@ data Cmd a = Cmd {
commandList :: ProgramConfiguration -> [Cmd a]
commandList progConf = [(configureCmd progConf), buildCmd, makefileCmd,
cleanCmd, installCmd,
copyCmd, sdistCmd, testCmd, haddockCmd, programaticaCmd,
copyCmd, sdistCmd, testCmd,
haddockCmd, hscolourCmd, programaticaCmd,
registerCmd, unregisterCmd]
lookupCommand :: String -> [Cmd a] -> Maybe (Cmd a)
......@@ -558,6 +579,9 @@ withProgramOptions (ProgramConfiguration conf) = map f (keys conf)
reqPathArg :: (FilePath -> a) -> ArgDescr a
reqPathArg constr = ReqArg (constr . normalise) "PATH"
optPathArg :: (Maybe FilePath -> a) -> ArgDescr a
optPathArg constr = OptArg (constr . fmap normalise) "PATH"
reqArgArg :: (FilePath -> a) -> ArgDescr a
reqArgArg constr = ReqArg (constr . normalise) "ARGS"
......@@ -651,24 +675,55 @@ parseMakefileArgs = parseArgs makefileCmd updateCfg
MakefileFile f -> mflags{makefileFile=Just f}
_ -> error "Unexpected flag!"
hscolourCmd :: Cmd a
hscolourCmd = Cmd {
cmdName = "hscolour",
cmdHelp = "Generate HsColour colourised code, in HTML format.",
cmdDescription = "Requires hscolour.\n",
cmdOptions = [cmd_help, cmd_verbose,
Option "" ["executables"] (NoArg HscolourExecutables)
"Run hscolour for Executables targets",
Option "" ["css"] (reqPathArg HscolourCss)
"Use a cascading style sheet"],
cmdAction = HscolourCmd
}
parseHscolourArgs :: HscolourFlags -> [String] -> [OptDescr a] -> IO (HscolourFlags, [a], [String])
parseHscolourArgs = parseArgs hscolourCmd updateCfg
where updateCfg (HscolourFlags css doExe verbosity) fl = case fl of
HscolourCss c -> HscolourFlags (Just c) doExe verbosity
HscolourExecutables -> HscolourFlags css True verbosity
Verbose n -> HscolourFlags css doExe n
_ -> error "Unexpected flag!"
haddockCmd :: Cmd a
haddockCmd = Cmd {
cmdName = "haddock",
cmdHelp = "Generate Haddock HTML code from Exposed-Modules.",
cmdDescription = "Requires cpphs and haddock.",
cmdOptions = [cmd_help, cmd_verbose,
Option "" ["hoogle"] (NoArg HaddockHoogle) "Generate a hoogle database",
Option "" ["html-location"] (ReqArg HaddockHtmlLocation "URL") "Location of HTML documentation for pre-requisite packages"],
cmdHelp = "Generate Haddock HTML documentation.",
cmdDescription = "Requires cpphs and haddock.\n",
cmdOptions =
[cmd_help, cmd_verbose,
Option "" ["hoogle"] (NoArg HaddockHoogle)
"Generate a hoogle database",
Option "" ["html-location"] (ReqArg HaddockHtmlLocation "URL")
"Location of HTML documentation for pre-requisite packages",
Option "" ["executables"] (NoArg HaddockExecutables)
"Run haddock for Executables targets",
Option "" ["hscolour"] (optPathArg HaddockHscolour)
"Also run hscolour (using PATH as the stylesheet, if any)"],
cmdAction = HaddockCmd
}
parseHaddockArgs :: HaddockFlags -> [String] -> [OptDescr a] -> IO (HaddockFlags, [a], [String])
parseHaddockArgs = parseArgs haddockCmd updateCfg
where updateCfg hflags fl = case fl of
HaddockHoogle -> hflags{haddockHoogle=True}
HaddockHoogle -> hflags{haddockHoogle = True}
HaddockHtmlLocation s -> hflags{haddockHtmlLocation=Just s}
Verbose n -> hflags{haddockVerbose=n}
_ -> error "Unexpected flag!"
HaddockExecutables -> hflags{haddockExecutables = True}
HaddockHscolour h -> hflags{haddockHscolour = True
,haddockHscolourCss = h}
Verbose n -> hflags{haddockVerbose = n}
_ -> error "Unexpected flag!"
programaticaCmd :: Cmd a
programaticaCmd = Cmd {
......
......@@ -70,7 +70,7 @@ import Distribution.Compiler
import Distribution.Package --must not specify imports, since we're exporting moule.
import Distribution.PackageDescription
import Distribution.Program(lookupProgram, Program(..), ProgramConfiguration(..),
haddockProgram, rawSystemProgram, defaultProgramConfiguration,
hscolourProgram, haddockProgram, rawSystemProgram, defaultProgramConfiguration,
pfesetupProgram, updateProgram, rawSystemProgramConf)
import Distribution.PreProcess (knownSuffixHandlers, ppSuffixes, ppCpp',
ppUnlit, removePreprocessedPackage,
......@@ -87,10 +87,10 @@ import Distribution.Simple.Register ( register, unregister,
import Distribution.Simple.Configure(getPersistBuildConfig, maybeGetPersistBuildConfig,
configure, writePersistBuildConfig, localBuildInfoFile,
haddockVersion)
hscolourVersion, haddockVersion)
import Distribution.Simple.LocalBuildInfo ( LocalBuildInfo(..), distPref,
srcPref, haddockPref, substDir )
srcPref, hscolourPref, haddockPref, substDir )
import Distribution.Simple.Install(install)
import Distribution.Simple.Utils (die, currentDir,
createDirectoryIfMissingVerbose,
......@@ -109,14 +109,15 @@ import Distribution.License
import Control.Monad(liftM, when, unless)
import Data.Char ( isSpace )
import Data.List ( intersperse, unionBy )
import Data.Maybe ( catMaybes )
import Data.Maybe ( isJust, catMaybes )
import System.IO.Error (try)
import System.IO ( hPutStrLn, stderr )
import System.Environment ( getProgName )
import Distribution.GetOpt
import Distribution.Compat.Directory(removeDirectoryRecursive, copyFile)
import System.FilePath((</>), (<.>), splitFileName, splitExtension , replaceExtension)
import System.FilePath((</>), (<.>), splitFileName, splitExtension,
replaceExtension, takeExtension)
#ifdef DEBUG
import HUnit (Test)
......@@ -208,11 +209,18 @@ data UserHooks = UserHooks
-- |Hook to run after unregister command
postUnreg :: Args -> RegisterFlags -> PackageDescription -> LocalBuildInfo -> IO (),
-- |Hook to run before hscolour command. Second arg indicates verbosity level.
preHscolour :: Args -> HscolourFlags -> IO HookedBuildInfo,
-- |Over-ride this hook to get different behavior during hscolour.
hscolourHook :: PackageDescription -> LocalBuildInfo -> UserHooks -> HscolourFlags -> IO (),
-- |Hook to run after hscolour command. Second arg indicates verbosity level.
postHscolour :: Args -> HscolourFlags -> PackageDescription -> LocalBuildInfo -> IO (),
-- |Hook to run before haddock command. Second arg indicates verbosity level.
preHaddock :: Args -> HaddockFlags -> IO HookedBuildInfo,
-- |Hook to run after haddock command. Second arg indicates verbosity level.
-- |Over-ride this hook to get different behavior during haddock.
haddockHook :: PackageDescription -> LocalBuildInfo -> UserHooks -> HaddockFlags -> IO (),
-- |Hook to run after haddock command. Second arg indicates verbosity level.
postHaddock :: Args -> HaddockFlags -> PackageDescription -> LocalBuildInfo -> IO (),
-- |Hook to run before pfe command. Second arg indicates verbosity level.
......@@ -321,6 +329,11 @@ defaultMainWorker get_pkg_descr action all_args hooks prog_conf
command (parseMakefileArgs emptyMakefileFlags) makefileVerbose
preMakefile makefileHook postMakefile
getPersistBuildConfig
HscolourCmd ->
command (parseHscolourArgs emptyHscolourFlags) hscolourVerbose
preHscolour hscolourHook postHscolour
getPersistBuildConfig
HaddockCmd ->
command (parseHaddockArgs emptyHaddockFlags) haddockVerbose
......@@ -391,7 +404,11 @@ getModulePaths lbi bi =
-- Haddock support
haddock :: PackageDescription -> LocalBuildInfo -> UserHooks -> HaddockFlags -> IO ()
haddock pkg_descr lbi hooks (HaddockFlags hoogle html_loc verbosity) = do
haddock pkg_descr lbi hooks
(HaddockFlags hoogle html_loc doExes hsColour css verbosity) = do
when hsColour $ hscolour pkg_descr lbi hooks $
HscolourFlags css doExes verbosity
let pps = allSuffixHandlers hooks
confHaddock <- do let programConf = withPrograms lbi
let haddockPath = programName haddockProgram
......@@ -413,9 +430,16 @@ haddock pkg_descr lbi hooks (HaddockFlags hoogle html_loc verbosity) = do
let ghcpkgFlags = if have_new_flags
then ["--ghc-pkg=" ++ compilerPkgTool (compiler lbi)]
else []
let verboseFlags = if verbosity > deafening then ["--verbose"] else []
let allowMissingHtmlFlags = if have_new_flags
then ["--allow-missing-html"]
else []
when (hsColour && not have_new_flags) $
die "haddock --hscolour requires Haddock version > 0.8"
let linkToHscolour = if hsColour
then ["--source-module=src/%{FILE///-}.html"
,"--source-entity=src/%{FILE///-}.html#(line%{LINE})"]
else []
let pkgTool = compilerPkgTool (compiler lbi)
let trim = reverse . dropWhile isSpace . reverse . dropWhile isSpace
......@@ -453,14 +477,16 @@ haddock pkg_descr lbi hooks (HaddockFlags hoogle html_loc verbosity) = do
"--prologue=" ++ prologName]
++ ghcpkgFlags
++ allowMissingHtmlFlags
++ linkToHscolour
++ packageFlags
++ programArgs confHaddock
++ (if verbosity >= deafening then ["--verbose"] else [])
++ verboseFlags
++ outFiles
++ map ("--hide=" ++) (otherModules bi)
)
removeFile prologName
withExe pkg_descr $ \exe -> do
withExe pkg_descr $ \exe -> when doExes $ do
let bi = buildInfo exe
exeTargetDir = haddockPref pkg_descr </> exeName exe
createDirectoryIfMissingVerbose verbosity True exeTargetDir
......@@ -475,9 +501,10 @@ haddock pkg_descr lbi hooks (HaddockFlags hoogle html_loc verbosity) = do
"--title=" ++ exeName exe]
++ ghcpkgFlags
++ allowMissingHtmlFlags
++ linkToHscolour
++ packageFlags
++ programArgs confHaddock
++ (if verbosity >= deafening then ["--verbose"] else [])
++ verboseFlags
++ outFiles
)
......@@ -489,7 +516,7 @@ haddock pkg_descr lbi hooks (HaddockFlags hoogle html_loc verbosity) = do
let targetFile = targetDir </> fileName
let (targetFileNoext, targetFileExt) = splitExtension targetFile
createDirectoryIfMissingVerbose verbosity True targetDir
if (needsCpp pkg_descr)
if needsCpp bi
then runSimplePreProcessor (ppCpp' inputArgs bi lbi)
file targetFile verbosity
else copyFile file targetFile
......@@ -497,10 +524,58 @@ haddock pkg_descr lbi hooks (HaddockFlags hoogle html_loc verbosity) = do
runSimplePreProcessor ppUnlit
targetFile (targetFileNoext <.> "hs") verbosity
return ()
needsCpp :: PackageDescription -> Bool
needsCpp p = case library p of
Nothing -> False
Just lib -> CPP `elem` extensions (libBuildInfo lib)
needsCpp :: BuildInfo -> Bool
needsCpp bi = CPP `elem` extensions bi
-- --------------------------------------------------------------------------
-- hscolour support
hscolour :: PackageDescription -> LocalBuildInfo -> UserHooks -> HscolourFlags -> IO ()
hscolour pkg_descr lbi hooks (HscolourFlags stylesheet doExes verbosity) = do
let pps = allSuffixHandlers hooks
confHscolour <- do let programConf = withPrograms lbi
let hscolourPath = programName hscolourProgram
mHscol <- lookupProgram hscolourPath programConf
maybe (die "HsColour command not found") return mHscol
haveLines <- fmap (>= Version [1,8] []) (hscolourVersion verbosity lbi)
unless haveLines $ die "hscolour version >= 1.8 required"
createDirectoryIfMissing True $ hscolourPref pkg_descr
preprocessSources pkg_descr lbi verbosity pps
setupMessage verbosity "Running hscolour for" pkg_descr
let replaceDot = map (\c -> if c == '.' then '-' else c)
withLib pkg_descr () $ \lib -> when (isJust $ library pkg_descr) $ do
let bi = libBuildInfo lib
let modules = exposedModules lib ++ otherModules bi
inFiles <- getModulePaths bi modules
flip mapM_ (zip modules inFiles) $ \(mo, inFile) -> do
let outputDir = hscolourPref pkg_descr </> "src"
let outFile = outputDir </> replaceDot mo <.>
takeExtension inFile <.> "html"
createDirectoryIfMissing True outputDir
copyCSS outputDir
rawSystemProgram verbosity confHscolour
["-css", "-anchor", "-o" ++ outFile, inFile]
withExe pkg_descr $ \exe -> when doExes $ do
let bi = buildInfo exe
let modules = "Main" : otherModules bi
let outputDir = hscolourPref pkg_descr </> exeName exe </> "src"
createDirectoryIfMissing True outputDir
copyCSS outputDir
srcMainPath <- findFile (hsSourceDirs bi) (modulePath exe)
inFiles <- liftM (srcMainPath :) $ getModulePaths bi (otherModules bi)
flip mapM_ (zip modules inFiles) $ \(mo, inFile) -> do
let outFile = outputDir </> replaceDot mo <.>
takeExtension inFile <.> "html"
rawSystemProgram verbosity confHscolour
["-css", "-anchor", "-o" ++ outFile, inFile]
where copyCSS dir = case stylesheet of
Nothing -> return ()
Just s -> copyFile s (dir </> "hscolour.css")
-- --------------------------------------------------------------------------
......@@ -629,9 +704,12 @@ emptyUserHooks
prePFE = rn,
pfeHook = ru,
postPFE = ru,
preHaddock = rn,
haddockHook = ru,
postHaddock = ru
preHscolour = rn,
hscolourHook = ru,
postHscolour = ru,
preHaddock = rn,
haddockHook = ru,
postHaddock = ru
}
where rn args _ = no_extra_flags args >> return emptyHookedBuildInfo
ru _ _ _ _ = return ()
......@@ -649,6 +727,7 @@ simpleUserHooks =
sDistHook = \p l h f -> sdist p l f srcPref distPref (allSuffixHandlers h),
pfeHook = pfe,
cleanHook = clean,
hscolourHook = hscolour,
haddockHook = haddock,
regHook = defaultRegHook,
unregHook = \p l _ f -> unregister p l f
......@@ -680,6 +759,7 @@ autoconfUserHooks
preClean = readHook cleanVerbose,
preCopy = readHook copyVerbose,
preInst = readHook installVerbose,
preHscolour = readHook hscolourVerbose,
preHaddock = readHook haddockVerbose,
preReg = readHook regVerbose,
preUnreg = readHook regVerbose
......
......@@ -50,6 +50,7 @@ module Distribution.Simple.Configure (configure,
getInstalledPackages,
configDependency,
configCompiler, configCompilerAux,
hscolourVersion,
haddockVersion,
#ifdef DEBUG
hunitTests
......@@ -432,6 +433,21 @@ configCompilerVersion comp compilerP verbosity | comp `elem` [JHC,NHC] = do
_ -> fail ("reading version string: "++show str++" failed.")
configCompilerVersion _ _ _ = return Version{ versionBranch=[],versionTags=[] }
hscolourVersion :: Verbosity -> LocalBuildInfo -> IO Version
hscolourVersion verbosity lbi = fmap getVer verString
where
-- Invoking "HsColour -version" gives a string like "HsColour 1.7"
verString = do hscolourProg <-
fmap (fromMaybe noHscolour) $
lookupProgram "hscolour" (withPrograms lbi)
rawSystemStdout verbosity
(progLocPath (programLocation hscolourProg)) ["-version"]
getVer = head . pCheck . readP_to_S parseVersion . (!! 1) . words
noHscolour = error "hscolourVersion: cannot find hscolour"
progLocPath EmptyLocation = noHscolour
progLocPath (UserSpecified path) = path
progLocPath (FoundOnSystem path) = path
haddockVersion :: Verbosity -> LocalBuildInfo -> IO Version
haddockVersion verbosity lbi = fmap getVer verString
where
......
......@@ -56,7 +56,7 @@ module Distribution.Simple.LocalBuildInfo (
mkLibDir, mkLibDirRel, mkBinDir, mkBinDirRel, mkLibexecDir, mkLibexecDirRel, mkDataDir, mkDataDirRel, mkHaddockDir, mkProgDirRel, mkProgDir,
absolutePath, prefixRelPath,
substDir,
distPref, srcPref, haddockPref, autogenModulesDir, mkIncludeDir
distPref, srcPref, hscolourPref, haddockPref, autogenModulesDir, mkIncludeDir
) where
......@@ -132,6 +132,9 @@ distPref = "dist"
srcPref :: FilePath
srcPref = distPref </> "src"
hscolourPref :: PackageDescription -> FilePath
hscolourPref = haddockPref
haddockPref :: PackageDescription -> FilePath
haddockPref pkg_descr
= foldl1 (</>) [distPref, "doc", "html", pkgName (package pkg_descr)]
......
......@@ -12,6 +12,7 @@
<!ENTITY Cpphs '<ulink url="http://www.haskell.org/cpphs/"><command>cpphs</command></ulink>'>
<!ENTITY Greencard '<ulink url="http://www.haskell.org/greencard/"><command>greencard</command></ulink>'>
<!ENTITY Haddock '<ulink url="http://www.haskell.org/haddock/"><command>haddock</command></ulink>'>
<!ENTITY HsColour '<ulink url="http://www.cs.york.ac.uk/fp/darcs/hscolour/"><command>HsColour</command></ulink>'>
<!ENTITY Happy '<ulink url="http://www.haskell.org/happy/"><command>happy</command></ulink>'>
<!ENTITY HackageDB '<ulink url="http://hackage.haskell.org/">HackageDB</ulink>'>
]>
......@@ -1319,6 +1320,13 @@ runhaskell Setup.hs unregister --gen-script</screen>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--with-hscolour</option>=<replaceable>path</replaceable></term>
<listitem>
<para>Specify the path to &HsColour;.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--with-haddock</option>=<replaceable>path</replaceable></term>
<listitem>
......@@ -1796,8 +1804,9 @@ runhaskell Setup.hs build
<sect2 id="setup-haddock">
<title>setup haddock</title>
<para>Build the interface documentation for a library using
&Haddock;.</para>
<para>Build the documentation for the package using &Haddock;. By
default, only the documentation for the exposed modules is generated
(see <xref linkend="setup-haddock-executables"/>).</para>
<para>This command takes the following options:</para>
......@@ -1833,6 +1842,64 @@ runhaskell Setup.hs build
<command>ghc-pkg</command>).</para>
</listitem>
</varlistentry>
<varlistentry id="setup-haddock-executables">
<term><option>--executables</option></term>
<listitem>
<para>Also run &Haddock; for the modules of all the executable
programs. By default &Haddock; is run only on the exported
modules.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--hscolour</option>=[<replaceable>path</replaceable>]</term>
<listitem>
<para>Generate &Haddock; documentation integrated with &HsColour;.
First, &HsColour; is run to generate colourised code. The
optional argument <replaceable>path</replaceable> denotes a CSS
file, which is passed to &HsColour; as in</para>
<screen>
runhaskell Setup.hs hscolour --css=<replaceable>path</replaceable></screen>
<para>Then &Haddock; is run to generate HTML documentation. Each
entity shown in the documentation is linked to its definition in
the colourised code.</para>
</listitem>
</varlistentry>
</variablelist>
</sect2>
<sect2 id="setup-hscolour">
<title>setup hscolour</title>
<para>Produce colourised code in HTML format using &HsColour;.
Colourised code for exported modules is put in
<filename>dist/doc/html/<replaceable>pkgid</replaceable>/src</filename>.</para>
<para>This command takes the following options:</para>
<variablelist>
<varlistentry>
<term><option>--executables</option></term>
<listitem>
<para>Also run &HsColour; on the sources of all executable
programs. Colourised code is put in
<filename>dist/doc/html/<replaceable>pkgid</replaceable>/<replaceable>executable</replaceable>/src</filename>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--css</option>=<replaceable>path</replaceable></term>
<listitem>
<para>Copy the CSS file from <replaceable>path</replaceable> to
<filename>dist/doc/html/<replaceable>pkgid</replaceable>/src/hscolour.css</filename>
for exported modules, or to
<filename>dist/doc/html/<replaceable>pkgid</replaceable>/<replaceable>executable</replaceable>/src/hscolour.css</filename>
for executable programs. The CSS file defines the actual colours
used to colourise code. Note that the
<filename>hscolour.css</filename> file is required for the code
to be actually colourised.</para>
</listitem>
</varlistentry>
</variablelist>
</sect2>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment