Login  Register

Resetting nested attribute reference values

Posted by trost on Jan 24, 2019; 11:51pm
URL: https://discuss.asciidoctor.org/Resetting-nested-attribute-reference-values-tp6690.html

Hello--

I am having trouble finding information about something you might call "nested references" in Asciidoc--i.e., a user attribute reference that points to a value that contains another user attribute reference.  In particular, I want to be able to reset the value of the lower-level reference and then have that new value be rendered by the upper-level reference without having to also reset the value of the upper-level reference, if that makes sense.

To illustrate the problem, consider the following example:

:fruit:      orange
:phrase: {fruit} is a kind of fruit.
{phrase}

In this simplistic example, Asciidoctor would render "orange is a kind of fruit".

But, if I wanted to reset the value of "fruit"...

:fruit:      orange
:phrase: {fruit} is a kind of fruit.
:fruit:      apple
{phrase}

...Asciidoctor will still render "orange is a kind of fruit".  I want Asciidoctor to reset the value of "fruit" within the "phrase" value, without having to explicitly reset the "phrase" attribute after the "apple" line.  Is that kind of functionality supported?