git.iko.soy/typeable/pandoc
on master help sign in
Markdown reader: More efficient version of scanForPipe.
commitf7ecbd03d4cd9d8e9be3e1865e58556d55423ded authorJohn MacFarlane <fiddlosopher@gmail.com> dateFri 25 Jan 2013, 16:13 (14 years ago) parent4c74b7a
1 file changed+5−1
src/Text/Pandoc/Readers/Markdown.hs+5−1
src/Text/Pandoc/Readers/Markdown.hs+5−1
@@ -1186,7 +1186,11 @@ pipeTableHeaderPart = do
11861186
11871187-- Succeed only if current line contains a pipe.
11881188scanForPipe :: Parser [Char] st ()
1189−scanForPipe = lookAhead (manyTill (satisfy (/='\n')) (char '|')) >> return ()
1189+scanForPipe = do
1190+ inp <- getInput
1191+ case break (\c -> c == '\n' || c == '|') inp of
1192+ (_,'|':_) -> return ()
1193+ _ -> mzero
11901194
11911195-- | Parse a table using 'headerParser', 'rowParser',
11921196-- 'lineParser', and 'footerParser'. Variant of the version in