Using document attributes in section.html.slim

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

Using document attributes in section.html.slim

phgiraud
Hi,
I'm trying to use document attributes in section.html.slim, e.g.:

#{attr :revnumber}

It doesn't work, always leading to an empty value.
My goal is to add a discret href link in all section titles, that's OK, but I need to access document attributes.

It correctly works in _header.html.slim, _footer.html.slim ...

Any idea ?

thanks in advance
Reply | Threaded
Open this post in threaded view
|

Re: Using document attributes in section.html.slim

phgiraud
Just figured out how to get document attributes:

#{document.attr :revnumber}
Reply | Threaded
Open this post in threaded view
|

Re: Using document attributes in section.html.slim

mojavelinux
Administrator
You got it!

In your first example, you are requesting the attribute on the block, not the document.

If you ever want it to check the block, then the document if it's not on the block, you have to tell it to keep searching upwards:

#{attr :revnumber, nil, true}

Best,

-Dan

On Thu, Jan 9, 2020 at 2:21 AM phgiraud [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Just figured out how to get document attributes:

#{document.attr :revnumber}


If you reply to this email, your message will be added to the discussion below:
https://discuss.asciidoctor.org/Using-document-attributes-in-section-html-slim-tp7481p7484.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux