Hi Alex, At 2024-07-13T09:32:10-0500, G. Branden Robinson wrote: > Yes, sort of--it seems I managed to screw it up. On top of that I > wrote a particularly dumb test for it.
Try the attached patches. Regards, Branden
From 967bbf36a3c1ef6d22c0f5b223cb792bf9ace49e Mon Sep 17 00:00:00 2001 From: "G. Branden Robinson" <g.branden.robin...@gmail.com> Date: Sat, 13 Jul 2024 09:57:08 -0500 Subject: [PATCH 1/2] [man]: Test `YS` macro harder. * tmac/tests/an-ext_SY-and-YS-work.sh: Test new behavior of `YS` when given an argument. Test fails at this commit. --- ChangeLog | 5 +++++ tmac/tests/an-ext_SY-and-YS-work.sh | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index caeac9e66..90aff0aea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2024-07-13 G. Branden Robinson <g.branden.robin...@gmail.com> + + * tmac/tests/an-ext_SY-and-YS-work.sh: Test new behavior of `YS` + when given an argument. + 2024-07-13 G. Branden Robinson <g.branden.robin...@gmail.com> * src/preproc/eqn/main.cpp (main): diff --git a/tmac/tests/an-ext_SY-and-YS-work.sh b/tmac/tests/an-ext_SY-and-YS-work.sh index a3da599d2..71d1199eb 100755 --- a/tmac/tests/an-ext_SY-and-YS-work.sh +++ b/tmac/tests/an-ext_SY-and-YS-work.sh @@ -125,12 +125,12 @@ foo \\- a small library for converting strings to integers .BI TYPE\~ max ); .YS . . -.B int +.B unsigned int .SY a2u ( .B TYPE, .BI TYPE\~*restrict\~ n , .BI const\~char\~* s , -.BI char\~**_Nullable\~restrict\~ endp , +.BI char\~**_NotNullable\~restrict\~ endp , .BI int\~ base , .BI TYPE\~ min , .BI TYPE\~ max ); @@ -139,6 +139,9 @@ foo \\- a small library for converting strings to integers output2=$(echo "$input2" | "$groff" -rLL=80n -man -T ascii -P -cbou) echo "$output2" +echo 'checking for indentation reuse' >&2 +echo "$output2" | grep -Eq '^ {13}char \*\*_NotNullable' || wail + echo 'checking for automatic hyphenation disablement inside synopsis' \ >&2 echo "$output2" | grep -q 're-$' && wail -- 2.30.2
From a89bdb1e7543d9e0d6079c0866cfc0cc7a1aef66 Mon Sep 17 00:00:00 2001 From: "G. Branden Robinson" <g.branden.robin...@gmail.com> 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 <g.branden.robin...@gmail.com> + + * 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 <g.branden.robin...@gmail.com> * 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
signature.asc
Description: PGP signature