Posted by
Patrick Ben Koetter on
Nov 24, 2019; 8:31pm
URL: https://discuss.asciidoctor.org/Conditionally-setting-image-in-Header-in-PDF-tp7356p7369.html
Anyone?
The documentation at
https://github.com/asciidoctor/asciidoctor-pdf/blob/master/docs/theming-guide.adoc#attribute-referencessays:
"You can use any attribute defined in your AsciiDoc document (such as
doctitle) in the content of the running header and footer. In addition,
the following attributes are also available when defining the content keys
in the footer:"
This is what I have done, but it doesn't work for me.
If I set ":classification: vsnfd" in my AsciiDoc document asciidoctor-pdf
won't use the variable when it renders the document. If I specify attribute
and name on the command line like this "asciidoctor-pdf -v -w -a
classification=vsnfd example.adoc" it doesn't work either.
The moment I hardcode it in my style YML file the image will be embedded into
the PDF:
header:
height: 2cm
border-width: 0
image-vertical-align: 2 # # (1)
padding: [50, 3, 0, 3]
recto:
right:
#content: image:classification/vsnfd.png[width=100]
content: image:classification/{classification}.png[width=100]
verso:
left:
content: $header-recto-right-content
Thanks
p@rick
* Patrick Ben Koetter [via Asciidoctor :: Discussion] <
[hidden email]>:
>
> = My Document
> :classification: level1
> ...
>
> And then $SOMETHING would evaluate the condition and set the image associated
> with the {classification}.
>
> I thought a simple attribute reference
> <
https://github.com/asciidoctor/asciidoctor-pdf/blob/master/docs/theming-guide.adoc#attribute-references>
> might work, but it won't if I do it like this:
>
> = My Document
> :classification: level1
> ...
>
> header:
> ...
> recto:
> right:
> content: image:../assets/{classification}.png[]
> verso:
> left:
> content: $header-recto-right-content
>
> However if I specify the image name as attribute, the image isn't embedded
> whereas if I hardcode it, it will be.
>
> Any ideas what I am doing wrong or a different way to do it?
>
>
> TIA,
>
> p@rick
>
>
> --
> [*] sys4 AG
>
>
https://sys4.de, +49 (89) 30 90 46 64
> Schleißheimer Straße 26/MG,80333 München
>
> Sitz der Gesellschaft: München, Amtsgericht München: HRB 199263
> Vorstand: Patrick Ben Koetter, Marc Schiffbauer, Wolfgang Stief
> Aufsichtsratsvorsitzender: Florian Kirstein
>
>
>
> _______________________________________________
> If you reply to this email, your message will be added to the discussion below:
>
https://discuss.asciidoctor.org/Conditionally-setting-image-in-Header-in-PDF-tp7356.html> To start a new topic under Asciidoctor :: Discussion, email
[hidden email]
> To unsubscribe from Asciidoctor :: Discussion, visit
https://discuss.asciidoctor.org/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=1&code=cEBzeXM0LmRlfDF8NjkwNjM2ODY4--
[*] sys4 AG
https://sys4.de, +49 (89) 30 90 46 64
Schleißheimer Straße 26/MG,80333 München
Sitz der Gesellschaft: München, Amtsgericht München: HRB 199263
Vorstand: Patrick Ben Koetter, Marc Schiffbauer, Wolfgang Stief
Aufsichtsratsvorsitzender: Florian Kirstein