forked from GitHub/gf-core
Founding the newly structured GF2.0 cvs archive.
This commit is contained in:
20
src/tools/MkHelpFile.hs
Normal file
20
src/tools/MkHelpFile.hs
Normal file
@@ -0,0 +1,20 @@
|
||||
module Main where
|
||||
|
||||
main = do
|
||||
s <- readFile "HelpFile"
|
||||
let s' = mkHsFile (lines s)
|
||||
writeFile "HelpFile.hs" s'
|
||||
|
||||
mkHsFile ss =
|
||||
"module HelpFile where\n\n" ++
|
||||
"txtHelpFile =\n" ++
|
||||
unlines (map mkOne ss) ++
|
||||
" []"
|
||||
|
||||
mkOne s = " \"" ++ pref s ++ (escs s) ++ "\" ++"
|
||||
where
|
||||
pref (' ':_) = "\\n"
|
||||
pref _ = "\\n" ---
|
||||
escs [] = []
|
||||
escs (c:cs) | elem c "\"\\" = '\\':c:escs cs
|
||||
escs (c:cs) = c:escs cs
|
||||
Reference in New Issue
Block a user