From 48d67d0d1fa8dd22a0c35439c2cd7b2cc2b62926 Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Mon, 16 Jul 2007 07:22:17 +0000 Subject: Simplified inlinesInBalanced, using lookAhead. git-svn-id: https://pandoc.googlecode.com/svn/trunk@732 788f1e2b-df1e-0410-8736-df70ead52e1b --- src/Text/Pandoc/Readers/Markdown.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/Text/Pandoc/Readers/Markdown.hs') 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)) -- cgit v1.2.3