bug-groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #52526] [gn]roff: no warning or error when a line ends with "\{"


From: G. Branden Robinson
Subject: [bug #52526] [gn]roff: no warning or error when a line ends with "\{"
Date: Mon, 7 Jun 2021 22:04:19 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0

Update of bug #52526 (project groff):

                  Status:                    None => Invalid                
             Assigned to:                    None => gbranden               
             Open/Closed:                    Open => Closed                 

    _______________________________________________________

Follow-up Comment #2:

I don't believe this report is correct.

groff's behavior is consistent with both Heirloom Doctools nroff and Version 7
Unix nroff.

Input:

.ie t \{
.  tm this is the t-block
.\}
.el \{
. tm this is the n-block
.\}
.pl \n(nlu


groff output:

this is the n-block



Heirloom output:


this is the n-block


AT&T output (with the whole SIMH session just for fun):

$ pdp11 

PDP-11 simulator V3.8-1
sim> set cpu 11/45
Disabling XQ
sim> set tto7b
Non-existent unit
sim> set tto 7b
sim> att rl unix_v7_rl.dsk
sim> boot rl
@boot
New Boot, known devices are hp ht rk rl rp tm vt 
: rl(0,0)wlrl2unix
wlrl2unix not found
: rl(0,0)rl2unix
mem = 177856
# Restricted rights: Use, duplication, or disclosure
is subject to restrictions stated in your contract with
Western Electric Company, Inc.
Thu Sep 22 06:22:30 EDT 1988

login: dmr
$ cat >52526.roff
.ie t \{
.  tm this is the t-block
.\}
.el \{
. tm this is the n-block
.\}
.pl \n(nlu
$ cat 52526.roff
.ie t \{
.  tm this is the t-block
.\}
.el \{
. tm this is the n-block
.\}
.pl \n(nlu
$ nroff 52526.roff

this is the n-block


I believe recent updates to our documentation have made this subject much
clearer.


5.20.2 if-then
--------------

 -- Request: .if cond-expr anything
     Evaluate the conditional expression COND-EXPR, and if it evaluates
     true (that is, to a positive value), interpret the remainder of the
     line ANYTHING as if it were an input line.  Recall from *note
     Request and Macro Arguments:: that any number of spaces between
     arguments to requests serves only to separate them; leading spaces
     in ANYTHING are thus not seen.  ANYTHING effectively _cannot_ be
     omitted; if COND-EXPR is true and ANYTHING is empty, the newline at
     the end of the control line is interpreted as a blank input line
     (and therefore a blank text line).

          super\c
          tanker
          .nr force-word-break 1
          super\c
          .if ((\n[force-word-break] = 1) & \n[.int])
          tanker
              => supertanker super tanker

...

5.20.4 Conditional Blocks
-------------------------

 -- Escape: \{
 -- Escape: \}
     It is frequently desirable for a control structure to govern more
     than one request, call more than one macro, span more than one
     input line of text, or mix the foregoing.  The opening and closing
     brace escapes '\{' and '\}' perform such grouping.  Brace escapes
     can be used outside of control structures, but when they are they
     have no meaning and produce no output.

     '\{' should appear (after optional spaces and tabs) immediately
     subsequent to the request's conditional expression.  '\}' should
     appear on a line with other occurrences of itself as necessary to
     match '\{' escapes.  It can be preceded by a control character,
     spaces, and tabs.  Input after a '\}' escape on the same line is
     processed only if all of the preceding conditions to which the
     escapes correspond are true.  Furthermore, a '\}' closing the body
     of a 'while' request (discussed below) must be the last such escape
     on an input line.

          A
          .if 0 \{ B
          C
          D
          \}E
          F
              => A F

          N
          .if 1 \{ O
          .  if 0 \{ P
          Q
          R\} S\} T
          U
              => N O U

     The above behavior may challenge the intuition; it was implemented
     to retain compatibility with AT&T 'troff'.  For clarity, it is
     idiomatic to end input lines with '\{', followed by '\<RET>' if
     desired to prevent the newline from being interpreted as a blank
     text line, and to have nothing more than a control character,
     spaces, and tabs preceding '\}' on an input line.

          .de DEBUG
          debug =
          .ie \\$1 \{\
          ON,
          development
          \}
          .el \{\
          OFF,
          production
          \}
          version
          ..
          .DEBUG 0
          .br
          .DEBUG 1

     Try omitting the '\<RET>'s from the foregoing example and see how
     the output changes.  Remember that, as noted above, after a true
     conditional (or after the 'el' request if its counterpart 'ie'
     condition was false) the remainder of the input line is interpreted
     _as if it were on an input line by itself_.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?52526>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]