Escape backslashes and double quotes in SRGS attribute values.

This commit is contained in:
bringert
2006-02-01 10:24:37 +00:00
parent cf61a92bc8
commit b7f64b384b

View File

@@ -105,6 +105,9 @@ showsAttrs = concatS . map (showChar ' ' .) . map showsAttr
showsAttr :: Attr -> ShowS
showsAttr (n,v) = showString n . showString "=\"" . showString (escape v) . showString "\""
-- FIXME: escape double quotes
-- FIXME: escape strange charachters with &#xxx;
escape :: String -> String
escape = id
escape = concatMap escChar
where
escChar c | c `elem` ['"','\\'] = '\\':[c]
| otherwise = [c]