aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-07-10 15:04:18 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2014-07-10 15:04:18 -0700
commit9e0495cb8347e77c30b8ff0ade54c1ff990bacd8 (patch)
tree71e13e452cd29716e454ca0521ad39b47a35f22e /src/Text/Pandoc
parent83d4c2733c2406654b485326530fc5922bf9a924 (diff)
downloadpandoc-9e0495cb8347e77c30b8ff0ade54c1ff990bacd8.tar.gz
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.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs5
1 files changed, 5 insertions, 0 deletions
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"]