Asciidoctor: Unsetting Boolean Attributes Via Document Header - Possible?

Created on 7 Jan 2020  路  4Comments  路  Source: asciidoctor/asciidoctor

I can overwrite any attribute with a value given on the CLI via a document header value, when I append '@' to the value on the CLI.
Example: -a icontype=png@ is overwritten by :icontype: svg in the doc header. Good.

Problem: Boolean attributes.
How would I UNSET a boolean attribute given on the CLI, like -a data-uri.
Use Case: My .adoc renderer by default sets -a data-uri, but I would like to switch it off sometimes via a document header attribute.

Is that possible?

Most helpful comment

Merci bien for the invite, will bug you there for the next one :-)
But for the evening I'm well entertained with your blog anyway, many thanks also for that!

All 4 comments

I think you need to use :data-uri!: (notice the explanation mark): https://asciidoctor.org/docs/user-manual/#using-attributes-set-assign-and-reference

@Mogztter
Confirmed & sorry for the noise!
So:

CLI: -a data-uri=@ sets the boolean, IF not unset in the doc header
Doc Header: :data-uri!: unsets it.

Nice!

I'm glad it's working for you :+1:
If you have other questions, feel free to ask on Gitter: gitter.im/asciidoctor/asciidoctor

Merci bien for the invite, will bug you there for the next one :-)
But for the evening I'm well entertained with your blog anyway, many thanks also for that!

Was this page helpful?
0 / 5 - 0 ratings