Marco
Marco

Reputation: 15929

Asciidoctor attribute replacement in codeblock

In my current Asciidoctor document I have an atribute that I want to use in a codeblock. Is there a way to do String interpolation in a codeblock?

Attribute in header..

:api_version: 1.0

Codeblock

{
    "api_version" : "{api_version}",
}

I seem unable to do String replacement, any hints or tips to do String replacement in code block?

Upvotes: 4

Views: 971

Answers (1)

DavidGamba
DavidGamba

Reputation: 3613

You can apply substitutions like this:

.Example list of dependency RPMs:
[subs="verbatim,attributes"]
----
jdk-{java_version}-fcs.x86_64 <1>
jre-{java_version}-fcs.x86_64 <1>
sun-javadb-core-10.6.2-1.1.i386
sun-javadb-client-10.6.2-1.1.i386
sun-javadb-javadoc-10.6.2-1.1.i386
sun-javadb-demo-10.6.2-1.1.i386
sun-javadb-common-10.6.2-1.1.i386
sun-javadb-docs-10.6.2-1.1.i386
----
<1> Either the `jdk` or `jre` rpm must be installed.

Upvotes: 8

Related Questions