diff options
author | Ophir Lifshitz <hangfromthefloor@gmail.com> | 2015-07-27 20:08:04 -0400 |
---|---|---|
committer | Ophir Lifshitz <hangfromthefloor@gmail.com> | 2015-07-27 20:08:04 -0400 |
commit | 18b1b21a6af5638f16c9aca745f463bfd65e8417 (patch) | |
tree | eb94742c5bff186f0a8e504fe98e12aaf0734829 | |
parent | 490db2d7db0c934aa4016b54dc4ea8614f334da3 (diff) | |
download | pandoc-18b1b21a6af5638f16c9aca745f463bfd65e8417.tar.gz |
HTML Reader: Detect font-variant with pickStyleAttrProps
-rw-r--r-- | src/Text/Pandoc/Readers/HTML.hs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs index 17296eb3d..02bfcb2bb 100644 --- a/src/Text/Pandoc/Readers/HTML.hs +++ b/src/Text/Pandoc/Readers/HTML.hs @@ -635,12 +635,11 @@ pSpan = try $ do guardEnabled Ext_native_spans TagOpen _ attr <- lookAhead $ pSatisfy $ tagOpen (=="span") (const True) contents <- pInTags "span" inline - let attr' = mkAttr attr - return $ case attr' of - ("",[],[("style",s)]) - | filter (`notElem` " \t;") s == "font-variant:small-caps" -> - B.smallcaps contents - _ -> B.spanWith (mkAttr attr) contents + let isSmallCaps = fontVariant == "small-caps" + where styleAttr = fromMaybe "" $ lookup "style" attr + fontVariant = fromMaybe "" $ pickStyleAttrProps ["font-variant"] styleAttr + let tag = if isSmallCaps then B.smallcaps else B.spanWith (mkAttr attr) + return $ tag contents pRawHtmlInline :: TagParser Inlines pRawHtmlInline = do |