Chapter 28. Attribute Entries

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

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

28.1. Setting configuration entries

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>
  • No substitution is performed on configuration file attribute entries and they cannot be undefined.
  • This feature can only be used in attribute entries — configuration attributes cannot be set using the asciidoc(1) command --attribute option.