Markdown reader: use htmlInBalanced for rawVerbatimBlock.
This should give better performance. See #2730.
This commit is contained in:
parent
f1c59b271f
commit
04d1e40f37
1 changed files with 5 additions and 7 deletions
|
@ -61,7 +61,6 @@ import Text.Pandoc.Readers.HTML ( htmlTag, htmlInBalanced, isInlineTag, isBlockT
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
import System.FilePath (takeExtension, addExtension)
|
import System.FilePath (takeExtension, addExtension)
|
||||||
import Text.HTML.TagSoup
|
import Text.HTML.TagSoup
|
||||||
import Text.HTML.TagSoup.Match (tagOpen)
|
|
||||||
import qualified Data.Set as Set
|
import qualified Data.Set as Set
|
||||||
import Text.Printf (printf)
|
import Text.Printf (printf)
|
||||||
import Debug.Trace (trace)
|
import Debug.Trace (trace)
|
||||||
|
@ -1052,12 +1051,11 @@ strictHtmlBlock :: MarkdownParser String
|
||||||
strictHtmlBlock = htmlInBalanced (not . isInlineTag)
|
strictHtmlBlock = htmlInBalanced (not . isInlineTag)
|
||||||
|
|
||||||
rawVerbatimBlock :: MarkdownParser String
|
rawVerbatimBlock :: MarkdownParser String
|
||||||
rawVerbatimBlock = try $ do
|
rawVerbatimBlock = htmlInBalanced isVerbTag
|
||||||
(TagOpen tag _, open) <- htmlTag (tagOpen (flip elem
|
where isVerbTag (TagOpen "pre" _) = True
|
||||||
["pre", "style", "script"])
|
isVerbTag (TagOpen "style" _) = True
|
||||||
(const True))
|
isVerbTag (TagOpen "script" _) = True
|
||||||
contents <- manyTill anyChar (htmlTag (~== TagClose tag))
|
isVerbTag _ = False
|
||||||
return $ open ++ contents ++ renderTags' [TagClose tag]
|
|
||||||
|
|
||||||
rawTeXBlock :: MarkdownParser (F Blocks)
|
rawTeXBlock :: MarkdownParser (F Blocks)
|
||||||
rawTeXBlock = do
|
rawTeXBlock = do
|
||||||
|
|
Loading…
Reference in a new issue