groff
[Top][All Lists]
Advanced

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

Re: [Groff] Comments affecting groff output?


From: Ted Harding
Subject: Re: [Groff] Comments affecting groff output?
Date: Wed, 13 Jul 2011 22:34:01 +0100 (BST)

On 13-Jul-11 21:07:22, Tadziu Hoffmann wrote:
> 
>> I  have come across a very strage situation in which
>> the behaviour of groff seems to depend on:
>>
>>   a.  whether it happens in a diversion or not and
>>   b.  the presence of a comment.
> 
> 
> Multiline conditionals are a bit tricky.
> The following conditionals should work:
> 
>   .if condition stuff
> 
>   .if condition \
>   stuff
> 
>   .if condition \{stuff\}
> 
>   .if condition \{\
>   stuff\}
> 
>   .if condition \{\
>   stuff
>   more stuff\}
> 
>   .if condition \{\
>   stuff
>   more stuff
>   .\}
> 
>   .if condition \{.\" comment
>   stuff
>   more stuff
>   .\}
> 
> Note the "dot" version of the comment in the last example.

It also works (in Anton's example) without the dot, as in:

.de QS
.   nr oldVPos \\n[.d]
.   if (2=2) \{\"Remove this comment including the space in col. 17
'      nf
.   \}
.   nr ofs (u;\\n[oldVPos]-\\n[.d])
.   ie (\\n[ofs]=0) .tm \\n+[tn]. Test passed.
.   el              .tm \\n+[tn]. Test not passed: Offset = \\n[ofs]
.   di quot
..
.
.nr tn 0 1
.QS
.QS
.QS
.di
.di
.di


It seems to be the space (with or without the following comment)
which causes the problem.

AND it works with a dotless comment on the following line, with
or without the "|" following "\{:

.   if (2=2) \{\
\"Remove this comment including the space in col. 17
'      nf
.   \}


.   if (2=2) \{
\"Remove this comment including the space in col. 17
'      nf
.   \}


(The trailing "\" is not essential).

I agree that multiline conditionals are a bit tricky!

Best wishes to all,
Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <address@hidden>
Fax-to-email: +44 (0)870 094 0861
Date: 13-Jul-11                                       Time: 22:33:58
------------------------------ XFMail ------------------------------



reply via email to

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