* colouring tool changes

This commit is contained in:
Vincent Ambo 2012-04-12 02:56:33 +02:00
parent bb981085a6
commit 84b6f5b417
2 changed files with 9 additions and 6 deletions

View file

@ -7,7 +7,7 @@ Name: colour
-- The package version. See the Haskell package versioning policy
-- (http://www.haskell.org/haskellwiki/Package_versioning_policy) for
-- standards guiding when and how versions should be incremented.
Version: 0.1
Version: 0.2
-- A short (one-line) description of the package.
Synopsis: Shortcut program to use HsColour
@ -61,4 +61,4 @@ Executable colour
-- Extra tools (e.g. alex, hsc2hs, ...) needed to build the source.
-- Build-tools:

View file

@ -9,13 +9,16 @@ defineOptions "MainOptions" $ do
stringOption "optFile" "file" ""
"Name of the .hs file. Will be used for the HTML file as well"
colorCode :: String -> String -> IO ()
colorCode input output = do
colorCode :: String -> IO ()
colorCode input = do
code <- readFile input
writeFile output $ hscolour False code
putStr $ concat [ "<div class=\"code\">"
, hscolour False code
, "</div>"
]
main :: IO ()
main = runCommand $ \opts args -> do
let file = optFile opts
unless (file == "") $
colorCode (file ++ ".hs") (file ++ ".html")
colorCode file