Skip to content

Commit

Permalink
Force ragged-right justification with groff 1.23.0
Browse files Browse the repository at this point in the history
groff 1.23.0 added code to the an macro underlying .IP and .TP that
resets the justification to the AD register, which defaults to b
(full justification). Pod::Man attempts to force ragged-right
justification under nroff with .if n .ad l after .TH, but that change
was reverted in the first =item list, resulting in strange-looking
formatted manual pages in a terminal.

Work around this by setting the AD string to l if the formatter is
nroff in the preamble of each page. This undermines the intended
upstream use of AD as a way for the user to override the formatting,
but Pod::Man-generated man pages already didn't support that and
there currently is no clean way to support the AD string while still
changing the default under nroff to ragged-right justification, as has
been the practice of Pod::Man since its first release in 1999.

Fixes #23
  • Loading branch information
rra committed Mar 19, 2024
1 parent d160064 commit 53293fa
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 3 deletions.
4 changes: 4 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ v6.0.0 - Not Released
at build time. Thanks to Marco Sirabella for the analysis and an
initial patch. (GitHub #21)

- Add a workaround to Pod::Man to force persistent ragged-right
justification under nroff with groff 1.23.0. Thanks to Guillem Jover
for the report and G. Branden Robinson for the analysis. (GitHub #23)

- Fix wrapping of text with S<> markup in all subclasses of Pod::Text.
Thanks to Jim Avera for the report. (GitHub #24)

Expand Down
8 changes: 5 additions & 3 deletions THANKS
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,10 @@ title of a simple module and for how best to suppress Encode warnings
during Perl core builds.

Guillem Jover, for the formatting change for manual page references and
function names to match the Linux manual page standard, and reporting a
function names to match the Linux manual page standard, reporting a
diagnostic bug when pod2man or pod2text gets empty input on standard
input.
input, and reporting a groff 1.23.0 regression with ragged-right
justification.

Zefram, for analyzing and fixing a problem with the UTF-8 layer detection
code in Pod::Man.
Expand Down Expand Up @@ -237,7 +238,8 @@ continued farther than they should in Pod::Man output if they were
combined with C<> and fixed-width fonts, and for finding a subtle spacing
bug with nested =items without bodies.

G. Branden Robinson, for his assistance in understanding *roff syntax.
G. Branden Robinson, for his assistance in understanding *roff syntax and
analysis of groff justification changes.

youpong, for reporting a double-encoding bug with a :utf8 output layer.

Expand Down
3 changes: 3 additions & 0 deletions lib/Pod/Man.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1620,6 +1620,9 @@ sub preamble_template {
. \}
.\}
.rr rF
.\"
.\" Required to disable full justification in groff 1.23.0.
.if n .ds AD l
----END OF PREAMBLE----

if ($$self{ENCODING} eq 'roff') {
Expand Down
3 changes: 3 additions & 0 deletions t/data/man/encoding.groff
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@
. \}
.\}
.rr rF
.\"
.\" Required to disable full justification in groff 1.23.0.
.if n .ds AD l
.\" ========================================================================
.\"
.IX Title "ENCODING 1"
Expand Down
3 changes: 3 additions & 0 deletions t/data/man/encoding.roff
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@
.\}
.rr rF
.\"
.\" Required to disable full justification in groff 1.23.0.
.if n .ds AD l
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff
Expand Down
3 changes: 3 additions & 0 deletions t/data/man/encoding.utf8
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@
. \}
.\}
.rr rF
.\"
.\" Required to disable full justification in groff 1.23.0.
.if n .ds AD l
.\" ========================================================================
.\"
.IX Title "ENCODING 1"
Expand Down

0 comments on commit 53293fa

Please sign in to comment.