Skip to content
Snippets Groups Projects
Commit ba139bac authored by Jens Nolte's avatar Jens Nolte
Browse files

Convert &, < and > in script input

parent 9d2e36d9
No related branches found
No related tags found
No related merge requests found
...@@ -22,7 +22,11 @@ tagParser = parser (False, normalImportant) ...@@ -22,7 +22,11 @@ tagParser = parser (False, normalImportant)
singleElementParser = choice [textParser, activeTagParser, importanceTagParser, spanParser] singleElementParser = choice [textParser, activeTagParser, importanceTagParser, spanParser]
textParser :: Parser BlockText textParser :: Parser BlockText
textParser = mkText active importance . T.fromStrict <$> A.takeWhile1 (notInClass "<>") textParser = mkText active importance . replaceSymbols . T.fromStrict <$> A.takeWhile1 (notInClass "<>")
replaceSymbols :: Text -> Text
-- replaces &amp; last to prevent the '&' from being interpreted again
replaceSymbols = T.replace "&amp;" "&" . T.replace "&lt;" "<" . T.replace "&gt;" ">"
activeTagParser :: Parser BlockText activeTagParser :: Parser BlockText
activeTagParser = string "<active>" *> parser (True, importance) <* string "</active>" activeTagParser = string "<active>" *> parser (True, importance) <* string "</active>"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment