From 16d4788cef7bb58fdc8820bdd5ecb511933f0d15 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Mon, 3 Aug 2020 11:02:57 +0000 Subject: Put the code handling \} into a new function roff_cond_checkend() and call that function not only from both places where copies existed - when processing text lines and when processing request/macro lines in conditional block scope - but also when closing a macro definition request, such that this construction works: .if n \{.de macroname macro content .. \} ignored arguments .macroname This fixes a bug reported by John Gardner . While here, avoid a confusing decrement of the line scope counter in roffnode_cleanscope() for conditional blocks that do not have line scope in the first place (no functional change for this part). Also improve validation of an internal invariant in roff_cblock() and polish some comments. --- regress/roff/cond/de.in | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 regress/roff/cond/de.in (limited to 'regress/roff/cond/de.in') diff --git a/regress/roff/cond/de.in b/regress/roff/cond/de.in new file mode 100644 index 00000000..eeaeb295 --- /dev/null +++ b/regress/roff/cond/de.in @@ -0,0 +1,19 @@ +.\" $OpenBSD: de.in,v 1.1 2020/08/03 10:52:39 schwarze Exp $ +.TH COND-DE 1 "August 3, 2020" +.SH NAME +cond-de \- close macro definition and conditional block on the same line +.SH DESCRIPTION +.if n \{.de m1 +first content +.. \} +.if n \{.de m2 +second content +.. \}ignored +.if t \{.de m3 +does not show up +.. \}ignored +initial text +.m1 +.m2 +.m3 +final text -- cgit v1.2.3-56-ge451