Using attributes inside code blocks

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

Using attributes inside code blocks

joster
Hi, I'm sorry if this is a question with an obvious answer, but I haven't found one yet: is it possible to use attributes inside of code blocks? If so, how? What I'd like to be able to do is this:

= Some Document
:current_installer_version: 1.2.3

...

== Installing

To install, do this:

[source, sh]
----
wget http://some.url/myprogram_installer-{current_installer_version}.tar.gz
tar zxvf myprogram_installer-{current_installer_version}.tar.gz
----

Is that possible?
Reply | Threaded
Open this post in threaded view
|

Re: Using attributes inside code blocks

eskwayrd
Hi Joster,

Yes, that's possible. Substitutions are disabled in code blocks by default, but can be enabled selectively.

To enable attribute substitutions, start the code block like this:

[source,sh,subs="attributes"]

See http://www.methods.co.nz/asciidoc/chunked/ch32.html for more details.

I hope that helps!
Reply | Threaded
Open this post in threaded view
|

Re: Using attributes inside code blocks

joster
Thank you, yes! That was exactly what I was looking for.
Reply | Threaded
Open this post in threaded view
|

Re: Using attributes inside code blocks

abelsromero
In reply to this post by joster
On thing, keep in mind that "just" setting the susbtitutions attributes, overwrites the defaut values.
Add + at the end to make sure you just "add" the option.

More details here:
https://github.com/asciidoctor/asciidoctor-maven-examples/issues/33#issuecomment-142482228
http://asciidoctor.org/docs/user-manual/#applying-substitutions

Reply | Threaded
Open this post in threaded view
|

Re: Using attributes inside code blocks

mojavelinux
Administrator
Thanks for that clarification Abel!

-Dan

On Mon, Sep 28, 2015 at 11:26 AM, abelsromero [via Asciidoctor :: Discussion] <[hidden email]> wrote:
On thing, keep in mind that "just" setting the susbtitutions attributes, overwrites the defaut values.
Add + at the end to make sure you just "add" the option.

More details here:
https://github.com/asciidoctor/asciidoctor-maven-examples/issues/33#issuecomment-142482228
http://asciidoctor.org/docs/user-manual/#applying-substitutions




If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Using-attributes-inside-code-blocks-tp3765p3770.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Dan Allen | @mojavelinux | http://google.com/profiles/dan.j.allen