Does the asciidoc have a function like the Static variable in Java?

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

Does the asciidoc have a function like the Static variable in Java?

zera
I want this function as below:

= Title
LY = liyan, and maybe grammar like
:LY: liyan
or other grammar to define the static string

== one
1. this is LY or {LY}
== two
2. this is LY/ {LY}
== three
3. this is LY /{LY}

and then I want the {LY} can dispaly as "liyan" in my pdf or html view.

has this function? or can do it in other way?
Reply | Threaded
Open this post in threaded view
|

Re: Does the asciidoc have a function like the Static variable in Java?

abelsromero
Welcome to the forums,

Attributes is what you are looking for:
http://asciidoctor.org/docs/user-manual/#attributes

Just note that Asciidoctor provides a set of pre-defined attributes that are used to setup some configurations (eg. `images` for images directory path).
So, make sure you don't use a name that already exists.

Also, you can set pass them as a command argument `asciidoctor -a LY=liyan document.adoc` if you want to set the value outside of the document. The Maven and Gradle plugins allow to set them in the build configuration.
Reply | Threaded
Open this post in threaded view
|

Re: Does the asciidoc have a function like the Static variable in Java?

zera
I have got it, Thank you !

The attribute can be define by myself, it is very useful for me.