* 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 | ||||
| -- (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 | ||||
|  |  | |||
|  | @ -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 | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue