git.iko.soy/typeable/pandoc
on master help sign in
Performance improvements:
1d8fe26fiddlosopher
src/Text/Pandoc/Readers/Markdown.hs+11−13
@@ -617,6 +617,11 @@ table = failIfStrict >> (simpleTable <|> multilineTable) <?> "table"
617
617
618inline = choice [ rawLaTeXInline'
618inline = choice [ rawLaTeXInline'
619 , escapedChar
619 , escapedChar
620+ , smartPunctuation
621+ , linebreak
622+ , endline
623+ , whitespace
624+ , str
620 , charRef
625 , charRef
621 , note
626 , note
622 , inlineNote
627 , inlineNote
@@ -631,15 +636,9 @@ inline = choice [ rawLaTeXInline'
631 , strikeout
636 , strikeout
632 , superscript
637 , superscript
633 , subscript
638 , subscript
634− , smartPunctuation
635 , code
639 , code
636− , ltSign
637 , symbol
640 , symbol
638− , str
639− , linebreak
640− , tabchar
641− , whitespace
642− , endline ] <?> "inline"
641+ , ltSign ] <?> "inline"
643
642
644escapedChar = try $ do
643escapedChar = try $ do
645 char '\\'
644 char '\\'
@@ -649,10 +648,11 @@ escapedChar = try $ do
649 else satisfy (not . isAlphaNum)
648 else satisfy (not . isAlphaNum)
650 return $ Str [result]
649 return $ Str [result]
651
650
652−ltSign = try $ do
651+ltSign = do
653− notFollowedBy (noneOf "<") -- continue only if it's a <
652+ st <- getState
653+ if stateStrict st
654+ then char '<'
654− notFollowedBy' rawHtmlBlocks -- don't return < if it starts html
655+ else notFollowedBy' rawHtmlBlocks >> char '<' -- unless it starts html
655− char '<'
656 return $ Str ['<']
656 return $ Str ['<']
657
657
658specialCharsMinusLt = filter (/= '<') specialChars
658specialCharsMinusLt = filter (/= '<') specialChars
@@ -760,8 +760,6 @@ emDash = try $ skipSpaces >> oneOfStrings ["---", "--"] >>
760
760
761whitespace = (many1 (oneOf spaceChars) >> return Space) <?> "whitespace"
761whitespace = (many1 (oneOf spaceChars) >> return Space) <?> "whitespace"
762
762
763−tabchar = tab >> return (Str "\t")
764−
765-- hard line break
763-- hard line break
766linebreak = try $ oneOf spaceChars >> many1 (oneOf spaceChars) >>
764linebreak = try $ oneOf spaceChars >> many1 (oneOf spaceChars) >>
767 endline >> return LineBreak
765 endline >> return LineBreak