aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-07-19 08:09:17 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-07-19 08:09:17 +0000
commite02fb214527c291be499df70e89746649910d1b8 (patch)
tree6311eab038c046f6903040454293133d66f5d3c6 /src
parent7d2c9c6fe6458a6b15fa63fe7ee0651a57e5ce32 (diff)
downloadpandoc-e02fb214527c291be499df70e89746649910d1b8.tar.gz
Refactored character escaping in Text.Pandoc.Writers.Markdown using
escapeCharAsString. git-svn-id: https://pandoc.googlecode.com/svn/trunk@739 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/Markdown.hs10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs
index 6792a1935..764a146ac 100644
--- a/src/Text/Pandoc/Writers/Markdown.hs
+++ b/src/Text/Pandoc/Writers/Markdown.hs
@@ -105,16 +105,10 @@ wrappedMarkdown opts sect = do
chunks' <- mapM (inlineListToMarkdown opts) chunks
return $ fsep chunks'
--- | Escape nonbreaking space as &nbsp; entity
-escapeNbsp "" = ""
-escapeNbsp ('\160':xs) = "&nbsp;" ++ escapeNbsp xs
-escapeNbsp str =
- let (a,b) = break (=='\160') str in
- a ++ escapeNbsp b
-
-- | Escape special characters for Markdown.
escapeString :: String -> String
-escapeString = backslashEscape "`<\\*_^" . escapeNbsp
+escapeString = backslashEscape "`<\\*_^" .
+ escapeCharAsString '\160' "&nbsp;"
-- | Convert bibliographic information into Markdown header.
metaToMarkdown :: WriterOptions -> Meta -> State WriterState Doc