aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/Writers/Muse.hs17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Writers/Muse.hs b/src/Text/Pandoc/Writers/Muse.hs
index 123ca94e4..7f3b64ea7 100644
--- a/src/Text/Pandoc/Writers/Muse.hs
+++ b/src/Text/Pandoc/Writers/Muse.hs
@@ -321,14 +321,19 @@ containsFootnotes = p
s (_:xs) = p xs
s [] = False
+-- | Return True if string should be escaped with <verbatim> tags
+shouldEscapeString :: Bool -> String -> Bool
+shouldEscapeString isInsideLinkDescription s =
+ any (`elem` ("#*<=|" :: String)) s ||
+ "::" `isInfixOf` s ||
+ "~~" `isInfixOf` s ||
+ "[[" `isInfixOf` s ||
+ ("]" `isInfixOf` s && isInsideLinkDescription) ||
+ containsFootnotes s
+
conditionalEscapeString :: Bool -> String -> String
conditionalEscapeString isInsideLinkDescription s =
- if any (`elem` ("#*<=|" :: String)) s ||
- "::" `isInfixOf` s ||
- "~~" `isInfixOf` s ||
- "[[" `isInfixOf` s ||
- ("]" `isInfixOf` s && isInsideLinkDescription) ||
- containsFootnotes s
+ if shouldEscapeString isInsideLinkDescription s
then escapeString s
else s