diff options
author | John MacFarlane <jgm@berkeley.edu> | 2017-03-04 23:01:29 +0100 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-03-04 23:01:29 +0100 |
commit | 0517cf0bc0db5e5b94c86f2dddc1fbc279632b2c (patch) | |
tree | 48225de7df84ae5ace195a7a9ae23d3716c9a722 /src/Text/Pandoc/Readers/HTML.hs | |
parent | 40d1dc417aec8f7cbade5895a1f4ce549039c2c1 (diff) | |
download | pandoc-0517cf0bc0db5e5b94c86f2dddc1fbc279632b2c.tar.gz |
Fixed some loose ends in #1592.
Added test cases.
Fixed HTML reader to parse a span with class "smallcaps" as
SmallCaps.
Fixed Markdown writer to render SmallCaps as a native span
when native spans are enabled.
Diffstat (limited to 'src/Text/Pandoc/Readers/HTML.hs')
-rw-r--r-- | src/Text/Pandoc/Readers/HTML.hs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs index f02f1a1d4..7e7d505ac 100644 --- a/src/Text/Pandoc/Readers/HTML.hs +++ b/src/Text/Pandoc/Readers/HTML.hs @@ -684,9 +684,11 @@ pSpan = try $ do guardEnabled Ext_native_spans TagOpen _ attr <- lookAhead $ pSatisfy $ tagOpen (=="span") (const True) contents <- pInTags "span" inline - let isSmallCaps = fontVariant == "small-caps" + let isSmallCaps = fontVariant == "small-caps" || "smallcaps" `elem` classes where styleAttr = fromMaybe "" $ lookup "style" attr fontVariant = fromMaybe "" $ pickStyleAttrProps ["font-variant"] styleAttr + classes = fromMaybe [] $ + words <$> lookup "class" attr let tag = if isSmallCaps then B.smallcaps else B.spanWith (mkAttr attr) return $ tag contents |