aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-06-20 15:24:24 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2014-06-20 15:26:45 -0700
commit5d0103606f469a6336beb2f7a90f210dd29485bd (patch)
treea045d1bf606c0d0c5a83ea5e6a0117f78aed384c /src/Text
parentd397a66107a932e702d0f9cbba5df3ce09be25fd (diff)
downloadpandoc-5d0103606f469a6336beb2f7a90f210dd29485bd.tar.gz
Markdown reader: Support smallcaps through span.
`<span style="font-variant:small-caps;">foo</span>` will be parsed as a `SmallCaps` inline, and will work in all output formats that support small caps. Closes #1360.
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index 2c9064994..6c710c8ff 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -1736,7 +1736,12 @@ spanHtml = try $ do
let ident = fromMaybe "" $ lookup "id" attrs
let classes = maybe [] words $ lookup "class" attrs
let keyvals = [(k,v) | (k,v) <- attrs, k /= "id" && k /= "class"]
- return $ B.spanWith (ident, classes, keyvals) <$> contents
+ case lookup "style" keyvals of
+ Just s | null ident && null classes &&
+ map toLower (filter (`notElem` " \t;") s) ==
+ "font-variant:small-caps"
+ -> return $ B.smallcaps <$> contents
+ _ -> return $ B.spanWith (ident, classes, keyvals) <$> contents
divHtml :: MarkdownParser (F Blocks)
divHtml = try $ do