git.iko.soy/typeable/pandoc
on master help sign in
Fix parsing bug affected indented code after raw HTML.
82f4459John MacFarlane
src/Text/Pandoc/Readers/Markdown.hs+10−8
@@ -1094,18 +1094,20 @@ rawHtmlBlocks = do
1094 -- inline will not be parsed as inline tags
1094 -- inline will not be parsed as inline tags
1095 oldInHtmlBlock <- stateInHtmlBlock <$> getState
1095 oldInHtmlBlock <- stateInHtmlBlock <$> getState
1096 updateState $ \st -> st{ stateInHtmlBlock = Just tagtype }
1096 updateState $ \st -> st{ stateInHtmlBlock = Just tagtype }
1097− let closer = htmlTag (\x -> x ~== TagClose tagtype)
1097+ let closer = htmlTag (~== TagClose tagtype)
1098− let block' = try $
1098+ let block' = try $ do
1099− do notFollowedBy' closer
1100− gobbleAtMostSpaces indentlevel
1099+ gobbleAtMostSpaces indentlevel
1100+ notFollowedBy' closer
1101− block
1101+ block
1102 contents <- mconcat <$> many block'
1102 contents <- mconcat <$> many block'
1103 result <-
1103 result <-
1104+ try
1105+ (do gobbleAtMostSpaces indentlevel
1104− (closer >>= \(_, rawcloser) -> return (
1106+ (_, rawcloser) <- closer
1105− return (B.rawBlock "html" $ stripMarkdownAttribute raw) <>
1107+ return (return (B.rawBlock "html" $ stripMarkdownAttribute raw) <>
1106 contents <>
1108 contents <>
1107 return (B.rawBlock "html" rawcloser)))
1109 return (B.rawBlock "html" rawcloser)))
1108− <|> return (return (B.rawBlock "html" raw) <> contents)
1110+ <|> (return (return (B.rawBlock "html" raw) <> contents))
1109 updateState $ \st -> st{ stateInHtmlBlock = oldInHtmlBlock }
1111 updateState $ \st -> st{ stateInHtmlBlock = oldInHtmlBlock }
1110 return result
1112 return result
1111
1113
test/command/5360.mdnew file+19
@@ -0,0 +1,19 @@
1+```
2+% pandoc -t native
3+::: {.foo}
4+<table>
5+ <tr>
6+ <td>hi</td>
7+ </tr>
8+</table>
9+:::
10+^D
11+[Div ("",["foo"],[])
12+ [RawBlock (Format "html") "<table>"
13+ ,RawBlock (Format "html") "<tr>"
14+ ,RawBlock (Format "html") "<td>"
15+ ,Plain [Str "hi"]
16+ ,RawBlock (Format "html") "</td>"
17+ ,RawBlock (Format "html") "</tr>"
18+ ,RawBlock (Format "html") "</table>"]]
19+```
test/command/6009.mdnew file+18
@@ -0,0 +1,18 @@
1+```
2+% pandoc -t native
3+ <tr>
4+ <td>
5+ </td>
6+ </tr>
7+
8+x
9+
10+ y
11+^D
12+[RawBlock (Format "html") "<tr>"
13+,RawBlock (Format "html") "<td>"
14+,RawBlock (Format "html") "</td>"
15+,RawBlock (Format "html") "</tr>"
16+,Para [Str "x"]
17+,CodeBlock ("",[],[]) "y"]
18+```