diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2009-10-12 03:40:47 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2009-10-12 03:40:47 +0000 |
commit | 7163a044a4f9673e38f99c29f2886d42336c283e (patch) | |
tree | 35cbfbdae8e7ec2a152ef6ba90f64436db76c039 /src | |
parent | 74ac66a0cbb2c61a55f6d98128272d3568b0ead5 (diff) | |
download | pandoc-7163a044a4f9673e38f99c29f2886d42336c283e.tar.gz |
Fix inline math parser so that \$ is allowed in math.
Resolves Issue #169.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1609 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index 80bc53966..d03a1123f 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -45,7 +45,7 @@ import Text.Pandoc.Readers.HTML ( rawHtmlBlock, anyHtmlBlockTag, htmlBlockElement, unsanitaryURI ) import Text.Pandoc.CharacterReferences ( decodeCharacterReferences ) import Text.ParserCombinators.Parsec -import Control.Monad (when) +import Control.Monad (when, liftM) -- | Read markdown from an input string and return a Pandoc document. readMarkdown :: ParserState -- ^ Parser state, including options for parser @@ -897,8 +897,13 @@ code = try $ do return $ Code $ removeLeadingTrailingSpace $ concat result mathWord :: GenParser Char st [Char] -mathWord = many1 ((noneOf " \t\n\\$") <|> - (try (char '\\') >>~ notFollowedBy (char '$'))) +mathWord = liftM concat $ many1 mathChunk + +mathChunk :: GenParser Char st [Char] +mathChunk = do char '\\' + c <- anyChar + return ['\\',c] + <|> many1 (noneOf " \t\n\\$") math :: GenParser Char ParserState Inline math = (mathDisplay >>= return . Math DisplayMath) |