The AttributeEntry
block element allows document attributes to be
assigned within an AsciiDoc document. Attribute entries are added to
the global document attributes dictionary. The attribute name/value
syntax is a single line like:
:<name>: <value>
For example:
:Author Initials: JB
This will set an attribute reference {authorinitials}
to the value
JB in the current document.
To delete (undefine) an attribute use the following syntax:
:<name>!:
AttributeEntry behavior
<name>
to a legal attribute name (lower
case, alphanumeric, dash and underscore characters only — all other
characters deleted). This allows more human friendly text to be
used.
<value>
.
Lines ending in a space followed by a plus character are continued to the next line, for example:
:description: AsciiDoc is a text document format for writing notes, + documentation, articles, books, slideshows, web pages + and man pages.
<value>
is blank then the corresponding attribute value is
set to an empty string.
<value>
will be
expanded.
specialcharacters
and attributes
(see above), if you want to
change or disable AttributeEntry substitution use the pass:[] inline macro syntax.
Here are some more attribute entry examples:
AsciiDoc User Manual ==================== :author: Stuart Rackham :email: srackham@gmail.com :revdate: April 23, 2004 :revnumber: 5.1.1
Which creates these attributes:
{author}, {firstname}, {lastname}, {authorinitials}, {email}, {revdate}, {revnumber}
The previous example is equivalent to this document header:
AsciiDoc User Manual ==================== Stuart Rackham <srackham@gmail.com> 5.1.1, April 23, 2004
A variant of the Attribute Entry syntax allows configuration file section entries and markup template sections to be set from within an AsciiDoc document:
:<section_name>.[<entry_name>]: <entry_value>
Where <section_name>
is the configuration section name,
<entry_name>
is the name of the entry and <entry_value>
is the
optional entry value. This example sets the default labeled list
style to horizontal:
:listdef-labeled.style: horizontal
It is exactly equivalent to a configuration file containing:
[listdef-labeled] style=horizontal
If the <entry_name>
is omitted then the entire section is
substituted with the <entry_value>
. This feature should only be
used to set markup template sections. The following example sets the
xref2 inline macro markup template:
:xref2-inlinemacro.: <a href="#{1}">{2?{2}}</a>
asciidoc(1)
command --attribute
option.