diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs index 3083ffcd3..eff642d2e 100644 --- a/src/Text/Pandoc/Readers/HTML.hs +++ b/src/Text/Pandoc/Readers/HTML.hs @@ -813,18 +813,26 @@ pBdo = try $ do Nothing -> contents pSpan :: PandocMonad m => TagParser m Inlines -pSpan = try $ do - guardEnabled Ext_native_spans - TagOpen _ attr' <- lookAhead $ pSatisfy $ tagOpen (=="span") (const True) - let attr = toAttr attr' - contents <- pInTags "span" inline - let isSmallCaps = fontVariant == "small-caps" || "smallcaps" `elem` classes - where styleAttr = fromMaybe "" $ lookup "style" attr' - fontVariant = fromMaybe "" $ pickStyleAttrProps ["font-variant"] styleAttr - classes = maybe [] - T.words $ lookup "class" attr' - let tag = if isSmallCaps then B.smallcaps else B.spanWith attr - return $ tag contents +pSpan = do + (TagOpen _ attr') <- lookAhead (pSatisfy $ tagOpen (=="span") (const True)) + exts <- getOption readerExtensions + if extensionEnabled Ext_native_spans exts + then do + contents <- pInTags "span" inline + let attr = toAttr attr' + let classes = maybe [] T.words $ lookup "class" attr' + let styleAttr = fromMaybe "" $ lookup "style" attr' + let fontVariant = fromMaybe "" $ + pickStyleAttrProps ["font-variant"] styleAttr + let isSmallCaps = fontVariant == "small-caps" || + "smallcaps" `elem` classes + let tag = if isSmallCaps then B.smallcaps else B.spanWith attr + return $ tag contents + else if extensionEnabled Ext_raw_html exts + then do + tag <- pSatisfy $ tagOpen (=="span") (const True) + return $ B.rawInline "html" $ renderTags' [tag] + else pInTags "span" inline -- just contents pRawHtmlInline :: PandocMonad m => TagParser m Inlines pRawHtmlInline = do diff --git a/test/command/8711.md b/test/command/8711.md new file mode 100644 index 000000000..1685e28cf --- /dev/null +++ b/test/command/8711.md @@ -0,0 +1,118 @@ +``` +% pandoc -f html-native_spans -t native +
|
+ a + |
+
|
+ a + |
+
|
+ a + |
+