Generate fancy translation table for documentation

Ignore-this: 353d70985d048216dcf4522ceef10c26

darcs-hash:20090829131955-a4fee-c9e694757edc00d61e4a4365ef1fe2b0aeb948e8
This commit is contained in:
Henning Guenther 2009-08-29 06:19:55 -07:00
parent 85394f42d2
commit f7b6c800ef

View File

@ -35,6 +35,12 @@ parseTranslationTable cont = map (\ln -> let (trans,comm) = break (=='#') ln
_ -> Just (tail comm))
) (lines cont)
buildDocTable :: [(Integer,Maybe Char)] -> [String]
buildDocTable = intersperse "".
map (\(i,mbc) -> show i ++ (case mbc of
Nothing -> ""
Just c -> "\t = &#"++show (ord c)++"; ("++show (ord c)++")"))
{-fillTranslations :: (Ix a,Show a) => a -> a -> [(a,Maybe Char)] -> [(a,Maybe Char)]
fillTranslations f t = merge (range (f,t))
where
@ -113,8 +119,11 @@ preprocessMapping tp src trg mods name = do
["{- This file has been auto-generated. Do not edit it. -}"
,"{-# LANGUAGE MagicHash,DeriveDataTypeable #-}"
]++(case doc of
[] -> []
_ -> ("{- | "++head doc):(map (\ln -> " "++ln) (tail doc)) ++ [" -}"])
[] -> ["{- |"]
_ -> ("{- | "++head doc):(map (\ln -> " "++ln) (tail doc)))
++[""]
++buildDocTable trans
++[" -}"]
++
["module "++mod++"("++name++"(..)) where"
,""