riboseinc / asciidoctor-bibliography

Citations in AsciiDoc
MIT License
28 stars 8 forks source link

anomalies when using Asciidoctor's ifeval::[] and asciidoctor-bibliography #110

Open andrewcarver opened 4 years ago

andrewcarver commented 4 years ago

Folks,

I'd appreciate some help, I'm at a loss to figure out the following inconsistencies with ifeval::[] in Asciidoctor: When using asciidoctor-bibliography, ifeval can evaluate whether 2 > 1, but it stumbles when asked to compare an attribute's value with something.

Example (using the docbook backend): in AsciiDoc I have

// at the top: :provisional-thing: 1

// later: ifeval::[ 2 > 1 ] The value of :provisional-thing: is {provisional-thing} ! endif::[]

// result in the XML output: <simpara>The value of :provisional-thing: is 1 !</simpara>

But:

//later: ifeval::[ {provisional-thing} == 1 ] The value of :provisional-thing: is {provisional-thing} ! endif::[]

// result in the XML output, if I was using asciidoctor-bibliography:

// result in the XML output, if I was NOT using asciidoctor-bibliography: <simpara>The value of :provisional-thing: is 1 !</simpara>

It's similar if I give the document-attribute a string-value:

// at the top: :provisional-thing: html

// later: ifeval::[ 2 > 1 ] The value of :provisional-thing: is {provisional-thing} ! endif::[]

// result in the XML output: <simpara>The value of :provisional-thing: is html !</simpara>

But:

//later: ifeval::[ "{provisional-thing}" == "html" ] The value of :provisional-thing: is {provisional-thing} ! endif::[]

// result in the XML output, if I was using asciidoctor-bibliography:

// result in the XML output, if I was NOT using asciidoctor-bibliography: <simpara>The value of :provisional-thing: is html !</simpara>

BTW, I'm using:

Asciidoctor 2.0.10 [https://asciidoctor.org] Runtime Environment (ruby 2.5.1p57 (2018-03-29 revision 63029) [x64-mingw32]) (lc:UTF-8 fs:Windows-1252 in:UTF-8 ex:UTF-8)

And, I've tried it using NO other Asciidoctor extensions, and using several other Asciidoctor extensions; and listing the others before asciidoctor-bibliography (on the command-line), and then listing them after it. In each case, the only factor that mattered is whether I'm running asciidoctor-bibliography.

The only explanation I've thought of, is that both ifeval::[] and asciidoctor-bibliography are running as pre-processors. This may help point to where and how they are tripping over each other...

Many thanks for any help, pointers, or work-arounds!

Regards, Andy

andrewcarver commented 4 years ago

P.S. Forgot to mention: None of the other extensions I tested were pre-processors. (I didn't have one available.) It would be interesting to test some other PreProcessor-type Asciidoctor extensions, and see if they cause the issue.

andrewcarver commented 4 years ago

Wow -- I tried it with a preprocessor that's in the Asciidoctor Extensions Lab (viz., front-matter-pre-processor), and then tested some more -- and now I can't get ifeval::[] to do attribute-value-comparing at all -- whether I'm running asciidoctor-bibliography or not.

Has anyone else had trouble with making attribute-value-comparisons in ifeval::[]??

andrewcarver commented 4 years ago

P.P.S. Strangely, THIS comparison works (but is, sadly, useless :/

ifeval::[ {show-endnotes} == {show-endnotes} ]