groff
[Top][All Lists]
Advanced

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

Re: [Groff] condition: OR of two string comparisons


From: hohe72
Subject: Re: [Groff] condition: OR of two string comparisons
Date: Wed, 12 Nov 2014 20:33:07 +0100



Ralph Corderoy <address@hidden> wrote (Fri, 07 Nov 2014 16:16:38
+0000):
> Hi Holger,
> 
> > Due to the 'Troff User's Manual' page 24 and the man 7 groff
> > (missing a negation)
> 
> What's missing?

"I" -- I was missing ..  ;)

> > the statement:
> >
> > .if 'str1'str2' anything
> >
> > cannot handle regular expressions or kinda glob-ing as patterns?

Ok, that makes no sense, 'cause of the strings are processed by groff.

> Correct.  It's not a simple string compare though, groff's info manual
> explains more.
> 
>     info groff 2>/dev/null |
>     sed -n '/Node: Operators in Conditionals/,/^File:/p'
> 
> You can get close with De Morgans to turn a|b into !(!a&!b) and chain
> two .ifs to do the & with the first being a .ie so the .el mops up,
> but it misses one of the cases.

A nested .if-statement will have two .el-parts, containing the same
code. I wanted to avoid that. However, a De Morgan of the original OR I
posted first will do.


But how about to code a statement like:

.if 'str'pattern1'pattern2' anything

maybe

.if 'str'pattern1'pattern2'..'patternN' anything

?

May someone help me to direct me to the place where the .if-statements
for string comparison are located. I'm a bit new to the sources (and
had problems to grep for "if"). Do I have to look at the .m4-files?

Thanks Holger



reply via email to

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