From ba139bacdbf2b68277c7a726f5179e016b7221a1 Mon Sep 17 00:00:00 2001
From: Jens Nolte <git@queezle.net>
Date: Sun, 14 Mar 2021 01:31:27 +0100
Subject: [PATCH] Convert &amp;, &lt; and &gt; in script input

---
 src/QBar/TagParser.hs | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/QBar/TagParser.hs b/src/QBar/TagParser.hs
index 8a9ea14..934d014 100644
--- a/src/QBar/TagParser.hs
+++ b/src/QBar/TagParser.hs
@@ -22,7 +22,11 @@ tagParser = parser (False, normalImportant)
         singleElementParser = choice [textParser, activeTagParser, importanceTagParser, spanParser]
 
         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 = string "<active>" *> parser (True, importance) <* string "</active>"
-- 
GitLab