summaryrefslogtreecommitdiff
path: root/lib/Util.hs
diff options
context:
space:
mode:
authorstuebinm2021-12-02 02:27:30 +0100
committerstuebinm2021-12-02 02:27:30 +0100
commitc2a49d6ea46c38f107ac1a47a965e4777be2aecc (patch)
tree940080d78358a7e8c6bb62435949d1750b8955ca /lib/Util.hs
parent7033597e239d37fd14890c96ae5f07b94a15953d (diff)
do (naïve) html escaping
because we can't ever trust workadventure, apparently. why are we using that thing again?
Diffstat (limited to 'lib/Util.hs')
-rw-r--r--lib/Util.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Util.hs b/lib/Util.hs
index 18dfb5b..948b725 100644
--- a/lib/Util.hs
+++ b/lib/Util.hs
@@ -35,6 +35,7 @@ instance PrettyPrint PropertyValue where
prettyprint = \case
StrProp str -> str
BoolProp bool -> if bool then "true" else "false"
+ IntProp int -> showText int
-- | here since Unit is sometimes used as dummy type
instance PrettyPrint () where
@@ -54,3 +55,8 @@ layerIsEmpty :: Layer -> Bool
layerIsEmpty layer = case layerData layer of
Nothing -> True
Just d -> all ((==) $ mkTiledId 0) d
+
+-- | naive escaping of html sequences, just to be sure that
+-- | workadventure won't mess things up again …
+naiveEscapeHTML :: Text -> Text
+naiveEscapeHTML = T.replace "<" "&lt;" . T.replace ">" "&gt;"