Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Greetings,
I'm looking for an elegant way to set which image to use in PDF headers (running content) to indicate which classification a document has. The simpliest, but not so elegant way I can think of is to specify a dedicated theme, which sets the correct header like along this concept: # theme 1 header: ... recto: right: content: image:../assets/level1.png[] verso: left: content: $header-recto-right-content # theme 2 header: ... recto: right: content: image:../assets/level2.png[] verso: left: content: $header-recto-right-content But that will create lots of reduncancy in the themes and only the image would change with the classification. Ideally I would set the classification as VAR in the document: = 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 |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Anyone?
The documentation at https://github.com/asciidoctor/asciidoctor-pdf/blob/master/docs/theming-guide.adoc#attribute-references says: "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 ... [show rest of quote] -- [*] 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 |
Free forum by Nabble | Edit this page |