aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-12-27 13:33:00 -0700
committerGitHub <noreply@github.com>2017-12-27 13:33:00 -0700
commitacfa846aab4ed2c5acb00c9d4eab6b80c13114fd (patch)
treee23ac30090fe6016b906e421edcc9790956a6471 /src/Text/Pandoc
parent2e8722da6c732d2153ea055bd0961b4233f97c36 (diff)
parent9b54b9461221f1bb34b8d3e6ffa0f43d5a9e6352 (diff)
downloadpandoc-acfa846aab4ed2c5acb00c9d4eab6b80c13114fd.tar.gz
Merge pull request #4184 from mb21/html-reader-figcaption
HTML Reader: be more forgiving about figcaption
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Readers/HTML.hs11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs
index 1b758a668..05a80335a 100644
--- a/src/Text/Pandoc/Readers/HTML.hs
+++ b/src/Text/Pandoc/Readers/HTML.hs
@@ -75,8 +75,8 @@ import Text.Pandoc.Options (
ReaderOptions (readerExtensions, readerStripComments),
extensionEnabled)
import Text.Pandoc.Parsing hiding ((<|>))
-import Text.Pandoc.Shared (addMetaField, crFilter, escapeURI, extractSpaces,
- safeRead, underlineSpan)
+import Text.Pandoc.Shared (addMetaField, blocksToInlines', crFilter, escapeURI,
+ extractSpaces, safeRead, underlineSpan)
import Text.Pandoc.Walk
import Text.Parsec.Error
import Text.TeXMath (readMathML, writeTeX)
@@ -600,8 +600,11 @@ pFigure = try $ do
skipMany pBlank
let pImg = (\x -> (Just x, Nothing)) <$>
(pOptInTag "p" pImage <* skipMany pBlank)
- pCapt = (\x -> (Nothing, Just x)) <$>
- (pInTags "figcaption" inline <* skipMany pBlank)
+ pCapt = (\x -> (Nothing, Just x)) <$> do
+ skipMany pBlank
+ bs <- pInTags "figcaption" block
+ skipMany pBlank
+ return $ blocksToInlines' $ B.toList bs
pSkip = (Nothing, Nothing) <$ pSatisfy (not . matchTagClose "figure")
res <- many (pImg <|> pCapt <|> pSkip)
let mbimg = msum $ map fst res