diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-07-16 07:22:17 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-07-16 07:22:17 +0000 |
commit | 48d67d0d1fa8dd22a0c35439c2cd7b2cc2b62926 (patch) | |
tree | 4822ad6bbc3093f304c49906ae39b280729e99f9 /src/Text/Pandoc | |
parent | 0ba858f22d1d2fd2084f14350dba5d9579ae9191 (diff) | |
download | pandoc-48d67d0d1fa8dd22a0c35439c2cd7b2cc2b62926.tar.gz |
Simplified inlinesInBalanced, using lookAhead.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@732 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index 572288661..a7f46a864 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -133,13 +133,13 @@ failUnlessSmart = do -- between balanced pairs of @opener@ and a @closer@. inlinesInBalanced :: String -> String -> GenParser Char ParserState [Inline] inlinesInBalanced opener closer = try $ do - let nonOpenerSymbol = try $ do -- succeeds if next inline would be Str opener - res <- inline -- fails if next inline merely begins with opener + let openerSymbol = try $ do + res <- inline if res == Str opener - then pzero - else return ' ' + then return res + else pzero try (string opener) - result <- manyTill ( (do notFollowedBy nonOpenerSymbol + result <- manyTill ( (do lookAhead openerSymbol bal <- inlinesInBalanced opener closer return $ [Str opener] ++ bal ++ [Str closer]) <|> (count 1 inline)) |