Markdown reader: don't try to read contents in self-closing HTML tag.
Previously we had problems parsing raw HTML with self-closing tags like `<col/>`. The problem was that pandoc would look for a closing tag to close the markdown contents, but the closing tag had, in effect, already been parsed by `htmlTag`. This fixes the issue described in <https://groups.google.com/d/msgid/pandoc-discuss/297bc662-7841-4423-bcbb-534e99bbba09n%40googlegroups.com>.
This commit is contained in:
parent
3ed37f0077
commit
f88ebf3ebf
1 changed files with 4 additions and 1 deletions
|
@ -1121,6 +1121,7 @@ rawTeXBlock = do
|
|||
rawHtmlBlocks :: PandocMonad m => MarkdownParser m (F Blocks)
|
||||
rawHtmlBlocks = do
|
||||
(TagOpen tagtype _, raw) <- htmlTag isBlockTag
|
||||
let selfClosing = "/>" `T.isSuffixOf` raw
|
||||
-- we don't want '<td> text' to be a code block:
|
||||
skipMany spaceChar
|
||||
indentlevel <- (blankline >> length <$> many (char ' ')) <|> return 0
|
||||
|
@ -1134,7 +1135,9 @@ rawHtmlBlocks = do
|
|||
gobbleAtMostSpaces indentlevel
|
||||
notFollowedBy' closer
|
||||
block
|
||||
contents <- mconcat <$> many block'
|
||||
contents <- if selfClosing
|
||||
then return mempty
|
||||
else mconcat <$> many block'
|
||||
result <-
|
||||
try
|
||||
(do gobbleAtMostSpaces indentlevel
|
||||
|
|
Loading…
Reference in a new issue