From 9e0495cb8347e77c30b8ff0ade54c1ff990bacd8 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Thu, 10 Jul 2014 15:04:18 -0700 Subject: Fixed an issue caused by e4263d306e6988dd322c895242eb818d22b9e012. This sets `stateInHtmlBlock` to `Just "div"` when we're parsing an HTML div. Without this fix, a closing `` tag could be parsed as part of a list item rather than after the list. --- src/Text/Pandoc/Readers/Markdown.hs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index cad20c01e..5361158cc 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -1757,12 +1757,17 @@ divHtml :: MarkdownParser (F Blocks) divHtml = try $ do guardEnabled Ext_markdown_in_html_blocks (TagOpen _ attrs, rawtag) <- htmlTag (~== TagOpen "div" []) + -- we set stateInHtmlBlock so that closing tags that can be either block or + -- inline will not be parsed as inline tags + oldInHtmlBlock <- stateInHtmlBlock <$> getState + updateState $ \st -> st{ stateInHtmlBlock = Just "div" } bls <- option "" (blankline >> option "" blanklines) contents <- mconcat <$> many (notFollowedBy' (htmlTag (~== TagClose "div")) >> block) closed <- option False (True <$ htmlTag (~== TagClose "div")) if closed then do + updateState $ \st -> st{ stateInHtmlBlock = oldInHtmlBlock } let ident = fromMaybe "" $ lookup "id" attrs let classes = maybe [] words $ lookup "class" attrs let keyvals = [(k,v) | (k,v) <- attrs, k /= "id" && k /= "class"] -- cgit v1.2.3