diff options
author | Alexander Krotov <ilabdsf@gmail.com> | 2017-11-22 16:01:57 +0300 |
---|---|---|
committer | Alexander Krotov <ilabdsf@gmail.com> | 2017-11-22 16:17:30 +0300 |
commit | 454062eccdcc0047e6134bdd4d86c2debb0b3ce7 (patch) | |
tree | bd6dbd2857a81fd1db3027a04bc40ac5d19ab5bc | |
parent | c8ab4789b63422d27b03379ceea413e3fcffd577 (diff) | |
download | pandoc-454062eccdcc0047e6134bdd4d86c2debb0b3ce7.tar.gz |
Muse writer: escape hash symbol
-rw-r--r-- | src/Text/Pandoc/Writers/Muse.hs | 2 | ||||
-rw-r--r-- | test/Tests/Writers/Muse.hs | 2 | ||||
-rw-r--r-- | test/writer.muse | 2 |
3 files changed, 4 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/Muse.hs b/src/Text/Pandoc/Writers/Muse.hs index 8963c7ce4..a6ef28ba7 100644 --- a/src/Text/Pandoc/Writers/Muse.hs +++ b/src/Text/Pandoc/Writers/Muse.hs @@ -285,7 +285,7 @@ escapeString s = -- | Escape special characters for Muse if needed. conditionalEscapeString :: String -> String conditionalEscapeString s = - if any (`elem` ("*<=>[]|" :: String)) s || + if any (`elem` ("#*<=>[]|" :: String)) s || "::" `isInfixOf` s || "----" `isInfixOf` s then escapeString s diff --git a/test/Tests/Writers/Muse.hs b/test/Tests/Writers/Muse.hs index a19f2f57e..562cccfe5 100644 --- a/test/Tests/Writers/Muse.hs +++ b/test/Tests/Writers/Muse.hs @@ -279,6 +279,8 @@ tests = [ testGroup "block elements" =?> "<verbatim>foo<</verbatim><verbatim>/verbatim>bar</verbatim>" , "escape pipe to avoid accidental tables" =: str "foo | bar" =?> "<verbatim>foo | bar</verbatim>" + , "escape hash to avoid accidental anchors" =: text "#foo bar" + =?> "<verbatim>#foo</verbatim> bar" , "escape definition list markers" =: str "::" =?> "<verbatim>::</verbatim>" -- We don't want colons to be escaped if they can't be confused -- with definition list item markers. diff --git a/test/writer.muse b/test/writer.muse index 6c9dd9869..db34a2733 100644 --- a/test/writer.muse +++ b/test/writer.muse @@ -589,7 +589,7 @@ Right paren: ) Greater-than: <verbatim>></verbatim> -Hash: # +Hash: <verbatim>#</verbatim> Period: . |