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

AsciiDoc User Guide

Macros

Macros are a mechanism for substituting parameterized text into output documents.

Macros have a name, a single target argument and an attribute list. The default syntax is

<name>:<target>[<attributelist>] (for inline macros) and <name>::<target>[<attributelist>]

(for block macros). Here are some examples:

http://www.methods.co.nz/asciidoc/index.html[Asciidoc home page] include::chapt1.txt[tabsize=2]

mailto:srackham@methods.co.nz[]

Macro behavior

<name> is the macro name. It can only contain letters, digits or dash characters and cannot start with a

dash.

The optional <target> cannot contain white space characters.

<attributelist> is a list of attributes enclosed in square brackets.

The attribute list is mandatory even if it contains no attributes.

Expansion of non-system macro references can be escaped by prefixing a backslash character.

Block macro attribute reference substitution is performed prior to macro expansion.

The substitutions performed prior to Inline macro macro expansion are determined by the inline context.

Inline Macros

Inline Macros occur in an inline element context. Predefined Inline macros include URLs, image and link macros.

URLs

Standard http, https, ftp, file and mailto URLs are rendered using predefined inline macros.

The default AsciiDoc inline macro syntax is very similar to a URL: all you need to do is append an attribute list containing an optional caption immediately following the URL. If no caption text is provided the URL itself is displayed.

Here are some examples:

http://www.methods.co.nz/asciidoc/[The AsciiDoc home page] mailto:joe.bloggs@foobar.com[email Joe Bloggs] mailto:joe.bloggs@foobar.com[]

Which are rendered:

34