From 17767bd29d54883364d4d9bdee417973ac0a10ac Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Sun, 15 Apr 2018 16:07:43 +0300 Subject: Muse writer: escape strings starting with space --- src/Text/Pandoc/Writers/Muse.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Text/Pandoc/Writers/Muse.hs b/src/Text/Pandoc/Writers/Muse.hs index 127a4f149..4e7ce377a 100644 --- a/src/Text/Pandoc/Writers/Muse.hs +++ b/src/Text/Pandoc/Writers/Muse.hs @@ -400,6 +400,10 @@ isHorizontalRule s = ((length xs) >= 4) && null ys where (xs, ys) = span (== '-') s +startsWithSpace :: String -> Bool +startsWithSpace (x:_) = isSpace x +startsWithSpace [] = False + fixOrEscape :: Bool -> Inline -> Bool fixOrEscape sp (Str "-") = sp fixOrEscape sp (Str ";") = not sp @@ -407,7 +411,7 @@ fixOrEscape _ (Str ">") = True fixOrEscape sp (Str s) = (sp && (startsWithMarker isDigit s || startsWithMarker isAsciiLower s || startsWithMarker isAsciiUpper s)) - || isHorizontalRule s + || isHorizontalRule s || startsWithSpace s fixOrEscape _ Space = True fixOrEscape _ SoftBreak = True fixOrEscape _ _ = False -- cgit v1.2.3