From a89bdb1e7543d9e0d6079c0866cfc0cc7a1aef66 Mon Sep 17 00:00:00 2001 From: "G. Branden Robinson" Date: Sat, 13 Jul 2024 10:07:54 -0500 Subject: [PATCH 2/2] [man]: Really implement new `YS` feature. Continues commits a08908f982, 3 May, and 89fba7bf96, 6 May. * tmac/an-ext.tmac: Fix incomplete changes to support `YS` with an argument to reuse indentation of previous synopsis. (An insufficiently aggressive test case is a dangerous thing.) Revise meaning of `mS` register from "are we in a synopsis?" to "are we reusing the previous synopsis's indentation?" (SY): Save hyphenation and adjustment modes and disable automatic hyphenation if we have any arguments. (YS): Set `mS` register if we have any arguments, otherwise clear it. * tmac/tests/an_HY-register-works.sh: Drop test cases on "nested" synopses. These are now ill-formed and no longer supported. See "NEWS" file. --- ChangeLog | 16 ++++++++++++++++ tmac/an-ext.tmac | 14 +++++++------- tmac/tests/an_HY-register-works.sh | 24 ------------------------ 3 files changed, 23 insertions(+), 31 deletions(-) diff --git a/ChangeLog b/ChangeLog index 90aff0aea..8cbf4e57c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2024-07-13 G. Branden Robinson + + * tmac/an-ext.tmac: Fix incomplete changes to support `YS` with + an argument to reuse indentation of previous synopsis. (An + insufficiently aggressive test case is a dangerous thing.) + Revise meaning of `mS` register from "are we in a synopsis?" to + "are we reusing the previous synopsis's indentation?" + (SY): Save hyphenation and adjustment modes and disable + automatic hyphenation if we have any arguments. + (YS): Set `mS` register if we have any arguments, otherwise + clear it. + + * tmac/tests/an_HY-register-works.sh: Drop test cases on + "nested" synopses. These are now ill-formed and no longer + supported. See "NEWS" file. + 2024-07-13 G. Branden Robinson * tmac/tests/an-ext_SY-and-YS-work.sh: Test new behavior of `YS` diff --git a/tmac/an-ext.tmac b/tmac/an-ext.tmac index 05ce17c70..9c59c5081 100644 --- a/tmac/an-ext.tmac +++ b/tmac/an-ext.tmac @@ -49,7 +49,7 @@ .de mY . do nr mH \\n[.hy] \" groff extension register .. . -.nr mS 0 \" in a synopsis (SY/YS)? +.nr mS 0 \" reuse indentation of previous synopsis? .nr mE 0 \" in an example (EX/EE)? . . @@ -57,10 +57,6 @@ .de mY .de SY . ie \\n(.$ \{\ . if !\\n(mS \{\ -. mY -. nh -. nr mS 1 -. nr mA \\n(.j . nr mI \\n(.i . nr mT \\n(.k+\w'\fB\\$1\fP' . if \\n(.$=1 \ @@ -69,6 +65,9 @@ .de SY . nr mT +\w'\fB\\$2\fP' . \} . +. mY +. nh +. nr mA \\n(.j . ad l . \" Ensure that a partially collected line exists so that the `in` . \" request affects only _subsequent_ output lines. (CSTR #54 ยง6) @@ -101,9 +100,10 @@ .de YS . in \\n(mIu . ad \\n(mA . hy \\n(mH -. nr mS 0 . -. if !\\n(.$ \{\ +. ie \\n(.$ .nr mS 1 +. el \{\ +. nr mS 0 . rr mA . rr mI . rr mT diff --git a/tmac/tests/an_HY-register-works.sh b/tmac/tests/an_HY-register-works.sh index fc7a7a5ab..9849761d7 100755 --- a/tmac/tests/an_HY-register-works.sh +++ b/tmac/tests/an_HY-register-works.sh @@ -49,30 +49,6 @@ echo "$output" echo "checking hyphenation when HY is 0" >&2 echo "$output" | grep -Eq "to +disestablish$" || wail -input='.TH foo 1 2023-01-08 "groff test suite" -.SH Name -foo \- frobinicate a bar -.SH Synopsis -.SY foo -.SY foo -.I arbitrary-argument -.YS -.SH Description -Now is the time for all good citizens to disestablish -antidisestablishmentarianism.' - -output=$(printf "%s\n" "$input" | "$groff" -man -Tascii -P-cbou) -echo "$output" - -echo "checking hyphenation when HY is default and .SY nested" >&2 -echo "$output" | grep -q "antidisestablishmen-$" || wail - -output=$(printf "%s\n" "$input" | "$groff" -rHY=0 -man -Tascii -P-cbou) -echo "$output" - -echo "checking hyphenation when HY is 0 and .SY nested" >&2 -echo "$output" | grep -Eq "to +disestablish$" || wail - test -z "$fail" # vim:set ai et sw=4 ts=4 tw=72: -- 2.30.2