aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2019-12-27 11:46:22 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2019-12-27 13:08:22 -0800
commit82f44592ae1f2253a5f7ca52d5d3a2299e9bc7a9 (patch)
tree9985343298b5584e11c1ba2bf30925a426e4e09d /src/Text/Pandoc
parentea2c5152ec81758fa3ee697c3d884843020a1172 (diff)
downloadpandoc-82f44592ae1f2253a5f7ca52d5d3a2299e9bc7a9.tar.gz
Fix parsing bug affected indented code after raw HTML.
Closes #6009, #5360.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index 9f63a1947..c09c110aa 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -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