Evaluate attributes inside source blocks

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

Evaluate attributes inside source blocks

aalmiray
Hi there,

Say  you have the following asciidoc snippet

[source,groovy]
----
@Grapes([
    @Grab("{gebgroup}:geb-core:{gebversion}"),
    @Grab("org.seleniumhq.selenium:selenium-firefox-driver:{seleniumversion}"),
    @Grab("org.seleniumhq.selenium:selenium-support:{seleniumversion}")
])
import geb.Browser
----

All 4 attributes have been defined externally via the asciidoctor-gradle plugin. All of these attributes have their values applied if found inside a regular text block, however that doesn't happen inside a source block :-(

Cheers,
Andres
Reply | Threaded
Open this post in threaded view
|

Re: Evaluate attributes inside source blocks

asotobu
Can you try this? http://asciidoctor.org/docs/user-manual/#listing-blocks on section Custom substitutions. I think that you need to note asciidoctor to interpret block as AsciiDoc.

Alex.
Reply | Threaded
Open this post in threaded view
|

Re: Evaluate attributes inside source blocks

aalmiray
Thank you Alex, that did the trick. I cannot explain why I missed that entry in the manual as it's as clear as water.

Cheers,
Andres
Reply | Threaded
Open this post in threaded view
|

Re: Evaluate attributes inside source blocks

asotobu
Cool, I was not pretty sure that would work in source code blocks, but happy to find that it worked.
Reply | Threaded
Open this post in threaded view
|

Re: Evaluate attributes inside source blocks

mojavelinux
Administrator

I filed an issue for this clarification.

https://github.com/asciidoctor/asciidoctor.org/issues/201

Thanks for the suggestion Alex!

-Dan