git.iko.soy/typeable/pandoc
on master help sign in
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

commite8ce21d614b0a65a1cc1a9d3e41e6e38220875d8 authorickc <ickc@users.noreply.github.com> dateWed 16 Nov 2016, 02:53 (10 years ago) parent0dfceda
3 files changed+19−1
MANUAL.txt+4 man/pandoc.1+8 src/Text/Pandoc/Readers/Markdown.hs+7−1
MANUAL.txt+4
@@ -2736,6 +2736,10 @@ To write small caps, you can use an HTML span tag:
27362736(The semicolon is optional and there may be space after the
27372737colon.) This will work in all output formats that support small caps.
27382738
2739+Alternatively, you can also use the new `bracketed_spans` syntax:
2740+
2741+ [Small caps]{style="font-variant:small-caps;"}
2742+
27392743Math
27402744----
27412745
man/pandoc.1+8
@@ -3388,6 +3388,14 @@ To write small caps, you can use an HTML span tag:
33883388.PP
33893389(The semicolon is optional and there may be space after the colon.) This
33903390will work in all output formats that support small caps.
3391+.PP
3392+Alternatively, you can also use the new \f[C]bracketed_spans\f[] syntax:
3393+.IP
3394+.nf
3395+\f[C]
3396+[Small\ caps]{style="font\-variant:small\-caps;"}
3397+\f[]
3398+.fi
33913399.SS Math
33923400.SS Extension: \f[C]tex_math_dollars\f[]
33933401.PP
src/Text/Pandoc/Readers/Markdown.hs+7−1
@@ -1764,7 +1764,13 @@ bracketedSpan = try $ do
17641764 guardEnabled Ext_bracketed_spans
17651765 (lab,_) <- reference
17661766 attr <- attributes
1767− return $ B.spanWith attr <$> lab
1767+ let (ident,classes,keyvals) = attr
1768+ case lookup "style" keyvals of
1769+ Just s | null ident && null classes &&
1770+ map toLower (filter (`notElem` " \t;") s) ==
1771+ "font-variant:small-caps"
1772+ -> return $ B.smallcaps <$> lab
1773+ _ -> return $ B.spanWith attr <$> lab
17681774
17691775regLink :: (Attr -> String -> String -> Inlines -> Inlines)
17701776 -> F Inlines -> MarkdownParser (F Inlines)