diff options
| author | Alexander Krotov <ilabdsf@gmail.com> | 2018-09-16 20:59:59 +0300 | 
|---|---|---|
| committer | Alexander Krotov <ilabdsf@gmail.com> | 2018-09-16 21:05:57 +0300 | 
| commit | 71776661cd0ceceb896ce668b99f1df373f6e1b0 (patch) | |
| tree | b0c7fa2334aed54a6c6cfe4079e7f3dd109dda51 /src/Text/Pandoc/Writers | |
| parent | 18fed9f586ad6a940bdbd62c8a608c7169080800 (diff) | |
| download | pandoc-71776661cd0ceceb896ce668b99f1df373f6e1b0.tar.gz | |
Muse writer: replace newlines in strings with spaces
Diffstat (limited to 'src/Text/Pandoc/Writers')
| -rw-r--r-- | src/Text/Pandoc/Writers/Muse.hs | 8 | 
1 files changed, 7 insertions, 1 deletions
| diff --git a/src/Text/Pandoc/Writers/Muse.hs b/src/Text/Pandoc/Writers/Muse.hs index 1f081348e..18aebc364 100644 --- a/src/Text/Pandoc/Writers/Muse.hs +++ b/src/Text/Pandoc/Writers/Muse.hs @@ -308,6 +308,12 @@ escapeString s =    substitute "</verbatim>" "<</verbatim><verbatim>/verbatim>" s ++    "</verbatim>" +-- | Replace newlines with spaces +replaceNewlines :: String -> String +replaceNewlines ('\n':xs) = ' ':replaceNewlines xs +replaceNewlines (x:xs) = x:replaceNewlines xs +replaceNewlines [] = [] +  startsWithMarker :: (Char -> Bool) -> String -> Bool  startsWithMarker f (' ':xs) = startsWithMarker f xs  startsWithMarker f (x:xs) = @@ -517,7 +523,7 @@ inlineToMuse :: PandocMonad m               => Inline               -> Muse m Doc  inlineToMuse (Str str) = do -  escapedStr <- conditionalEscapeString str +  escapedStr <- conditionalEscapeString $ replaceNewlines str    let useTags = isAlphaNum $ last escapedStr -- escapedStr is never empty because empty strings are escaped    modify $ \st -> st { stUseTags = useTags }    return $ text escapedStr | 
