From f7ecbd03d4cd9d8e9be3e1865e58556d55423ded Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 25 Jan 2013 16:13:58 -0800 Subject: Markdown reader: More efficient version of scanForPipe. --- src/Text/Pandoc/Readers/Markdown.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3