mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 11:42:49 -06:00
Escape backslashes and double quotes in SRGS attribute values.
This commit is contained in:
@@ -105,6 +105,9 @@ showsAttrs = concatS . map (showChar ' ' .) . map showsAttr
|
|||||||
showsAttr :: Attr -> ShowS
|
showsAttr :: Attr -> ShowS
|
||||||
showsAttr (n,v) = showString n . showString "=\"" . showString (escape v) . showString "\""
|
showsAttr (n,v) = showString n . showString "=\"" . showString (escape v) . showString "\""
|
||||||
|
|
||||||
-- FIXME: escape double quotes
|
-- FIXME: escape strange charachters with &#xxx;
|
||||||
escape :: String -> String
|
escape :: String -> String
|
||||||
escape = id
|
escape = concatMap escChar
|
||||||
|
where
|
||||||
|
escChar c | c `elem` ['"','\\'] = '\\':[c]
|
||||||
|
| otherwise = [c]
|
||||||
|
|||||||
Reference in New Issue
Block a user