git.iko.soy/typeable/pandoc
on master help sign in
Muse writer: escape "----" to avoid accidental horizontal rules
commit7e42857ed8357bc5b5e9528d9fd09408f27ab4e1 authorAlexander Krotov <ilabdsf@gmail.com> dateWed 22 Nov 2017, 00:17 (9 years ago) parent351765d
2 files changed+7−4
src/Text/Pandoc/Writers/Muse.hs+6−4 test/Tests/Writers/Muse.hs+1
src/Text/Pandoc/Writers/Muse.hs+6−4
@@ -284,10 +284,12 @@ escapeString s =
284284
285285-- | Escape special characters for Muse if needed.
286286conditionalEscapeString :: String -> String
287−conditionalEscapeString s
288− | any (`elem` ("*<=>[]|" :: String)) s ||
289− "::" `isInfixOf` s = escapeString s
290− | otherwise = s
287+conditionalEscapeString s =
288+ if any (`elem` ("*<=>[]|" :: String)) s ||
289+ "::" `isInfixOf` s ||
290+ "----" `isInfixOf` s
291+ then escapeString s
292+ else s
291293
292294-- | Convert list of Pandoc inline elements to Muse.
293295inlineListToMuse :: PandocMonad m
test/Tests/Writers/Muse.hs+1
@@ -236,6 +236,7 @@ tests = [ testGroup "block elements"
236236 ]
237237 ]
238238 , "horizontal rule" =: horizontalRule =?> "----"
239+ , "escape horizontal rule" =: para (text "----") =?> "<verbatim>----</verbatim>"
239240 , testGroup "tables"
240241 [ "table without header" =:
241242 let rows = [[para $ text "Para 1.1", para $ text "Para 1.2"]