Chapter 29. Attribute Lists
-
An attribute list is a comma separated list of attribute values.
-
The entire list is enclosed in square brackets.
-
Attribute lists are used to pass parameters to macros, blocks (using
the AttributeList element) and inline quotes.
The list consists of zero or more positional attribute values followed
by zero or more named attribute values. Here are three examples: a
single unquoted positional attribute; three unquoted positional
attribute values; one positional attribute followed by two named
attributes; the unquoted attribute value in the final example contains
comma (,
) and double-quote ("
) character entities:
[Hello]
[quote, Bertrand Russell, The World of Mathematics (1956)]
["22 times", backcolor="#0e0e0e", options="noborders,wide"]
[A footnote, "with an image" image:smallnew.png[]]
Attribute list behavior
-
If one or more attribute values contains a comma the all string
values must be quoted (enclosed in double quotation mark
characters).
-
If the list contains any named or quoted attributes then all string
attribute values must be quoted.
-
To include a double quotation mark (") character in a quoted
attribute value the the quotation mark must be escaped with a
backslash.
-
List attributes take precedence over existing attributes.
-
List attributes can only be referenced in configuration file markup
templates and tags, they are not available elsewhere in the
document.
-
Setting a named attribute to
None
undefines the attribute.
-
Positional attributes are referred to as
{1}
,{2}
,{3}
,…
-
Attribute
{0}
refers to the entire list (excluding the enclosing
square brackets).
-
Named attribute names cannot contain dash characters.
If the attribute list contains an attribute named options
it is
processed as a comma separated list of option names:
-
Each name generates an attribute named like
<option>-option
(where
<option>
is the option name) with an empty string value. For
example [options="opt1,opt2,opt3"]
is equivalent to setting the
following three attributes
[opt1-option="",opt2-option="",opt2-option=""]
.
-
If you define a an option attribute globally (for example with an
attribute entry) then it will apply to all elements in the
document.
-
AsciiDoc implements a number of predefined options which are listed
in the Attribute Options appendix.
29.2. Macro Attribute lists
Macros calls are suffixed with an attribute list. The list may be
empty but it cannot be omitted. List entries are used to pass
attribute values to macro markup templates.