Counters and ifeval

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Counters and ifeval

halol
This post was updated on .
Hello,

I am having an issue with counters and using them in ifeval directives:

Given the file:

{counter2:test}

The value of my counter is now {test}

// ifeval::[{test} > 1]
// The value of my counter is now {test}
// endif::[]
// => Leads to error Failed to load AsciiDoc document - undefined method `>' for nil:NilClass

ifeval::[{counter:newtest} == 1]
The value of my new counter is now {newtest}
endif::[]

The output produced is:
The value of my counter is now 1

The value of my new counter is now {newtest}

1. The first ifeval (commented out) causes an error and cannot be used at all (presumably because the counter defined beforehand is null in ifeval).
2. In the second case, the counter defined in the ifeval directive cannot be used elsewhere.

Am I doing something wrong?

Using:
asciidoctor -version
Asciidoctor 2.0.15 [https://asciidoctor.org]
On Fedora 34.