Re: If...then...else...endif -- and...or
Posted by halol on Feb 27, 2020; 1:58pm
URL: https://discuss.asciidoctor.org/If-then-else-endif-and-or-tp7645p7688.html
I would love to see this feature as well. Without it, ifeval is often difficult to use, even if there are workarounds. I tend to use something such as:
For the OR:
:myvar: blue
ifeval::[ "{myvar}" == "blue" ]
:group1:
endif::[]
ifeval::[ "{myvar}" == "red" ]
:group1:
endif::[]
ifdef::group1[]
For blue or red
endif::[]
ifndef::group1[]
For not blue and not red
endif::[]
For the AND:
:myvar1: blue
:myvar2: green
ifeval::[ "{myvar1}" == "blue" ]
ifeval::[ "{myvar2}" == "red" ]
:group2:
endif::[]
endif::[]
ifdef::group2[]
For var1 = blue and var2 = red
endif::[]
and so on.
It is slightly off-topic, but a long-form for ifeval would also be nice if possible.