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

AsciiDoc User Guide

Markup template section names end in -blockmacro instead of -inlinemacro.

Block Identifier

The Block Identifier macro sets the id attribute and has the same syntax as the anchor inline macro since it performs essentially the same function — block templates employ the id attribute as a block link target. For example:

[[X30]]

This is equivalent to the [id="X30"] block attribute list.

Images

Formal titled images are inserted into the output document using the image macro. The syntax is:

image::<target>[<attributes>]

In all respects, apart from context and the optional title, the use of the block image macro is exactly the same as it's inline counterpart.

Images can be titled by preceding the image macro with a BlockTitle. DocBook toolchains normally number examples and generate a List of Figures backmatter section.

For example:

.Main circuit board image::images/layout.png[J14P main circuit board]

xhtml11 and html4 backends precede the title with a Figure : prefix. You can customise this prefix with the caption attribute. For example:

.Main circuit board [caption="Figure 2:"]

image::images/layout.png[J14P main circuit board]

Comment Lines

Single lines starting with two forward slashes hard up against the left margin are treated as comments and are stripped from the output. Comment lines have been implemented as a block macro and are only valid in a block context — they are not treated as comments inside paragraphs or delimited blocks. Example comment line:

// This is a comment.

See also Comment Blocks.

System Macros

System macros are block macros that perform a predefined task which is hardwired into the asciidoc(1)

37

AsciiDoc User Guide

program.

You can't escape system macros with a leading backslash character (as you can with other macros).

The syntax and tasks performed by system macros is built into asciidoc(1) so they don't appear in configuration files. You can however customize the syntax by adding entries to a configuration file

[macros] section.

Include Macros

The include and include1 system macros to include the contents of a named file into the source document.

The include macro includes a file as if it were part of the parent document — tabs are expanded and system macros processed. The contents of include1 files are not subject to tab expansion or system macro processing nor are attribute or lower priority substitutions performed. The include1 macro's main use is to include verbatim embedded CSS or scripts into configuration file headers. Example:

include::chapter1.txt[tabsize=4]

Include macro behavior

If the included file name is specified with a relative path then the path is relative to the location of the referring document.

Include macros can appear inside configuration files.

Files included from within DelimitedBlocks are read to completion to avoid false end-of-block underline termination.

File inclusion is limited to a depth of 5 to catch recursive loops.

Attribute references are expanded inside the include target; if an an attribute is undefined then the included file is silently skipped.

The tabsize macro attribute sets the the number of space characters to be used for tab expansion in the included file.

Conditional Inclusion Macros

Lines of text in the source document can be selectively included or excluded from processing based on the the existence (or not) of a document attribute. There are two forms of conditional inclusion macro usage, the first includes document text between the ifdef and endif macros if a document attribute is defined:

ifdef::<attribute>[]

:

endif::<attribute>[]

The second for includes document text between the ifndef and endif macros if the attribute is not

38