summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOphir Lifshitz <hangfromthefloor@gmail.com>2015-07-27 20:08:04 -0400
committerOphir Lifshitz <hangfromthefloor@gmail.com>2015-07-27 20:08:04 -0400
commit18b1b21a6af5638f16c9aca745f463bfd65e8417 (patch)
treeeb94742c5bff186f0a8e504fe98e12aaf0734829 /src
parent490db2d7db0c934aa4016b54dc4ea8614f334da3 (diff)
HTML Reader: Detect font-variant with pickStyleAttrProps
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Readers/HTML.hs11
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