gbranden pushed a commit to branch master
in repository groff.
commit 908aabbf0cdfeaaf51fcf4b4367522fbfbd47a29
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sun Apr 19 09:57:33 2026 -0500
doc/groff.texi.in: Expand nested condit'l example.
Illustrate interaction of brace escape sequences with string assignment.
Add a rule of thumb for reasoning about how \} sequences work.
---
doc/groff.texi.in | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/doc/groff.texi.in b/doc/groff.texi.in
index 8cd8296d8..e1bb2c87d 100644
--- a/doc/groff.texi.in
+++ b/doc/groff.texi.in
@@ -16324,13 +16324,32 @@ U
@result{} N O U
@endExample
-The above behavior may challenge the intuition; it was implemented to
-retain compatibility with @acronym{AT&T} @code{troff}. For clarity, it
+@Example
+.ie 1 \@{\
+. ds a abc\@}def
+a="\*a"
+.el ghi
+ @result{} a="abcdef"
+@endExample
+
+The above behavior may challenge the intuition;
+it was implemented to retain compatibility with @acronym{AT&T}
+@command{troff}.
+A right-brace escape sequence governs flow of control this way:@:
+if a branch is
+@emph{not}
+taken,
+then the closing brace that closes a conditional block
+causes the formatter to ignore the entire input line
+on which it appears for all purposes except matching braces.
+
+For clarity, it
is idiomatic to end input lines with @code{\@{} (followed by
@code{\@key{RET}} if appropriate), and to precede @code{\@}} on an input
line with nothing more than a control character, spaces, tabs, and other
instances of itself.
+@need 1000
We can use @code{ie}, @code{el}, and conditional blocks to simulate the
multi-way ``switch'' or ``case'' control structures of other languages.
The following example is adapted from the @code{groff} @file{man}
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit