Attribute inheritance for include statement

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

Attribute inheritance for include statement

tes_staiger
Hi,
I have a document composed of multiple hirarchical sub-documents.
Is there any way to pass the attributes (especially the tags attribute) from an included file to its include statement?

Example:
main.adoc:
include::sub.adoc[tags=topic]

sub.adoc:
include::sub2.adoc[] //<- this is where I need tags to be the same as in main.adoc

sub2.adoc:
//tag::topic[]
some text
//end::topic[]
some other text

desired output:
some text


Thanks,
Sebastian
Reply | Threaded
Open this post in threaded view
|

Re: Attribute inheritance for include statement

mojavelinux
Administrator
Sebastian,

I would recommend using document attributes for this:

main.adoc

:tags: topic

include::sub.adoc[tags={tags}]

sub.adoc

include::sub2.adoc[tags={tags}]

A document attribute is available for as long as it remains set or you change the value.


Cheers,

-Dan

On Thu, Aug 30, 2018 at 6:21 AM, tes_staiger [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hi,
I have a document composed of multiple hirarchical sub-documents.
Is there any way to pass the attributes (especially the tags attribute) from an included file to its include statement?

Example:
main.adoc:
include::sub.adoc[tags=topic]

sub.adoc:
include::sub2.adoc[] //<- this is where I need tags to be the same as in main.adoc

sub2.adoc:
//tag::topic[]
some text
//end::topic[]
some other text

desired output:
some text


Thanks,
Sebastian



If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Attribute-inheritance-for-include-statement-tp6452.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
Reply | Threaded
Open this post in threaded view
|

Re: Attribute inheritance for include statement

tes_staiger
Hi,

thanks for your quick answer.
Unfortunately this does not seem to work.
I am getting the following message:
asciidoctor: WARNING: main.adoc: line 3: tag '{tags}' not found in include file: sub.adoc
It seems the attribute is not resolved for the include statement.


Reply | Threaded
Open this post in threaded view
|

Re: Attribute inheritance for include statement

mojavelinux
Administrator
That should work. What version of Asciidoctor are you using? You can find out using

{asciidoctor-version}

-Dan

On Fri, Aug 31, 2018 at 2:00 AM, tes_staiger [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hi,

thanks for your quick answer.
Unfortunately this does not seem to work.
I am getting the following message:
asciidoctor: WARNING: main.adoc: line 3: tag '{tags}' not found in include file: sub.adoc
It seems the attribute is not resolved for the include statement.





If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Attribute-inheritance-for-include-statement-tp6452p6455.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
Reply | Threaded
Open this post in threaded view
|

Re: Attribute inheritance for include statement

mojavelinux
Administrator

On Fri, Aug 31, 2018 at 2:42 AM, mojavelinux [via Asciidoctor :: Discussion] <[hidden email]> wrote:
That should work. What version of Asciidoctor are you using? You can find out using

{asciidoctor-version}

-Dan

On Fri, Aug 31, 2018 at 2:00 AM, tes_staiger [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hi,

thanks for your quick answer.
Unfortunately this does not seem to work.
I am getting the following message:
asciidoctor: WARNING: main.adoc: line 3: tag '{tags}' not found in include file: sub.adoc
It seems the attribute is not resolved for the include statement.





If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Attribute-inheritance-for-include-statement-tp6452p6455.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



If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Attribute-inheritance-for-include-statement-tp6452p6456.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
Reply | Threaded
Open this post in threaded view
|

Re: Attribute inheritance for include statement

tes_staiger
In reply to this post by mojavelinux
I am using Version 1.5.7.1

just installed with "gem install asciidoctor"

Using the attreibute {tags} somewhere int the text is working.

I just saw that you added that feature to milestone 1.5.8

What is the best/simplest way to install that version?
Reply | Threaded
Open this post in threaded view
|

Re: Attribute inheritance for include statement

mojavelinux
Administrator
Oh, you're right! My mistake. It was added only days after the release, which is why I was confused.

Here's how to run and/or install the gem locally.


In the project, you can run:

rake

then

gem install pkg/*.gem

-Dan

On Fri, Aug 31, 2018 at 2:55 AM, tes_staiger [via Asciidoctor :: Discussion] <[hidden email]> wrote:
I am using Version 1.5.7.1

just installed with "gem install asciidoctor"

Using the attreibute {tags} somewhere int the text is working.

I just saw that you added that feature to milestone 1.5.8

What is the best/simplest way to install that version?


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Attribute-inheritance-for-include-statement-tp6452p6458.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