Man writer: fixed boldfacing of definition terms.

Previously the bold-facing would be interrupted by
other formatting, because we used `.B`.

Closes #5620.
This commit is contained in:
John MacFarlane 2019-07-13 16:11:58 -07:00
parent a16311c225
commit d0bf7efe95
3 changed files with 28 additions and 19 deletions

View file

@ -228,7 +228,7 @@ definitionListItemToMan :: PandocMonad m
-> ([Inline],[[Block]])
-> StateT WriterState m Doc
definitionListItemToMan opts (label, defs) = do
labelText <- inlineListToMan opts label
labelText <- withFontFeature 'B' (inlineListToMan opts label)
contents <- if null defs
then return empty
else liftM vcat $ forM defs $ \blocks ->
@ -245,7 +245,7 @@ definitionListItemToMan opts (label, defs) = do
then empty
else text ".RS" $$ rest' $$ text ".RE"
[] -> return empty
return $ text ".TP" $$ nowrap (text ".B " <> labelText) $$ contents
return $ text ".TP" $$ labelText $$ contents
-- | Convert list of Pandoc block elements to man.
blockListToMan :: PandocMonad m

9
test/command/5620.md Normal file
View file

@ -0,0 +1,9 @@
```
% pandoc -t man
`-o`, `--output=`*OUTFILE*
: Write output to *OUTFILE* instead of `stdout`(3)
^D
.TP
\f[B]\f[CB]-o\f[B], \f[CB]--output=\f[B]\f[BI]OUTFILE\f[B]\f[R]
Write output to \f[I]OUTFILE\f[R] instead of \f[C]stdout\f[R](3)
```

View file

@ -318,47 +318,47 @@ Williams
.PP
Tight using spaces:
.TP
.B apple
\f[B]apple\f[R]
red fruit
.TP
.B orange
\f[B]orange\f[R]
orange fruit
.TP
.B banana
\f[B]banana\f[R]
yellow fruit
.PP
Tight using tabs:
.TP
.B apple
\f[B]apple\f[R]
red fruit
.TP
.B orange
\f[B]orange\f[R]
orange fruit
.TP
.B banana
\f[B]banana\f[R]
yellow fruit
.PP
Loose:
.TP
.B apple
\f[B]apple\f[R]
red fruit
.TP
.B orange
\f[B]orange\f[R]
orange fruit
.TP
.B banana
\f[B]banana\f[R]
yellow fruit
.PP
Multiple blocks with italics:
.TP
.B \f[I]apple\f[R]
\f[B]\f[BI]apple\f[B]\f[R]
red fruit
.RS
.PP
contains seeds, crisp, pleasant to taste
.RE
.TP
.B \f[I]orange\f[R]
\f[B]\f[BI]orange\f[B]\f[R]
orange fruit
.RS
.IP
@ -375,31 +375,31 @@ orange block quote
.PP
Multiple definitions, tight:
.TP
.B apple
\f[B]apple\f[R]
red fruit
computer
.TP
.B orange
\f[B]orange\f[R]
orange fruit
bank
.PP
Multiple definitions, loose:
.TP
.B apple
\f[B]apple\f[R]
red fruit
computer
.TP
.B orange
\f[B]orange\f[R]
orange fruit
bank
.PP
Blank line after term, indented marker, alternate markers:
.TP
.B apple
\f[B]apple\f[R]
red fruit
computer
.TP
.B orange
\f[B]orange\f[R]
orange fruit
.RS
.IP "1." 3