gbranden pushed a commit to branch master in repository groff. commit 6fc5ea05dd83116b0e99ebaea2849526fbbab8ed Author: G. Branden Robinson <g.branden.robin...@gmail.com> AuthorDate: Wed Jul 23 23:41:49 2025 -0500
tman/an.tmac: Refactor (2/2). * tmac/an.tmac (an*reset-paragraph-parameters): New macro resets the font style, type size, and vertical spacing, but not the line length. (TH, an*input-trap, an*break-paragraph): Call it instead of invoking the corresponding requests directly. (TH, P, HP): Reset line length to configured `LL` register value. (TH): Reset indentation to zero. A well-formed man(7) document formats no text between a `TH` call and an `SH` call, but a predictable indentation is useful for crafting test cases. --- ChangeLog | 13 +++++++++++++ tmac/an.tmac | 31 ++++++++++++++++++++----------- 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3ad5c2140..da6548ad3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2025-07-23 G. Branden Robinson <g.branden.robin...@gmail.com> + + * tmac/an.tmac: Refactor. + (an*reset-paragraph-parameters): New macro resets the font + style, type size, and vertical spacing, but not the line length. + (TH, an*input-trap, an*break-paragraph): Call it instead of + invoking the corresponding requests directly. + (TH, P, HP): Reset line length to configured `LL` register + value. + (TH): Reset indentation to zero. A well-formed man(7) document + formats no text between a `TH` call and an `SH` call, but a + predictable indentation is useful for crafting test cases. + 2025-07-20 G. Branden Robinson <g.branden.robin...@gmail.com> * tmac/an.tmac: Refactor. diff --git a/tmac/an.tmac b/tmac/an.tmac index 52ebb0ff0..ed3f4875a 100644 --- a/tmac/an.tmac +++ b/tmac/an.tmac @@ -148,6 +148,16 @@ . nr an-saved-prevailing-indent!1 \\n[IN] .. . +.\" We don't handle the line length here because its handling differs +.\" between (P, LP, PP, HP) and (IP, TP) paragraphs. +.de an*reset-paragraph-parameters +. ft R +. ps \\n[PS]u +. vs \\n[VS]u +. \" TODO: ad \\*[AD] +. \" TODO: hy \\n[HY] +.. +. .\" This logic would be part of `an*reset-paragraph-parameters`, but .\" unfortunately we have to support the legacy `PD` macro, which .\" permits unseemly fiddling at arbitrary places in the text. (99 @@ -156,7 +166,9 @@ . ie \\n[.$] .nr PD (v;\\$1) . el .nr PD (.4v >? \n[.V]) . \" Restore spacing to handle a "belated" `PD` call immediately after -. \" a paragraphing macro (`P`, `HP`, or `IP` with no marker argument). +. \" a paragraphing macro (`P`, `HP`, or `IP` with no marker argument), +. \" maintaining compatibility with Unix Version 7 man and descendants. +. \" See Savannah #64267. . rs .. . @@ -278,11 +290,10 @@ . nr an-was-tbl-failure-reported 0 . . an*reset-section-parameters -. ft R -. ps \\n[PS]u -. vs \\n[VS]u -. ad \\*[AD] +. ad \\*[AD] \" TODO: Handle this in `an*reset-paragraph-parameters`. +. an*reset-paragraph-parameters . ll \\n[LL]u +. in 0 \" Well-formed documents call `SH` after `TH`. . an*reset-hyphenation-mode . an*reset-tab-stops . an*reset-paragraph-spacing @@ -652,9 +663,7 @@ contains unsupported escape sequence . nr an-devtag-needs-end-of-heading 0 . if \\n[an-devtag-needs-second-column] .DEVTAG-COL 2 . nr an-devtag-needs-second-column 0 -. ft R -. ps \\n[PS]u -. vs \\n[VS]u +. an*reset-paragraph-parameters . if \\n[an-need-break] \{\ . br . nr an-need-break 0 @@ -685,9 +694,7 @@ contains unsupported escape sequence . .\" Break a paragraph. Restore defaults, except for indentation. .de an*break-paragraph -. ft R -. ps \\n[PS]u -. vs \\n[VS]u +. an*reset-paragraph-parameters . sp \\n[PD]u . ns .. @@ -797,6 +804,7 @@ contains unsupported escape sequence .\" Set an ordinary paragraph. .de1 P . an*break-paragraph +. ll \\n[LL]u . in \\n[an-margin]u . nr an-prevailing-indent \\n[IN] .. @@ -845,6 +853,7 @@ contains unsupported escape sequence .\" .HP [indent] .de1 HP . an*break-paragraph +. ll \\n[LL]u . ne (1v + 1u) . if \\n[.$] .nr an-prevailing-indent (n;\\$1) . in (\\n[an-margin]u + \\n[an-prevailing-indent]u) _______________________________________________ groff-commit mailing list groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit