From bf2eb4f288df5d5b5e054cdc4ffa3b3c4dd187fa Mon Sep 17 00:00:00 2001 From: Florian Beeres Date: Mon, 11 Nov 2019 17:55:58 +0100 Subject: Change the implementation of `htmlSpanLikeElements` and implement `` (#5882) * Add HTML Reader support for ``, parsing this as a Span with class `dfn`. * Change `htmlSpanLikeElements` implementation to retain classes, attributes and inline content. --- src/Text/Pandoc/Readers/HTML.hs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/Text/Pandoc/Readers/HTML.hs') diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs index 697a3aa9d..e03ac6a97 100644 --- a/src/Text/Pandoc/Readers/HTML.hs +++ b/src/Text/Pandoc/Readers/HTML.hs @@ -719,10 +719,17 @@ pSubscript :: PandocMonad m => TagParser m Inlines pSubscript = pInlinesInTags "sub" B.subscript pSpanLike :: PandocMonad m => TagParser m Inlines -pSpanLike = Set.foldr - (\tag acc -> acc <|> pInlinesInTags tag (B.spanWith ("",[T.unpack tag],[]))) - mzero - htmlSpanLikeElements +pSpanLike = + Set.foldr + (\tagName acc -> acc <|> parseTag tagName) + mzero + htmlSpanLikeElements + where + parseTag tagName = do + TagOpen _ attrs <- pSatisfy $ tagOpenLit tagName (const True) + let (ids, cs, kvs) = mkAttr . toStringAttr $ attrs + content <- mconcat <$> manyTill inline (pCloses tagName <|> eof) + return $ B.spanWith (ids, T.unpack tagName : cs, kvs) content pSmall :: PandocMonad m => TagParser m Inlines pSmall = pInlinesInTags "small" (B.spanWith ("",["small"],[])) -- cgit v1.2.3