4

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?

Marco
  • 15,101
  • 33
  • 107
  • 174

1 Answers1

8

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.
DavidGamba
  • 3,503
  • 2
  • 30
  • 46