groff
[Top][All Lists]
Advanced

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

Re: [Groff] ".if '...'...' \# comments ..." Bug?


From: Andrew J. Piziali
Subject: Re: [Groff] ".if '...'...' \# comments ..." Bug?
Date: Sun, 11 Apr 2004 12:49:43 -0500 (CDT)

Alejandro, you wrote:

    At 09:18 a.m. 11/04/2004, Andrew J. Piziali wrote:

    >    I noticed an odd behavior using groff 1.18 with the .if request
    >and '...'...' expression.  The following request sequence operates
    >as expected:

    >     .if '\*[FunctionalVerificationAspectsFigure]'' \
    >     .  ds FunctionalVerificationAspectsFigure 999

    >If string register FunctionalVerificationAspectsFigure is null, the
    >.ds request initializes it.  However, when the .if request has \#
    >comment appended to the line:

    >     .if '\*[FunctionalVerificationAspectsFigure]'' \# formatting of this
    >     .  ds FunctionalVerificationAspectsFigure 999

    >the .ds request is unconditionally executed, independent of the
    >value of FunctionalVerificationAspectsFigure.

    >    I thought the \#, and everything following it, was supposed to
    >be ignored so that groff sees one line:

    >     .if '\*[FunctionalVerificationAspectsFigure]'' .  ds 
FunctionalVerificationAspectsFigure 999

    There is no bug.  You have no line break sign in your second example;
    just an inlined comment.  And, if groff worked with the syntax you
    expect...  Now, *that* would be a bug [I leave the demonstration to
    the reader; see groff(7)].

There is no line break in the first or second example.  Example one:

    .if '\*[FunctionalVerificationAspectsFigure]'' \
    .  ds FunctionalVerificationAspectsFigure 999

is equivalent to:

    .if '\*[FunctionalVerificationAspectsFigure]'' .  ds 
FunctionalVerificationAspectsFigure 999

as is example two:

    .if '\*[FunctionalVerificationAspectsFigure]'' \# formatting of this
    .  ds FunctionalVerificationAspectsFigure 999

Why?  Because groff ignores the \#, as well as the rest of the line,
including the newline.  In the words of the groff info page:

     To avoid all this, `gtroff' has a new comment mechanism using the
     `\#' escape.  This escape works the same as `\"' except that the
     newline is also ignored:


          Test
          \# comment
          Test

     produces


          Test Test

     as expected.


-- 
                                                        |
address@hidden                       ________------+------________
                                                       / \
                                                      *---*


reply via email to

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