summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorickc <ickc@users.noreply.github.com>2016-11-16 02:53:51 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2016-11-16 11:53:51 +0100
commite8ce21d614b0a65a1cc1a9d3e41e6e38220875d8 (patch)
treee4348aafa6ff2e0d2c8e9660836b8af7620de493
parent0dfcedad7ef98dfcfdb2378b7c974bf96b93fbcc (diff)
Small caps in Bracketed Spans (#3191)
* Markdown reader: modify bracketedSpan to check small caps * MANUAL.txt: add description on the use of `bracketed_spans` in small cap * Improve markdown readers: bracketedSpan function EXACTLY as spanHtml
-rw-r--r--MANUAL.txt4
-rw-r--r--man/pandoc.18
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs8
3 files changed, 19 insertions, 1 deletions
diff --git a/MANUAL.txt b/MANUAL.txt
index d987919d9..379c61ca5 100644
--- a/MANUAL.txt
+++ b/MANUAL.txt
@@ -2736,6 +2736,10 @@ To write small caps, you can use an HTML span tag:
(The semicolon is optional and there may be space after the
colon.) This will work in all output formats that support small caps.
+Alternatively, you can also use the new `bracketed_spans` syntax:
+
+ [Small caps]{style="font-variant:small-caps;"}
+
Math
----
diff --git a/man/pandoc.1 b/man/pandoc.1
index 42a7ad10d..e02ed270e 100644
--- a/man/pandoc.1
+++ b/man/pandoc.1
@@ -3388,6 +3388,14 @@ To write small caps, you can use an HTML span tag:
.PP
(The semicolon is optional and there may be space after the colon.) This
will work in all output formats that support small caps.
+.PP
+Alternatively, you can also use the new \f[C]bracketed_spans\f[] syntax:
+.IP
+.nf
+\f[C]
+[Small\ caps]{style="font\-variant:small\-caps;"}
+\f[]
+.fi
.SS Math
.SS Extension: \f[C]tex_math_dollars\f[]
.PP
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index b3459eec0..20a478aa9 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -1764,7 +1764,13 @@ bracketedSpan = try $ do
guardEnabled Ext_bracketed_spans
(lab,_) <- reference
attr <- attributes
- return $ B.spanWith attr <$> lab
+ let (ident,classes,keyvals) = attr
+ case lookup "style" keyvals of
+ Just s | null ident && null classes &&
+ map toLower (filter (`notElem` " \t;") s) ==
+ "font-variant:small-caps"
+ -> return $ B.smallcaps <$> lab
+ _ -> return $ B.spanWith attr <$> lab
regLink :: (Attr -> String -> String -> Inlines -> Inlines)
-> F Inlines -> MarkdownParser (F Inlines)