diff --git a/Registry/Utils.hs b/Registry/Utils.hs
index c1e5c9a..8f0e622 100644
--- a/Registry/Utils.hs
+++ b/Registry/Utils.hs
@@ -60,6 +60,14 @@ redundantFrom _ = error "Not a redundant"
gfFrom (GF r) = r
gfFrom _ = error "Not a grandfathered"
+escapexml :: String -> String
+escapexml = concatMap fixChar
+ where
+ fixChar '<' = "<"
+ fixChar '>' = ">"
+ fixChar '&' = "&"
+ fixChar c = [c]
+
onlyThisType :: String -> Record -> Bool
onlyThisType "language" = onlyLang
onlyThisType "extlang" = onlyExtlang
@@ -80,7 +88,7 @@ onlyThisValue "script" v = (\r -> toUpperS (script'subtag r) == toUpperS (v)).sc
onlyThisValue "region" v = (\r -> toUpperS (region'subtag r) == toUpperS (v)).regionFrom
onlyThisValue "variant" v = (\r -> toUpperS (variant'subtag r) == toUpperS (v)).variantFrom
onlyThisValue "redundant" v = (\r -> toUpperS (redundant'tag r) == toUpperS (v)).redundantFrom
--- TODO: extensions
+-- Extensions not managed? See issue #7.
onlyThisValue t _ = error ("Unknown type of this value in the registry: " ++ t)
toSubtag (Lang l) = (lang'subtag l)
@@ -113,13 +121,12 @@ toString (Var v) = (variant'subtag v) ++ "\t" ++ dateToString (variant'added v)
toString (Red r) = (redundant'tag r) ++ "\t" ++ dateToString (redundant'added r) ++ "\t" ++
descrToString (redundant'descr r) ++ "\n"
--- TODO: escape non-XML chars
dateToXML d = "
" ++ s ++ "
"
-onedescrToHTML s = s
+onedescrToHTML s = (escapexml s)
descrToHTML a = concat (List.intersperse " / " (map onedescrToHTML a))
--- TODO: a prefix is not always a simple language, it can be composed of several subtags
+-- But a prefix is not always a simple language, it can be composed of several subtags. See issue #3
oneprefixToHTML s = " Possible prefix: " ++ s ++ "
"
prefixesToHTML a = concat (map oneprefixToHTML a)
commentToHTML Nothing = ""
-commentToHTML (Just s) = " Comment: " ++ s
+commentToHTML (Just s) = " Comment: " ++ (escapexml s)
deprecatedToHTML Nothing = ""
deprecatedToHTML (Just s) = " Deprecated: " ++ s