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

commit13e443d7cc77aaf52712ebf2acbedb12090ef094 authorJohn MacFarlane <jgm@berkeley.edu> dateFri 19 Oct 2018, 23:01 (8 years ago) parentc018972
2 files changed+3−39
src/Text/Pandoc/Writers/Man.hs+3−1 test/writer.man−38
src/Text/Pandoc/Writers/Man.hs+3−1
@@ -253,7 +253,9 @@ definitionListItemToMan opts (label, defs) = do
253253 rest' <- liftM vcat $ mapM
254254 (\item -> blockToMan opts item) xs
255255 return $ first' $$
256− text ".RS" $$ rest' $$ text ".RE"
256+ if null xs
257+ then empty
258+ else text ".RS" $$ rest' $$ text ".RE"
257259 [] -> return empty
258260 return $ text ".TP" $$ nowrap (text ".B " <> labelText) $$ contents
259261
test/writer.man−38
@@ -320,52 +320,34 @@ Tight using spaces:
320320.TP
321321.B apple
322322red fruit
323−.RS
324−.RE
325323.TP
326324.B orange
327325orange fruit
328−.RS
329−.RE
330326.TP
331327.B banana
332328yellow fruit
333−.RS
334−.RE
335329.PP
336330Tight using tabs:
337331.TP
338332.B apple
339333red fruit
340−.RS
341−.RE
342334.TP
343335.B orange
344336orange fruit
345−.RS
346−.RE
347337.TP
348338.B banana
349339yellow fruit
350−.RS
351−.RE
352340.PP
353341Loose:
354342.TP
355343.B apple
356344red fruit
357−.RS
358−.RE
359345.TP
360346.B orange
361347orange fruit
362−.RS
363−.RE
364348.TP
365349.B banana
366350yellow fruit
367−.RS
368−.RE
369351.PP
370352Multiple blocks with italics:
371353.TP
@@ -395,47 +377,27 @@ Multiple definitions, tight:
395377.TP
396378.B apple
397379red fruit
398−.RS
399−.RE
400380computer
401−.RS
402−.RE
403381.TP
404382.B orange
405383orange fruit
406−.RS
407−.RE
408384bank
409−.RS
410−.RE
411385.PP
412386Multiple definitions, loose:
413387.TP
414388.B apple
415389red fruit
416−.RS
417−.RE
418390computer
419−.RS
420−.RE
421391.TP
422392.B orange
423393orange fruit
424−.RS
425−.RE
426394bank
427−.RS
428−.RE
429395.PP
430396Blank line after term, indented marker, alternate markers:
431397.TP
432398.B apple
433399red fruit
434−.RS
435−.RE
436400computer
437−.RS
438−.RE
439401.TP
440402.B orange
441403orange fruit