gbranden pushed a commit to branch master in repository groff. commit ab3dce5777ed641cf5788eeaf962ed692fa25bae Author: G. Branden Robinson <g.branden.robin...@gmail.com> AuthorDate: Thu Feb 1 19:35:15 2024 -0600
[man]: Refactor, giving `TP` its own trap. * tmac/an.tmac: Refactor. Give `TP` its own trap. (an*TP-trap): New macro takes over some of the former functions of `an-input-trap` and `an-write-paragraph-tag`, ending the paragraph tag diversion, restoring the adjustment mode and line length, and calling `an-write-paragraph-tag`... (an-write-paragraph-tag): ...which now deals only with formatting the tag. (an-input-trap): Ensure that `an*TP-trap` is sprung when input line traps overlap... (an-end): ...and when an ill-formed document ends with an input trap pending. --- ChangeLog | 14 ++++++++++++++ tmac/an.tmac | 22 ++++++++++++++++------ 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5095d2a50..4c6e8659f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2024-02-01 G. Branden Robinson <g.branden.robin...@gmail.com> + + * tmac/an.tmac: Refactor. Give `TP` its own trap. + (an*TP-trap): New macro takes over some of the former functions + of `an-input-trap` and `an-write-paragraph-tag`, ending the + paragraph tag diversion, restoring the adjustment mode and line + length, and calling `an-write-paragraph-tag`... + (an-write-paragraph-tag): ...which now deals only with + formatting the tag. + (an-input-trap): Ensure that `an*TP-trap` is sprung when input + line traps overlap... + (an-end): ...and when an ill-formed document ends with an input + trap pending. + 2024-02-01 G. Branden Robinson <g.branden.robin...@gmail.com> * tmac/an.tmac: Refactor. diff --git a/tmac/an.tmac b/tmac/an.tmac index 1852f1219..e09a0d275 100644 --- a/tmac/an.tmac +++ b/tmac/an.tmac @@ -111,6 +111,7 @@ .de1 an-end . if !r an-TH-was-called .return . an-input-trap +. if '\\n[.z]'an*paragraph-tag' .an*TP-trap . if \\n[cR] \{\ . \" We might have a pending output line that is not yet broken, and . \" also be 1v from the bottom of the page. If we break (or flush) @@ -637,10 +638,6 @@ contains unsupported escape sequence .\" Output the tag of a tagged paragraph, or of an indented paragraph .\" (IP) that has a tag. Whether we break depends on the tag width. .de an-write-paragraph-tag -. br -. di -. ad \\*[AD] -. ll . \" We must emit the diversion in a separate environment to ensure . \" that a possible margin character is printed correctly. . ev an*temporary-env @@ -666,8 +663,8 @@ contains unsupported escape sequence .. . .\" Handle macros that may take an "argument" on the next input line -.\" producing written or drawn output: .SH, .SS, .B, .I, .SM, .SB--and -.\" .TP, which does so mandatorily. +.\" producing written or drawn output: .SH, .SS, .B, .I, .SM, .SB. +.\" For .TP, see below. .de1 an-input-trap . if \\n[an-devtag-needs-end-of-heading] .DEVTAG-EO-H . nr an-devtag-needs-end-of-heading 0 @@ -684,6 +681,19 @@ contains unsupported escape sequence . ns . nr an-need-no-space-mode 0 . \} +. \" Handle nested traps, as with +. \" .TP +. \" .B foo +. \" for instance. +. if '\\n[.z]'an*paragraph-tag' .an*TP-trap +.. +. +.\" The TP macro _requires_ a one-line input trap. +.de1 an*TP-trap +. br +. di +. ad \\*[AD] +. ll . if \\n[an*have-paragraph-tag] .an-write-paragraph-tag .. . _______________________________________________ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit