[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [help-texinfo] Determine if an argument was supplied to a macro
From: |
Gavin Smith |
Subject: |
Re: [help-texinfo] Determine if an argument was supplied to a macro |
Date: |
Tue, 24 Sep 2019 19:41:57 +0100 |
On Tue, Sep 24, 2019 at 4:41 PM Pantxo Diribarne
<address@hidden> wrote:
> Now how would I go if I want to display the third argument in case it's
> supplied and the first in case arg3 is empty?
It's not very easy. The best I could come up was the following:
@c use arg1 if present, otherwise use arg2
@macro choosearg{arg1, arg2}
@set dummyflag
@inlineifclear{dummyflag\arg1\, \arg1\}
@inlineifset{dummyflag\arg1\, \arg2\}
@end macro
I tested that this works with spaces in the arguments, but this
doesn't work if arg1 has any @-commands in it: this could be avoided
if the node names don't have @-commands in them.