aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Krotov <ilabdsf@gmail.com>2018-04-10 23:38:30 +0300
committerAlexander Krotov <ilabdsf@gmail.com>2018-04-10 23:38:30 +0300
commit782ab73aa350ca323b0b7786770e37d1a932f9a8 (patch)
tree0312c568dafa224933365b342b1dd62354fb30fe
parent72878adc63f6a1e5178734aab499c3cd10df6016 (diff)
downloadpandoc-782ab73aa350ca323b0b7786770e37d1a932f9a8.tar.gz
Muse writer: escape > less often
> should be escaped only when it can start verse, i.e., at the beginning of the line.
-rw-r--r--src/Text/Pandoc/Writers/Muse.hs3
-rw-r--r--test/Tests/Writers/Muse.hs1
-rw-r--r--test/writer.muse6
3 files changed, 6 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Writers/Muse.hs b/src/Text/Pandoc/Writers/Muse.hs
index 0cfc2b8c4..127a4f149 100644
--- a/src/Text/Pandoc/Writers/Muse.hs
+++ b/src/Text/Pandoc/Writers/Muse.hs
@@ -324,7 +324,7 @@ containsFootnotes st =
conditionalEscapeString :: Bool -> String -> String
conditionalEscapeString isInsideLinkDescription s =
- if any (`elem` ("#*<=>|" :: String)) s ||
+ if any (`elem` ("#*<=|" :: String)) s ||
"::" `isInfixOf` s ||
"~~" `isInfixOf` s ||
"[[" `isInfixOf` s ||
@@ -403,6 +403,7 @@ isHorizontalRule s =
fixOrEscape :: Bool -> Inline -> Bool
fixOrEscape sp (Str "-") = sp
fixOrEscape sp (Str ";") = not sp
+fixOrEscape _ (Str ">") = True
fixOrEscape sp (Str s) = (sp && (startsWithMarker isDigit s ||
startsWithMarker isAsciiLower s ||
startsWithMarker isAsciiUpper s))
diff --git a/test/Tests/Writers/Muse.hs b/test/Tests/Writers/Muse.hs
index 5d84150e1..41c846b1b 100644
--- a/test/Tests/Writers/Muse.hs
+++ b/test/Tests/Writers/Muse.hs
@@ -264,6 +264,7 @@ tests = [ testGroup "block elements"
, "escape long horizontal rule" =: para (text "----------") =?> "<verbatim></verbatim>----------"
, "don't escape horizontal inside paragraph" =: para (text "foo ---- bar") =?> "foo ---- bar"
, "escape nonbreaking space" =: para (text "~~") =?> "<verbatim>~~</verbatim>"
+ , "escape > in the beginning of line" =: para (text "> foo bar") =?> "<verbatim></verbatim>> foo bar"
, testGroup "tables"
[ "table without header" =:
let rows = [[para $ text "Para 1.1", para $ text "Para 1.2"]
diff --git a/test/writer.muse b/test/writer.muse
index 83a53a1ab..9492a5517 100644
--- a/test/writer.muse
+++ b/test/writer.muse
@@ -79,7 +79,7 @@ nested
</quote>
</quote>
-This should not be a block quote: 2 <verbatim>></verbatim> 1.
+This should not be a block quote: 2 > 1.
And a following paragraph.
@@ -562,7 +562,7 @@ This & that.
4 <verbatim><</verbatim> 5.
-6 <verbatim>></verbatim> 5.
+6 > 5.
Backslash: \
@@ -584,7 +584,7 @@ Left paren: (
Right paren: )
-Greater-than: <verbatim>></verbatim>
+Greater-than: >
Hash: <verbatim>#</verbatim>