* colouring tool changes
This commit is contained in:
parent
bb981085a6
commit
84b6f5b417
2 changed files with 9 additions and 6 deletions
|
@ -7,7 +7,7 @@ Name: colour
|
||||||
-- The package version. See the Haskell package versioning policy
|
-- The package version. See the Haskell package versioning policy
|
||||||
-- (http://www.haskell.org/haskellwiki/Package_versioning_policy) for
|
-- (http://www.haskell.org/haskellwiki/Package_versioning_policy) for
|
||||||
-- standards guiding when and how versions should be incremented.
|
-- standards guiding when and how versions should be incremented.
|
||||||
Version: 0.1
|
Version: 0.2
|
||||||
|
|
||||||
-- A short (one-line) description of the package.
|
-- A short (one-line) description of the package.
|
||||||
Synopsis: Shortcut program to use HsColour
|
Synopsis: Shortcut program to use HsColour
|
||||||
|
@ -61,4 +61,4 @@ Executable colour
|
||||||
|
|
||||||
-- Extra tools (e.g. alex, hsc2hs, ...) needed to build the source.
|
-- Extra tools (e.g. alex, hsc2hs, ...) needed to build the source.
|
||||||
-- Build-tools:
|
-- Build-tools:
|
||||||
|
|
||||||
|
|
|
@ -9,13 +9,16 @@ defineOptions "MainOptions" $ do
|
||||||
stringOption "optFile" "file" ""
|
stringOption "optFile" "file" ""
|
||||||
"Name of the .hs file. Will be used for the HTML file as well"
|
"Name of the .hs file. Will be used for the HTML file as well"
|
||||||
|
|
||||||
colorCode :: String -> String -> IO ()
|
colorCode :: String -> IO ()
|
||||||
colorCode input output = do
|
colorCode input = do
|
||||||
code <- readFile input
|
code <- readFile input
|
||||||
writeFile output $ hscolour False code
|
putStr $ concat [ "<div class=\"code\">"
|
||||||
|
, hscolour False code
|
||||||
|
, "</div>"
|
||||||
|
]
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = runCommand $ \opts args -> do
|
main = runCommand $ \opts args -> do
|
||||||
let file = optFile opts
|
let file = optFile opts
|
||||||
unless (file == "") $
|
unless (file == "") $
|
||||||
colorCode (file ++ ".hs") (file ++ ".html")
|
colorCode file
|
Loading…
Reference in a new issue