Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Rackham S.AsciiDoc user guide Rev7.1.2.2006.pdf
Скачиваний:
19
Добавлен:
23.08.2013
Размер:
298.24 Кб
Скачать

AsciiDoc User Guide

<value> is substituted if the attribute <name> is defined otherwise the undefined attribute entry causes the containing line to be dropped. <value> can contain simple attribute references.

{<name>%<value>}

<value> is substituted if the attribute <name> is not defined otherwise the containing line is dropped. <value> can contain simple attribute references.

{<name>@<regexp>:<value1>[:<value2>]}

<value1> is substituted if the value of attribute <name> matches the regular expression <regexp> otherwise <value2> is substituted. If attribute <name> is not defined the containing line is dropped. If <value2> is omitted an empty string is assumed. The values and the regular expression can contain simple attribute references. To embed colons in the values or the regular expression escape them with backslashes.

{<name>$<regexp>:<value1>[:<value2>]}

Same behaviour as the previous ternary attribute except for the following cases:

{<name>$<regexp>:<value>}

Substitutes <value> if <name> matches <regexp> otherwise the result is undefined and the containing line is dropped.

{<name>$<regexp>::<value>}

Substitutes <value> if <name> does not match <regexp> otherwise the result is undefined and the containing line is dropped.

Conditional attribute examples

Conditional attributes are mainly used in AsciiDoc configuration files — see the distribution .conf files for examples.

Attribute equality test

If {backend} is docbook or xhtml11 the example evaluates to “DocBook or XHTML backend” otherwise it evaluates to “some other backend”:

{backend@docbook|xhtml11:DocBook or XHTML backend:some other backend}

Attribute value map

This example maps the frame attribute values [topbot, all, none, sides] to [hsides, border, void, vsides]:

{frame@topbot:hsides}{frame@all:border}{frame@none:void}{frame@sides:vsides}

System Attribute References

System attribute references generate the attribute text value by executing a predefined action that is parameterized by a single argument. The syntax is {<action>:<argument>}.

{eval:<expression>}

Substitutes the result of the Python <expression>. If <expression> evaluates to None or False the

58