git.iko.soy/typeable/pandoc
on master help sign in
Fixed an issue caused by e4263d306e6988dd322c895242eb818d22b9e012.

This sets `stateInHtmlBlock` to `Just "div"` when we're parsing an HTML div. Without this fix, a closing `</div>` tag could be parsed as part of a list item rather than after the list.

commit9e0495cb8347e77c30b8ff0ade54c1ff990bacd8 authorJohn MacFarlane <jgm@berkeley.edu> dateThu 10 Jul 2014, 15:04 (12 years ago) parent83d4c27
1 file changed+5
src/Text/Pandoc/Readers/Markdown.hs+5
src/Text/Pandoc/Readers/Markdown.hs+5
@@ -1757,12 +1757,17 @@ divHtml :: MarkdownParser (F Blocks)
17571757divHtml = try $ do
17581758 guardEnabled Ext_markdown_in_html_blocks
17591759 (TagOpen _ attrs, rawtag) <- htmlTag (~== TagOpen "div" [])
1760+ -- we set stateInHtmlBlock so that closing tags that can be either block or
1761+ -- inline will not be parsed as inline tags
1762+ oldInHtmlBlock <- stateInHtmlBlock <$> getState
1763+ updateState $ \st -> st{ stateInHtmlBlock = Just "div" }
17601764 bls <- option "" (blankline >> option "" blanklines)
17611765 contents <- mconcat <$>
17621766 many (notFollowedBy' (htmlTag (~== TagClose "div")) >> block)
17631767 closed <- option False (True <$ htmlTag (~== TagClose "div"))
17641768 if closed
17651769 then do
1770+ updateState $ \st -> st{ stateInHtmlBlock = oldInHtmlBlock }
17661771 let ident = fromMaybe "" $ lookup "id" attrs
17671772 let classes = maybe [] words $ lookup "class" attrs
17681773 let keyvals = [(k,v) | (k,v) <- attrs, k /= "id" && k /= "class"]