diff options
author | Alexander Krotov <ilabdsf@gmail.com> | 2018-04-15 16:07:43 +0300 |
---|---|---|
committer | Alexander Krotov <ilabdsf@gmail.com> | 2018-04-15 16:28:45 +0300 |
commit | 17767bd29d54883364d4d9bdee417973ac0a10ac (patch) | |
tree | f60e995d0df021467b24e7e7cef5b33b6b6c2348 /src/Text/Pandoc/Writers | |
parent | 9cc2bf0295a66182223c9ec421a4755d1acebeb1 (diff) | |
download | pandoc-17767bd29d54883364d4d9bdee417973ac0a10ac.tar.gz |
Muse writer: escape strings starting with space
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r-- | src/Text/Pandoc/Writers/Muse.hs | 6 |
1 files changed, 5 insertions, 1 deletions
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 |