module Main where
import Util
import Data.List as List
import Data.Char as Char
import qualified Data.Set as Set
main = do s <- getContents
putStr $ amp $ xml $ concat $ map process $ map untab (lines s)
amp = concat . map f
where f '&' = "&"
f c = [c]
xml :: String -> String
xml s = concat
[
"\n",
"\n",
s,
"\n"
]
process :: [String] -> String
process (frame:fr_st:fr_domain:fr_example:fe_core_list:fe_noncore_list:fe_cmp_List:fe_cmp_example:lus_saldo:lus_new:notes:created_by:createDate:modifDate) =
concat [
unlines [
" ",
" " ++ l ++ "",
" " ++ frame ++ "",
" "] | l <- words (replaces lus_saldo)]
process _ = ""
trim = unwords . words
abbr a c = if a == c then "" else " abbr=\"" ++ a ++ "\""
markup [] = []
markup ('[':s) = case span (/= ' ') s of
(tag,(_:s')) -> "" ++ markup s'
_ -> s
markup (']':s) = "" ++ markup s
markup (x:s) = x:markup s