From d3f1ddf57ee420cdcd573158812a7499a02c09f7 Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Sat, 27 Feb 2010 02:35:46 +0000 Subject: LaTeX reader: handle \ (interword space). git-svn-id: https://pandoc.googlecode.com/svn/trunk@1846 788f1e2b-df1e-0410-8736-df70ead52e1b --- src/Text/Pandoc/Readers/LaTeX.hs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/Text/Pandoc/Readers/LaTeX.hs') diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs index e687d1f79..1a5c37e7a 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -429,7 +429,6 @@ inline = choice [ str , whitespace , quoted , apostrophe - , spacer , strong , math , ellipses @@ -547,7 +546,15 @@ unescapedChar :: GenParser Char st Inline unescapedChar = oneOf "`$^&_#{}|<>" >>= return . (\c -> Str [c]) specialChar :: GenParser Char st Inline -specialChar = choice [ backslash, tilde, caret, bar, lt, gt, doubleQuote ] +specialChar = choice [ spacer, interwordSpace, + backslash, tilde, caret, + bar, lt, gt, doubleQuote ] + +spacer :: GenParser Char st Inline +spacer = try (string "\\,") >> return (Str "") + +interwordSpace :: GenParser Char st Inline +interwordSpace = try (string "\\ ") >> return (Str "\160") backslash :: GenParser Char st Inline backslash = try (string "\\textbackslash") >> optional (try $ string "{}") >> return (Str "\\") @@ -670,9 +677,6 @@ whitespace = many1 (oneOf "~ \t") >> return Space linebreak :: GenParser Char st Inline linebreak = try (string "\\\\") >> return LineBreak -spacer :: GenParser Char st Inline -spacer = try (string "\\,") >> return (Str "") - str :: GenParser Char st Inline str = many1 (noneOf specialChars) >>= return . Str -- cgit v1.2.3