diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-02-17 04:57:41 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-02-17 04:57:41 +0000 |
commit | 7d3382e9f020f05afc76bd1afcee4af4914c51fe (patch) | |
tree | e30a0761e20d3759820eb9419a869d273f39829d /src | |
parent | 7a04caeea898fa3d0a19a48cdafc49596ecf8c04 (diff) | |
download | pandoc-7d3382e9f020f05afc76bd1afcee4af4914c51fe.tar.gz |
In writing Markdown, print unicode nonbreaking space
(160) as " ", since otherwise it is hard to distinguish
from a regular space. (Addresses Issue #3.)
git-svn-id: https://pandoc.googlecode.com/svn/trunk@541 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/Writers/Markdown.hs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs index 4d3f844b5..13e5aca89 100644 --- a/src/Text/Pandoc/Writers/Markdown.hs +++ b/src/Text/Pandoc/Writers/Markdown.hs @@ -48,9 +48,16 @@ writeMarkdown options (Pandoc meta blocks) = else empty in render $ head <> body +-- | Escape nonbreaking space as entity +escapeNbsp "" = "" +escapeNbsp ('\160':xs) = " " ++ escapeNbsp xs +escapeNbsp str = + let (a,b) = break (=='\160') str in + a ++ escapeNbsp b + -- | Escape special characters for Markdown. escapeString :: String -> String -escapeString = backslashEscape "`<\\*_^" +escapeString = backslashEscape "`<\\*_^" . escapeNbsp -- | Take list of inline elements and return wrapped doc. wrappedMarkdown :: [Inline] -> Doc |