If...then...else...endif -- and...or
Posted by
1marc1 on
Feb 14, 2020; 12:54am
URL: https://discuss.asciidoctor.org/If-then-else-endif-and-or-tp7645.html
Hi Team,
I am not sure how difficult it would be to implement, but it would be very useful to have the ability to do something like this:
:myvar: blue
ifeval::[ "{myvar}" == "blue" OR "{myvar}" == "red" ]
This is for categories that are blue or red.
else::[]
This is for categories that are not blue or red
endif::[]
At the moment, I believe the only way to achieve the above is by doing:
:myvar: blue
ifeval::[ "{myvar}" == "blue" ]
This is for categories that are blue or red.
endif::[]
ifeval::[ "{myvar}" == "red" ]
This is for categories that are blue or red.
endif::[]
ifeval::[ "{myvar}" != "blue" ]
ifeval::[ "{myvar}" != "red" ]
This is for categories that are not blue.
endif::[]
endif::[]
Marc