aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2013-01-25 16:13:58 -0800
committerJohn MacFarlane <fiddlosopher@gmail.com>2013-01-25 16:13:58 -0800
commitf7ecbd03d4cd9d8e9be3e1865e58556d55423ded (patch)
treec00b2f107256d27a5aedc6a16e9d63d025e21ce3 /src
parent4c74b7aaabe42428b8de9dade89e42c5cccc9463 (diff)
downloadpandoc-f7ecbd03d4cd9d8e9be3e1865e58556d55423ded.tar.gz
Markdown reader: More efficient version of scanForPipe.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index 0708690d4..69753c52a 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -1186,7 +1186,11 @@ pipeTableHeaderPart = do
-- Succeed only if current line contains a pipe.
scanForPipe :: Parser [Char] st ()
-scanForPipe = lookAhead (manyTill (satisfy (/='\n')) (char '|')) >> return ()
+scanForPipe = do
+ inp <- getInput
+ case break (\c -> c == '\n' || c == '|') inp of
+ (_,'|':_) -> return ()
+ _ -> mzero
-- | Parse a table using 'headerParser', 'rowParser',
-- 'lineParser', and 'footerParser'. Variant of the version in