Man writer: avoid unnecessary .RS/.RE pair in defn lists.

When the definition is just one paragraph, we don't need
the `.RS\n.RE`.
This commit is contained in:
John MacFarlane 2018-10-19 23:01:02 -07:00
parent c01897281a
commit 13e443d7cc
2 changed files with 3 additions and 39 deletions

View file

@ -253,7 +253,9 @@ definitionListItemToMan opts (label, defs) = do
rest' <- liftM vcat $ mapM
(\item -> blockToMan opts item) xs
return $ first' $$
text ".RS" $$ rest' $$ text ".RE"
if null xs
then empty
else text ".RS" $$ rest' $$ text ".RE"
[] -> return empty
return $ text ".TP" $$ nowrap (text ".B " <> labelText) $$ contents

View file

@ -320,52 +320,34 @@ Tight using spaces:
.TP
.B apple
red fruit
.RS
.RE
.TP
.B orange
orange fruit
.RS
.RE
.TP
.B banana
yellow fruit
.RS
.RE
.PP
Tight using tabs:
.TP
.B apple
red fruit
.RS
.RE
.TP
.B orange
orange fruit
.RS
.RE
.TP
.B banana
yellow fruit
.RS
.RE
.PP
Loose:
.TP
.B apple
red fruit
.RS
.RE
.TP
.B orange
orange fruit
.RS
.RE
.TP
.B banana
yellow fruit
.RS
.RE
.PP
Multiple blocks with italics:
.TP
@ -395,47 +377,27 @@ Multiple definitions, tight:
.TP
.B apple
red fruit
.RS
.RE
computer
.RS
.RE
.TP
.B orange
orange fruit
.RS
.RE
bank
.RS
.RE
.PP
Multiple definitions, loose:
.TP
.B apple
red fruit
.RS
.RE
computer
.RS
.RE
.TP
.B orange
orange fruit
.RS
.RE
bank
.RS
.RE
.PP
Blank line after term, indented marker, alternate markers:
.TP
.B apple
red fruit
.RS
.RE
computer
.RS
.RE
.TP
.B orange
orange fruit