Fix parsing bug affected indented code after raw HTML.
Closes #6009, #5360.
This commit is contained in:
parent
ea2c5152ec
commit
82f44592ae
3 changed files with 47 additions and 8 deletions
|
@ -1094,18 +1094,20 @@ rawHtmlBlocks = do
|
|||
-- inline will not be parsed as inline tags
|
||||
oldInHtmlBlock <- stateInHtmlBlock <$> getState
|
||||
updateState $ \st -> st{ stateInHtmlBlock = Just tagtype }
|
||||
let closer = htmlTag (\x -> x ~== TagClose tagtype)
|
||||
let block' = try $
|
||||
do notFollowedBy' closer
|
||||
gobbleAtMostSpaces indentlevel
|
||||
block
|
||||
let closer = htmlTag (~== TagClose tagtype)
|
||||
let block' = try $ do
|
||||
gobbleAtMostSpaces indentlevel
|
||||
notFollowedBy' closer
|
||||
block
|
||||
contents <- mconcat <$> many block'
|
||||
result <-
|
||||
(closer >>= \(_, rawcloser) -> return (
|
||||
return (B.rawBlock "html" $ stripMarkdownAttribute raw) <>
|
||||
try
|
||||
(do gobbleAtMostSpaces indentlevel
|
||||
(_, rawcloser) <- closer
|
||||
return (return (B.rawBlock "html" $ stripMarkdownAttribute raw) <>
|
||||
contents <>
|
||||
return (B.rawBlock "html" rawcloser)))
|
||||
<|> return (return (B.rawBlock "html" raw) <> contents)
|
||||
<|> (return (return (B.rawBlock "html" raw) <> contents))
|
||||
updateState $ \st -> st{ stateInHtmlBlock = oldInHtmlBlock }
|
||||
return result
|
||||
|
||||
|
|
19
test/command/5360.md
Normal file
19
test/command/5360.md
Normal file
|
@ -0,0 +1,19 @@
|
|||
```
|
||||
% pandoc -t native
|
||||
::: {.foo}
|
||||
<table>
|
||||
<tr>
|
||||
<td>hi</td>
|
||||
</tr>
|
||||
</table>
|
||||
:::
|
||||
^D
|
||||
[Div ("",["foo"],[])
|
||||
[RawBlock (Format "html") "<table>"
|
||||
,RawBlock (Format "html") "<tr>"
|
||||
,RawBlock (Format "html") "<td>"
|
||||
,Plain [Str "hi"]
|
||||
,RawBlock (Format "html") "</td>"
|
||||
,RawBlock (Format "html") "</tr>"
|
||||
,RawBlock (Format "html") "</table>"]]
|
||||
```
|
18
test/command/6009.md
Normal file
18
test/command/6009.md
Normal file
|
@ -0,0 +1,18 @@
|
|||
```
|
||||
% pandoc -t native
|
||||
<tr>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
x
|
||||
|
||||
y
|
||||
^D
|
||||
[RawBlock (Format "html") "<tr>"
|
||||
,RawBlock (Format "html") "<td>"
|
||||
,RawBlock (Format "html") "</td>"
|
||||
,RawBlock (Format "html") "</tr>"
|
||||
,Para [Str "x"]
|
||||
,CodeBlock ("",[],[]) "y"]
|
||||
```
|
Loading…
Reference in a new issue