@@ -321,14 +321,19 @@ containsFootnotes = p
321 s (_:xs) = p xs
321 s (_:xs) = p xs
322 s [] = False
322 s [] = False
324+-- | Return True if string should be escaped with <verbatim> tags
325+shouldEscapeString :: Bool -> String -> Bool
326+shouldEscapeString isInsideLinkDescription s =
327+ any (`elem` ("#*<=|" :: String)) s ||
328+ "::" `isInfixOf` s ||
329+ "~~" `isInfixOf` s ||
330+ "[[" `isInfixOf` s ||
331+ ("]" `isInfixOf` s && isInsideLinkDescription) ||
324conditionalEscapeString :: Bool -> String -> String
334conditionalEscapeString :: Bool -> String -> String
325conditionalEscapeString isInsideLinkDescription s =
335conditionalEscapeString isInsideLinkDescription s =
326− if any (`elem` ("#*<=|" :: String)) s ||
327− "::" `isInfixOf` s ||
328− "~~" `isInfixOf` s ||
329− "[[" `isInfixOf` s ||
330− ("]" `isInfixOf` s && isInsideLinkDescription) ||
336+ if shouldEscapeString isInsideLinkDescription s
332 then escapeString s
337 then escapeString s