Skip to content

Commit

Permalink
Muse writer: escape pipe
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Krotov committed Mar 7, 2017
1 parent 41fbaa1 commit cbed8d4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Text/Pandoc/Writers/Muse.hs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ noteToMuse num note = do
-- | Escape special characters for Muse.
escapeString :: String -> String
escapeString s =
if any (`elem` ("[]<>=*" :: String)) s
if any (`elem` ("*<=>[]|" :: String)) s
then "<verbatim>"
++ substitute "</verbatim>" "<</verbatim><verbatim>/verbatim>" s
++ "</verbatim>"
Expand Down
2 changes: 2 additions & 0 deletions test/Tests/Writers/Muse.hs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ tests = [ testGroup "block elements"
, "escape footnote" =: str "[1]" =?> "<verbatim>[1]</verbatim>"
, "escape verbatim close tag" =: str "foo</verbatim>bar"
=?> "<verbatim>foo<</verbatim><verbatim>/verbatim>bar</verbatim>"
, "escape pipe to avoid accidental tables" =: str "foo | bar"
=?> "<verbatim>foo | bar</verbatim>"
]
, testGroup "emphasis"
[ "emph" =: emph (text "foo") =?> "<em>foo</em>"
Expand Down

0 comments on commit cbed8d4

Please sign in to comment.