lib: Write.Ods.escape: escape cell contents
This commit is contained in:
parent
ba0db5feec
commit
2a1f3920c6
@ -213,6 +213,18 @@ formatCell cell =
|
|||||||
|
|
||||||
in
|
in
|
||||||
printf "<table:table-cell%s %s>" style valueType :
|
printf "<table:table-cell%s %s>" style valueType :
|
||||||
printf "<text:p>%s</text:p>" (cellContent cell) :
|
printf "<text:p>%s</text:p>" (escape $ T.unpack $ cellContent cell) :
|
||||||
"</table:table-cell>" :
|
"</table:table-cell>" :
|
||||||
[]
|
[]
|
||||||
|
|
||||||
|
escape :: String -> String
|
||||||
|
escape =
|
||||||
|
concatMap $ \c ->
|
||||||
|
case c of
|
||||||
|
'\n' -> " "
|
||||||
|
'&' -> "&"
|
||||||
|
'<' -> "<"
|
||||||
|
'>' -> ">"
|
||||||
|
'"' -> """
|
||||||
|
'\'' -> "'"
|
||||||
|
_ -> [c]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user