Man writer: use custom font V for inline code.
The V font is defined conditionally, so that it renders
like CB in output formats that support that, and like B
in those that don't (e.g. the terminal).
We could just redefine C, but this would affect code
blocks, too, and putting them all in boldface looks ugly,
I think.
Possible drawback: fragments created by pandoc's man
writer will presuppose a nonstandard V font.
Closes #7506.
Supersedes 253467a549
.
This commit is contained in:
parent
a1cfe04a26
commit
c40727bfbb
6 changed files with 32 additions and 16 deletions
|
@ -5,6 +5,14 @@ $if(pandoc-version)$
|
|||
.\" Automatically generated by Pandoc $pandoc-version$
|
||||
.\"
|
||||
$endif$
|
||||
.\" Define V font for inline verbatim, using CB font in formats
|
||||
.\" that render this, and otherwise B font.
|
||||
.ie "\f[CB]x\f[]"x" \{\
|
||||
. ftr V B
|
||||
.\}
|
||||
.el \{\
|
||||
. ftr V CB
|
||||
.\}
|
||||
$if(adjusting)$
|
||||
.ad $adjusting$
|
||||
$endif$
|
||||
|
|
|
@ -287,8 +287,8 @@ inlineToMan opts (Quoted DoubleQuote lst) = do
|
|||
inlineToMan opts (Cite _ lst) =
|
||||
inlineListToMan opts lst
|
||||
inlineToMan opts (Code _ str) =
|
||||
withFontFeature 'B' $ withFontFeature 'C' $
|
||||
return (literal $ escString opts str)
|
||||
-- note that the V font is specially defined in the default man template
|
||||
withFontFeature 'V' (return (literal $ escString opts str))
|
||||
inlineToMan opts (Str str@(T.uncons -> Just ('.',_))) =
|
||||
return $ afterBreak "\\&" <> literal (escString opts str)
|
||||
inlineToMan opts (Str str) = return $ literal $ escString opts str
|
||||
|
|
|
@ -55,6 +55,7 @@ defaultWriterState = WriterState{ stHasInlineMath = False
|
|||
('I',False)
|
||||
, ('B',False)
|
||||
, ('C',False)
|
||||
, ('V',False)
|
||||
]
|
||||
, stHasTables = False
|
||||
}
|
||||
|
@ -106,6 +107,7 @@ fontChange = do
|
|||
features <- gets stFontFeatures
|
||||
inHeader <- gets stInHeader
|
||||
let filling = ['C' | fromMaybe False $ Map.lookup 'C' features] ++
|
||||
['V' | fromMaybe False $ Map.lookup 'V' features] ++
|
||||
['B' | inHeader ||
|
||||
fromMaybe False (Map.lookup 'B' features)] ++
|
||||
['I' | fromMaybe False $ Map.lookup 'I' features]
|
||||
|
|
|
@ -10,7 +10,7 @@ normal `code` normal.
|
|||
normal \f[I]italic \f[BI]bold in the middle\f[I] only italic\f[R]
|
||||
normal.
|
||||
.PP
|
||||
normal \f[B]bold \f[R]\f[C]code\f[R]\f[B] more bold\f[R] normal.
|
||||
normal \f[B]bold \f[VB]code\f[B] more bold\f[R] normal.
|
||||
.PP
|
||||
normal \f[B]\f[CB]code\f[B]\f[R] normal.
|
||||
normal \f[V]code\f[R] normal.
|
||||
```
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
: Write output to *OUTFILE* instead of `stdout`(3)
|
||||
^D
|
||||
.TP
|
||||
\f[B]\f[CB]-o\f[B]\f[R], \f[B]\f[CB]--output=\f[B]\f[R]\f[I]OUTFILE\f[R]
|
||||
Write output to \f[I]OUTFILE\f[R] instead of
|
||||
\f[B]\f[CB]stdout\f[B]\f[R](3)
|
||||
\f[V]-o\f[R], \f[V]--output=\f[R]\f[I]OUTFILE\f[R]
|
||||
Write output to \f[I]OUTFILE\f[R] instead of \f[V]stdout\f[R](3)
|
||||
```
|
||||
|
|
|
@ -1,3 +1,11 @@
|
|||
.\" Define V font for inline verbatim, using CB font in formats
|
||||
.\" that render this, and otherwise B font.
|
||||
.ie "\f[CB]x\f[]"x" \{\
|
||||
. ftr V B
|
||||
.\}
|
||||
.el \{\
|
||||
. ftr V CB
|
||||
.\}
|
||||
.TH "Pandoc Test Suite" "" "July 17, 2006" "" ""
|
||||
.hy
|
||||
.PP
|
||||
|
@ -487,9 +495,8 @@ So is \f[B]\f[BI]this\f[B]\f[R] word.
|
|||
.PP
|
||||
So is \f[B]\f[BI]this\f[B]\f[R] word.
|
||||
.PP
|
||||
This is code: \f[B]\f[CB]>\f[B]\f[R], \f[B]\f[CB]$\f[B]\f[R],
|
||||
\f[B]\f[CB]\[rs]\f[B]\f[R], \f[B]\f[CB]\[rs]$\f[B]\f[R],
|
||||
\f[B]\f[CB]<html>\f[B]\f[R].
|
||||
This is code: \f[V]>\f[R], \f[V]$\f[R], \f[V]\[rs]\f[R], \f[V]\[rs]$\f[R],
|
||||
\f[V]<html>\f[R].
|
||||
.PP
|
||||
[STRIKEOUT:This is \f[I]strikeout\f[R].]
|
||||
.PP
|
||||
|
@ -513,7 +520,7 @@ So is `pine.'
|
|||
.PP
|
||||
`He said, \[lq]I want to go.\[rq]' Were you alive in the 70\[cq]s?
|
||||
.PP
|
||||
Here is some quoted `\f[B]\f[CB]code\f[B]\f[R]' and a \[lq]quoted
|
||||
Here is some quoted `\f[V]code\f[R]' and a \[lq]quoted
|
||||
link (http://example.com/?foo=1&bar=2)\[rq].
|
||||
.PP
|
||||
Some dashes: one\[em]two \[em] three\[em]four \[em] five.
|
||||
|
@ -546,7 +553,7 @@ Here\[cq]s one that has a line break in it:
|
|||
.PP
|
||||
These shouldn\[cq]t be math:
|
||||
.IP \[bu] 2
|
||||
To get the famous equation, write \f[B]\f[CB]$e = mc\[ha]2$\f[B]\f[R].
|
||||
To get the famous equation, write \f[V]$e = mc\[ha]2$\f[R].
|
||||
.IP \[bu] 2
|
||||
$22,000 is a \f[I]lot\f[R] of money.
|
||||
So is $34,000.
|
||||
|
@ -554,7 +561,7 @@ So is $34,000.
|
|||
.IP \[bu] 2
|
||||
Shoes ($20) and socks ($5).
|
||||
.IP \[bu] 2
|
||||
Escaped \f[B]\f[CB]$\f[B]\f[R]: $73 \f[I]this should be emphasized\f[R] 23$.
|
||||
Escaped \f[V]$\f[R]: $73 \f[I]this should be emphasized\f[R] 23$.
|
||||
.PP
|
||||
Here\[cq]s a LaTeX table:
|
||||
.PP
|
||||
|
@ -687,7 +694,7 @@ An e-mail address: <nobody@nowhere.net>
|
|||
Blockquoted: <http://example.com/>
|
||||
.RE
|
||||
.PP
|
||||
Auto-links should not occur here: \f[B]\f[CB]<http://example.com/>\f[B]\f[R]
|
||||
Auto-links should not occur here: \f[V]<http://example.com/>\f[R]
|
||||
.IP
|
||||
.nf
|
||||
\f[C]
|
||||
|
@ -743,8 +750,8 @@ the first line of each block.
|
|||
.SS [3]
|
||||
.PP
|
||||
This is \f[I]easier\f[R] to type.
|
||||
Inline notes may contain links (http://google.com) and \f[B]\f[CB]]\f[B]\f[R]
|
||||
verbatim characters, as well as [bracketed text].
|
||||
Inline notes may contain links (http://google.com) and \f[V]]\f[R] verbatim
|
||||
characters, as well as [bracketed text].
|
||||
.SS [4]
|
||||
.PP
|
||||
In quote.
|
||||
|
|
Loading…
Add table
Reference in a new issue