git.iko.soy/typeable/pandoc
on master help sign in
HTML Reader: Detect font-variant with pickStyleAttrProps
18b1b21Ophir Lifshitz
src/Text/Pandoc/Readers/HTML.hs+5−6
@@ -635,12 +635,11 @@ pSpan = try $ do
635 guardEnabled Ext_native_spans
635 guardEnabled Ext_native_spans
636 TagOpen _ attr <- lookAhead $ pSatisfy $ tagOpen (=="span") (const True)
636 TagOpen _ attr <- lookAhead $ pSatisfy $ tagOpen (=="span") (const True)
637 contents <- pInTags "span" inline
637 contents <- pInTags "span" inline
638− let attr' = mkAttr attr
638+ let isSmallCaps = fontVariant == "small-caps"
639− return $ case attr' of
639+ where styleAttr = fromMaybe "" $ lookup "style" attr
640− ("",[],[("style",s)])
640+ fontVariant = fromMaybe "" $ pickStyleAttrProps ["font-variant"] styleAttr
641− | filter (`notElem` " \t;") s == "font-variant:small-caps" ->
642− B.smallcaps contents
643− _ -> B.spanWith (mkAttr attr) contents
641+ let tag = if isSmallCaps then B.smallcaps else B.spanWith (mkAttr attr)
642+ return $ tag contents
644
643
645pRawHtmlInline :: TagParser Inlines
644pRawHtmlInline :: TagParser Inlines
646pRawHtmlInline = do
645pRawHtmlInline = do