FooBarWidget-mizuho 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (175) hide show
  1. data/LICENSE.txt +20 -0
  2. data/README.markdown +68 -0
  3. data/Rakefile +9 -0
  4. data/asciidoc/BUGS +34 -0
  5. data/asciidoc/BUGS.txt +28 -0
  6. data/asciidoc/CHANGELOG +1585 -0
  7. data/asciidoc/CHANGELOG.txt +1595 -0
  8. data/asciidoc/COPYING +339 -0
  9. data/asciidoc/COPYRIGHT +18 -0
  10. data/asciidoc/INSTALL +82 -0
  11. data/asciidoc/INSTALL.txt +71 -0
  12. data/asciidoc/README +46 -0
  13. data/asciidoc/README.txt +36 -0
  14. data/asciidoc/a2x +641 -0
  15. data/asciidoc/asciidoc.conf +404 -0
  16. data/asciidoc/asciidoc.py +4255 -0
  17. data/asciidoc/common.aap +9 -0
  18. data/asciidoc/dblatex/asciidoc-dblatex.sty +18 -0
  19. data/asciidoc/dblatex/asciidoc-dblatex.xsl +17 -0
  20. data/asciidoc/dblatex/dblatex-readme.txt +22 -0
  21. data/asciidoc/doc/a2x.1 +246 -0
  22. data/asciidoc/doc/a2x.1.txt +195 -0
  23. data/asciidoc/doc/article.css-embedded.html +579 -0
  24. data/asciidoc/doc/article.html +62 -0
  25. data/asciidoc/doc/article.pdf +0 -0
  26. data/asciidoc/doc/article.txt +124 -0
  27. data/asciidoc/doc/asciidoc-revhistory.xml +27 -0
  28. data/asciidoc/doc/asciidoc.1 +161 -0
  29. data/asciidoc/doc/asciidoc.1.css-embedded.html +562 -0
  30. data/asciidoc/doc/asciidoc.1.css.html +212 -0
  31. data/asciidoc/doc/asciidoc.1.html +190 -0
  32. data/asciidoc/doc/asciidoc.1.txt +118 -0
  33. data/asciidoc/doc/asciidoc.conf +8 -0
  34. data/asciidoc/doc/asciidoc.css-embedded.html +7954 -0
  35. data/asciidoc/doc/asciidoc.css.html +7553 -0
  36. data/asciidoc/doc/asciidoc.dict +673 -0
  37. data/asciidoc/doc/asciidoc.html +3502 -0
  38. data/asciidoc/doc/asciidoc.txt +4757 -0
  39. data/asciidoc/doc/asciimath.txt +47 -0
  40. data/asciidoc/doc/book-multi.css-embedded.html +575 -0
  41. data/asciidoc/doc/book-multi.html +72 -0
  42. data/asciidoc/doc/book-multi.txt +159 -0
  43. data/asciidoc/doc/book.css-embedded.html +585 -0
  44. data/asciidoc/doc/book.html +60 -0
  45. data/asciidoc/doc/book.txt +133 -0
  46. data/asciidoc/doc/customers.csv +18 -0
  47. data/asciidoc/doc/faq.txt +262 -0
  48. data/asciidoc/doc/latex-backend.html +224 -0
  49. data/asciidoc/doc/latex-backend.txt +193 -0
  50. data/asciidoc/doc/latexmath.txt +35 -0
  51. data/asciidoc/doc/main.aap +293 -0
  52. data/asciidoc/doc/music-filter.html +513 -0
  53. data/asciidoc/doc/music-filter.pdf +0 -0
  54. data/asciidoc/doc/music-filter.txt +158 -0
  55. data/asciidoc/doc/source-highlight-filter.html +183 -0
  56. data/asciidoc/doc/source-highlight-filter.pdf +0 -0
  57. data/asciidoc/doc/source-highlight-filter.txt +174 -0
  58. data/asciidoc/docbook-xsl/asciidoc-docbook-xsl.txt +71 -0
  59. data/asciidoc/docbook-xsl/chunked.xsl +19 -0
  60. data/asciidoc/docbook-xsl/common.xsl +67 -0
  61. data/asciidoc/docbook-xsl/fo.xsl +117 -0
  62. data/asciidoc/docbook-xsl/htmlhelp.xsl +17 -0
  63. data/asciidoc/docbook-xsl/manpage.xsl +28 -0
  64. data/asciidoc/docbook-xsl/shaded-literallayout.patch +32 -0
  65. data/asciidoc/docbook-xsl/xhtml.xsl +14 -0
  66. data/asciidoc/docbook.conf +606 -0
  67. data/asciidoc/examples/website/CHANGELOG.html +3828 -0
  68. data/asciidoc/examples/website/INSTALL.html +163 -0
  69. data/asciidoc/examples/website/README-website.html +129 -0
  70. data/asciidoc/examples/website/README-website.txt +29 -0
  71. data/asciidoc/examples/website/README.html +125 -0
  72. data/asciidoc/examples/website/a2x.1.html +395 -0
  73. data/asciidoc/examples/website/asciidoc-docbook-xsl.html +165 -0
  74. data/asciidoc/examples/website/asciimath.html +157 -0
  75. data/asciidoc/examples/website/build-website.sh +25 -0
  76. data/asciidoc/examples/website/downloads.html +219 -0
  77. data/asciidoc/examples/website/downloads.txt +98 -0
  78. data/asciidoc/examples/website/faq.html +372 -0
  79. data/asciidoc/examples/website/index.html +398 -0
  80. data/asciidoc/examples/website/index.txt +222 -0
  81. data/asciidoc/examples/website/latex-backend.html +640 -0
  82. data/asciidoc/examples/website/latexmath.html +119 -0
  83. data/asciidoc/examples/website/layout1.conf +161 -0
  84. data/asciidoc/examples/website/layout1.css +65 -0
  85. data/asciidoc/examples/website/layout2.conf +158 -0
  86. data/asciidoc/examples/website/layout2.css +93 -0
  87. data/asciidoc/examples/website/manpage.html +266 -0
  88. data/asciidoc/examples/website/music-filter.html +242 -0
  89. data/asciidoc/examples/website/music1.abc +12 -0
  90. data/asciidoc/examples/website/music1.png +0 -0
  91. data/asciidoc/examples/website/music2.ly +9 -0
  92. data/asciidoc/examples/website/music2.png +0 -0
  93. data/asciidoc/examples/website/source-highlight-filter.html +251 -0
  94. data/asciidoc/examples/website/support.html +78 -0
  95. data/asciidoc/examples/website/support.txt +5 -0
  96. data/asciidoc/examples/website/userguide.html +7597 -0
  97. data/asciidoc/examples/website/version9.html +143 -0
  98. data/asciidoc/examples/website/version9.txt +48 -0
  99. data/asciidoc/filters/code-filter-readme.txt +37 -0
  100. data/asciidoc/filters/code-filter-test-c++.txt +7 -0
  101. data/asciidoc/filters/code-filter-test.txt +15 -0
  102. data/asciidoc/filters/code-filter.conf +8 -0
  103. data/asciidoc/filters/code-filter.py +239 -0
  104. data/asciidoc/filters/music-filter-test.txt +40 -0
  105. data/asciidoc/filters/music-filter.conf +40 -0
  106. data/asciidoc/filters/music2png.py +189 -0
  107. data/asciidoc/filters/source-highlight-filter-test.txt +19 -0
  108. data/asciidoc/filters/source-highlight-filter.conf +100 -0
  109. data/asciidoc/help.conf +213 -0
  110. data/asciidoc/html4.conf +363 -0
  111. data/asciidoc/images/highlighter.png +0 -0
  112. data/asciidoc/images/icons/README +5 -0
  113. data/asciidoc/images/icons/callouts/1.png +0 -0
  114. data/asciidoc/images/icons/callouts/10.png +0 -0
  115. data/asciidoc/images/icons/callouts/11.png +0 -0
  116. data/asciidoc/images/icons/callouts/12.png +0 -0
  117. data/asciidoc/images/icons/callouts/13.png +0 -0
  118. data/asciidoc/images/icons/callouts/14.png +0 -0
  119. data/asciidoc/images/icons/callouts/15.png +0 -0
  120. data/asciidoc/images/icons/callouts/2.png +0 -0
  121. data/asciidoc/images/icons/callouts/3.png +0 -0
  122. data/asciidoc/images/icons/callouts/4.png +0 -0
  123. data/asciidoc/images/icons/callouts/5.png +0 -0
  124. data/asciidoc/images/icons/callouts/6.png +0 -0
  125. data/asciidoc/images/icons/callouts/7.png +0 -0
  126. data/asciidoc/images/icons/callouts/8.png +0 -0
  127. data/asciidoc/images/icons/callouts/9.png +0 -0
  128. data/asciidoc/images/icons/caution.png +0 -0
  129. data/asciidoc/images/icons/example.png +0 -0
  130. data/asciidoc/images/icons/home.png +0 -0
  131. data/asciidoc/images/icons/important.png +0 -0
  132. data/asciidoc/images/icons/next.png +0 -0
  133. data/asciidoc/images/icons/note.png +0 -0
  134. data/asciidoc/images/icons/prev.png +0 -0
  135. data/asciidoc/images/icons/tip.png +0 -0
  136. data/asciidoc/images/icons/up.png +0 -0
  137. data/asciidoc/images/icons/warning.png +0 -0
  138. data/asciidoc/images/smallnew.png +0 -0
  139. data/asciidoc/images/tiger.png +0 -0
  140. data/asciidoc/install.sh +55 -0
  141. data/asciidoc/javascripts/ASCIIMathML.js +938 -0
  142. data/asciidoc/javascripts/LaTeXMathML.js +1223 -0
  143. data/asciidoc/javascripts/toc.js +69 -0
  144. data/asciidoc/lang-es.conf +15 -0
  145. data/asciidoc/latex.conf +663 -0
  146. data/asciidoc/linuxdoc.conf +285 -0
  147. data/asciidoc/math.conf +50 -0
  148. data/asciidoc/stylesheets/docbook-xsl.css +271 -0
  149. data/asciidoc/stylesheets/xhtml-deprecated-manpage.css +21 -0
  150. data/asciidoc/stylesheets/xhtml-deprecated.css +247 -0
  151. data/asciidoc/stylesheets/xhtml11-manpage.css +18 -0
  152. data/asciidoc/stylesheets/xhtml11-quirks.css +49 -0
  153. data/asciidoc/stylesheets/xhtml11.css +284 -0
  154. data/asciidoc/t.conf +20 -0
  155. data/asciidoc/text.conf +16 -0
  156. data/asciidoc/vim/ftdetect/asciidoc_filetype.vim +53 -0
  157. data/asciidoc/vim/syntax/asciidoc.vim +139 -0
  158. data/asciidoc/xhtml-deprecated-css.conf +235 -0
  159. data/asciidoc/xhtml-deprecated.conf +351 -0
  160. data/asciidoc/xhtml11-quirks.conf +57 -0
  161. data/asciidoc/xhtml11.conf +514 -0
  162. data/bin/mizuho +40 -0
  163. data/lib/mizuho/chapter.rb +54 -0
  164. data/lib/mizuho/generator.rb +106 -0
  165. data/lib/mizuho/heading.rb +46 -0
  166. data/lib/mizuho/parser.rb +99 -0
  167. data/lib/mizuho/template.rb +50 -0
  168. data/mizuho.gemspec +34 -0
  169. data/templates/asciidoc.css +358 -0
  170. data/templates/asciidoc.html.erb +86 -0
  171. data/templates/manualsonrails.css +165 -0
  172. data/templates/manualsonrails.html.erb +97 -0
  173. data/test/parser_spec.rb +190 -0
  174. data/test/spec_helper.rb +43 -0
  175. metadata +234 -0
@@ -0,0 +1,4757 @@
1
+ AsciiDoc User Guide
2
+ ===================
3
+ Stuart Rackham <srackham@gmail.com>
4
+ :Author Initials: SJR
5
+
6
+ AsciiDoc is a text document format for writing short documents,
7
+ articles, books and UNIX man pages. AsciiDoc files can be translated
8
+ to HTML and DocBook markups using the asciidoc(1) command. AsciiDoc
9
+ is highly configurable: both the AsciiDoc source file syntax and the
10
+ backend output markups (which can be almost any type of SGML/XML
11
+ markup) can be customized and extended by the user.
12
+
13
+
14
+ Introduction
15
+ ------------
16
+ **********************************************************************
17
+ This is an overly large document, it probably needs to be refactored
18
+ into a Tutorial, FAQ, Quick Reference and Formal Reference.
19
+
20
+ If you're new to AsciiDoc read this section and the <<X6,Getting
21
+ Started>> section and take a look at the example AsciiDoc `.txt`
22
+ source files in the distribution `doc` directory.
23
+ **********************************************************************
24
+
25
+ Plain text is the most universal electronic document format, no matter
26
+ what computing environment you use, you can always read and write
27
+ plain text documentation. But for many applications plain text is not
28
+ a viable presentation format. HTML, PDF and roff (roff is used for
29
+ man pages) are the most widely used UNIX presentation formats.
30
+ DocBook is a popular UNIX documentation markup format which can be
31
+ translated to HTML, PDF and other presentation formats.
32
+
33
+ AsciiDoc is a plain text human readable/writable document format that
34
+ can be translated to DocBook or HTML using the asciidoc(1) command.
35
+ You can then either use asciidoc(1) generated HTML directly or run
36
+ asciidoc(1) DocBook output through your favorite DocBook toolchain or
37
+ use the AsciiDoc a2x(1) toolchain wrapper to produce PDF, DVI, LaTeX,
38
+ PostScript, man page, HTML and text formats.
39
+
40
+ The AsciiDoc format is a useful presentation format in its own right:
41
+ AsciiDoc files are unencumbered by markup and are easily viewed,
42
+ proofed and edited.
43
+
44
+ AsciiDoc is light weight: it consists of a single Python script and a
45
+ bunch of configuration files. Apart from asciidoc(1) and a Python
46
+ interpreter, no other programs are required to convert AsciiDoc text
47
+ files to DocBook or HTML. See <<X11,Example AsciiDoc Documents>>
48
+ below.
49
+
50
+ You write an AsciiDoc document the same way you would write a normal
51
+ text document, there are no markup tags or arcane notations. Built-in
52
+ AsciiDoc formatting rules have been kept to a minimum and are
53
+ reasonably obvious.
54
+
55
+ Text markup conventions tend to be a matter of (often strong) personal
56
+ preference: if the default syntax is not to your liking you can define
57
+ your own by editing the text based asciidoc(1) configuration files.
58
+ You can create your own configuration files to translate AsciiDoc
59
+ documents to almost any SGML/XML markup.
60
+
61
+ asciidoc(1) comes with a set of configuration files to translate
62
+ AsciiDoc articles, books or man pages to HTML or DocBook backend
63
+ formats.
64
+
65
+ .My AsciiDoc Itch
66
+ **********************************************************************
67
+ DocBook has emerged as the de facto standard Open Source documentation
68
+ format. But DocBook is a complex language, the marked up text is
69
+ difficult to read and even more difficult to write directly -- I found
70
+ I was spending more time typing markup tags, consulting reference
71
+ manuals and fixing syntax errors, than I was writing the
72
+ documentation.
73
+
74
+ **********************************************************************
75
+
76
+
77
+ [[X6]]
78
+ Getting Started
79
+ ---------------
80
+ Installing AsciiDoc
81
+ ~~~~~~~~~~~~~~~~~~~
82
+ See the `README` and `INSTALL` files for install prerequisites and
83
+ procedures. Packagers take a look at <<X38,Appendix B: Packager
84
+ Notes>>.
85
+
86
+ [[X11]]
87
+ Example AsciiDoc Documents
88
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
89
+ The best way to quickly get a feel for AsciiDoc is to view the
90
+ AsciiDoc web site and/or distributed examples:
91
+
92
+ - Take a look at the linked examples on the AsciiDoc web site home
93
+ page http://www.methods.co.nz/asciidoc/. Press the 'Page Source'
94
+ sidebar menu item to view corresponding AsciiDoc source.
95
+ - Read the `.txt` source files in the distribution `./doc` directory
96
+ in conjunction with the corresponding HTML and DocBook XML files.
97
+
98
+
99
+ AsciiDoc Document Types
100
+ -----------------------
101
+ There are three types of AsciiDoc documents: article, book and
102
+ manpage. All document types share the same AsciiDoc format with some
103
+ minor variations.
104
+
105
+ Use the asciidoc(1) `-d` (`--doctype`) option to specify the AsciiDoc
106
+ document type -- the default document type is 'article'.
107
+
108
+ By convention the `.txt` file extension is used for AsciiDoc document
109
+ source files.
110
+
111
+ article
112
+ ~~~~~~~
113
+ Used for short documents, articles and general documentation. See the
114
+ AsciiDoc distribution `./doc/article.txt` example.
115
+
116
+ book
117
+ ~~~~
118
+ Books share the same format as articles; in addition there is the
119
+ option to add level 0 book part sections.
120
+
121
+ Book documents will normally be used to produce DocBook output since
122
+ DocBook processors can automatically generate footnotes, table of
123
+ contents, list of tables, list of figures, list of examples and
124
+ indexes.
125
+
126
+ AsciiDoc markup supports standard DocBook frontmatter and backmatter
127
+ <<X16,special sections>> (dedication, preface, bibliography, glossary,
128
+ index, colophon) plus footnotes and index entries.
129
+
130
+ .Example book documents
131
+ Book::
132
+ The `./doc/book.txt` file in the AsciiDoc distribution.
133
+
134
+ Multi-part book::
135
+ The `./doc/book-multi.txt` file in the AsciiDoc distribution.
136
+
137
+ manpage
138
+ ~~~~~~~
139
+ Used to generate UNIX manual pages. AsciiDoc manpage documents
140
+ observe special header title and section naming conventions -- see the
141
+ <<X1,Manpage Documents>> section for details.
142
+
143
+ See also the asciidoc(1) man page source (`./doc/asciidoc.1.txt`) from
144
+ the AsciiDoc distribution.
145
+
146
+
147
+ [[X5]]
148
+ AsciiDoc Backends
149
+ -----------------
150
+ The asciidoc(1) command translates an AsciiDoc formatted file to the
151
+ backend format specified by the `-b` (`--backend`) command-line
152
+ option. asciidoc(1) itself has little intrinsic knowledge of backend
153
+ formats, all translation rules are contained in customizable cascading
154
+ configuration files.
155
+
156
+ AsciiDoc ships with the following predefined backend output formats:
157
+
158
+ docbook
159
+ ~~~~~~~
160
+ AsciiDoc generates the following DocBook document types: article, book
161
+ and refentry (corresponding to the AsciiDoc 'article', 'book' and
162
+ 'manpage' document types).
163
+
164
+ DocBook documents are not designed to be viewed directly. Most Linux
165
+ distributions come with conversion tools (collectively called a
166
+ toolchain) for <<X12,converting DocBook files>> to presentation
167
+ formats such as Postscript, HTML, PDF, DVI, PostScript, LaTeX, roff
168
+ (the native man page format), HTMLHelp, JavaHelp and text.
169
+
170
+ - The `--backend=docbook` command-line option produces DocBook XML.
171
+ You can produce the older DocBook SGML format using the
172
+ `--attribute sgml` command-line option.
173
+ - Use the optional <<X54,`encoding`>> attribute to set the character
174
+ set encoding.
175
+ - Use the optional `imagesdir` attribute to prepend to the target file
176
+ name paths in image inline and block macros. Defaults to a blank
177
+ string.
178
+ - The AsciiDoc 'Preamble' element generates a DocBook book 'preface'
179
+ element although it's more usual to use an explicit 'Preface'
180
+ special section (see the `./doc/book.txt` example book).
181
+
182
+ [[X33]]
183
+ xhtml11
184
+ ~~~~~~~
185
+ The default asciidoc(1) backend is `xhtml11` which generates XHTML 1.1
186
+ markup styled with CSS2. Default output file have a `.html` extension.
187
+ 'xhtml11' document generation is influenced by the following
188
+ optional attributes (the default behavior is to generate XHTML with no
189
+ section numbers, embedded CSS and no linked admonition icon images):
190
+
191
+ numbered::
192
+ Adds section numbers to section titles.
193
+
194
+ toc::
195
+ Adds a table of contents to the start of the document.
196
+
197
+ - JavaScript needs to be enabled in your browser for this to work.
198
+ - By default AsciiDoc automatically embeds the required `toc.js`
199
+ JavaScript in the output document -- use the 'linkcss' attribute
200
+ to link the script.
201
+ - The following example generates a numbered table of contents by
202
+ embedding the `toc.js` script in the `mydoc.html` output document
203
+ (to link the script to the output document use the 'linkcss' and
204
+ 'scriptsdir' attributes):
205
+
206
+ $ asciidoc -a toc -a numbered mydoc.txt
207
+
208
+ toclevels::
209
+ Sets the number of title levels (1..4) reported in the table of
210
+ contents (see the 'toc' attribute above). Defaults to 2 and must be
211
+ used with the 'toc' attribute. Example usage:
212
+
213
+ $ asciidoc -a toc -a toclevels=3 doc/asciidoc.txt
214
+
215
+ toc_title::
216
+ Sets the table of contents title (defaults to 'Table of Contents').
217
+
218
+ linkcss::
219
+ Link CSS stylesheets and JavaScripts (see the 'stylesdir' and
220
+ 'scriptsdir' attributes below). By default 'linkcss' is undefined in
221
+ which case stylesheets and scripts are automatically embedded in the
222
+ output document.
223
+
224
+ stylesdir::
225
+ The name of the directory containing linked stylesheets. Defaults to
226
+ `.` (the same directory as the linking document).
227
+
228
+ scriptsdir::
229
+ The name of the directory containing linked JavaScripts. Defaults to
230
+ `.` (the same directory as the linking document).
231
+
232
+ [[X45]]
233
+ icons::
234
+ Link admonition paragraph and admonition block icon images and badge
235
+ images. By default 'icons' is undefined and text is used in place of
236
+ icon images.
237
+
238
+ [[X44]]
239
+ iconsdir::
240
+ The name of the directory containing linked admonition and
241
+ navigation icons. Defaults to `./images/icons`.
242
+
243
+ imagesdir::
244
+ This attribute is prepended to the target image file name paths in
245
+ image inline and block macros. Defaults to a blank string.
246
+
247
+ theme::
248
+ Use alternative stylesheets (see <<X35,Stylesheets>>).
249
+
250
+ badges::
251
+ Link badges ('XHTML 1.1', 'CSS' and 'Get Firefox!') in document
252
+ footers. By default badges are omitted ('badges' is undefined).
253
+
254
+ NOTE: The path names of images, icons and scripts are relative to the
255
+ output document not the source document.
256
+
257
+ [[X54]]
258
+ encoding::
259
+ Set the input and output document character set encoding. For
260
+ example the `--attribute encoding=ISO-8859-1` command-line option
261
+ will set the character set encoding to `ISO-8859-1`.
262
+
263
+ - The default encoding is UTF-8.
264
+ - This attribute specifies the character set in the output document.
265
+ - The encoding name must correspond to a Python codec name or alias.
266
+ - The 'encoding' attribute can be set using an AttributeEntry inside
267
+ the document header but it must come at the start of the document
268
+ before the document title. For example:
269
+
270
+ :encoding: ISO-8859-1
271
+
272
+ quirks::
273
+ Use the `xhtml11-quirks.css` stylesheet to work around IE6 browser
274
+ incompatibilities (this is the default behavior).
275
+
276
+ data-uri::
277
+ Embed images referenced by 'image' macros using the <<X66,data: uri
278
+ scheme>>.
279
+
280
+ [[X35]]
281
+ Stylesheets
282
+ ^^^^^^^^^^^
283
+ AsciiDoc XHTML output is styled using CSS2 stylesheets from the
284
+ distribution `./stylesheets/` directory.
285
+
286
+ [IMPORTANT]
287
+ =====================================================================
288
+ All browsers have CSS quirks, but Microsoft's IE6 has so many
289
+ omissions and errors that the `xhtml11-quirks.css` stylesheet and
290
+ `xhtml11-quirks.conf` configuration files are included during XHTML
291
+ backend processing to to implement workarounds for IE6. If you don't
292
+ use IE6 then the quirks stylesheet and configuration files can be
293
+ omitted using the `--attribute quirks!` command-line option.
294
+ =====================================================================
295
+
296
+ Default 'xhtml11' stylesheets:
297
+
298
+ `./stylesheets/xhtml11.css`::
299
+ The main stylesheet.
300
+
301
+ `./stylesheets/xhtml11-manpage.css`::
302
+ Tweaks for manpage document type generation.
303
+
304
+ `./stylesheets/xhtml11-quirks.css`::
305
+ Stylesheet modifications to work around IE6 browser
306
+ incompatibilities.
307
+
308
+ Use the 'theme' attribute to select and alternative set of
309
+ stylesheets. For example, the command-line option `-a theme=foo` will
310
+ use stylesheets `foo.css`, `foo-manpage.css` and `foo-quirks.css`.
311
+
312
+
313
+ html4
314
+ ~~~~~
315
+ This backend generates plain (unstyled) HTML 4.01 Transitional markup.
316
+
317
+
318
+ linuxdoc
319
+ ~~~~~~~~
320
+ WARNING: The AsciiDoc linuxdoc backend is still distributed but is no
321
+ longer being actively developed or tested with new AsciiDoc releases
322
+ (the last supported release was AsciiDoc 6.0.3).
323
+
324
+ - Tables are not supported.
325
+ - Images are not supported.
326
+ - Callouts are not supported.
327
+ - Horizontal labeled lists are not supported.
328
+ - Only article document types are allowed.
329
+ - The Abstract section can consist only of a single paragraph.
330
+ - An AsciiDoc Preamble is not allowed.
331
+ - The LinuxDoc output format does not support multiple labels per
332
+ labeled list item although LinuxDoc conversion programs generally
333
+ output all the labels with a warning.
334
+ - Don't apply character formatting to the `link` macro attributes,
335
+ LinuxDoc does not allow displayed link text to be formatted.
336
+
337
+ The default output file name extension is `.sgml`.
338
+
339
+ latex
340
+ ~~~~~
341
+ An experimental LaTeX backend has been written for AsciiDoc by
342
+ Benjamin Klum. A tutorial `./doc/latex-backend.html` is included in
343
+ the AsciiDoc distribution which can also be viewed at
344
+ http://www.methods.co.nz/asciidoc/latex-backend.html.
345
+
346
+
347
+ Document Structure
348
+ ------------------
349
+ An AsciiDoc document consists of a series of <<X8,block elements>>
350
+ starting with an optional document Header, followed by an optional
351
+ Preamble, followed by zero or more document Sections.
352
+
353
+ Almost any combination of zero or more elements constitutes a valid
354
+ AsciiDoc document: documents can range from a single sentence to a
355
+ multi-part book.
356
+
357
+ Block Elements
358
+ ~~~~~~~~~~~~~~
359
+ Block elements consist of one or more lines of text and may contain
360
+ other block elements.
361
+
362
+ The AsciiDoc block structure can be informally summarized
363
+ footnote:[This is a rough structural guide, not a rigorous syntax
364
+ definition] as follows:
365
+
366
+ Document ::= (Header?,Preamble?,Section*)
367
+ Header ::= (Title,(AuthorLine,RevisionLine?)?)
368
+ AuthorLine ::= (FirstName,(MiddleName?,LastName)?,EmailAddress?)
369
+ RevisionLine ::= (Revision?,Date)
370
+ Preamble ::= (SectionBody)
371
+ Section ::= (Title,SectionBody?,(Section)*)
372
+ SectionBody ::= ((BlockTitle?,Block)|BlockMacro)+
373
+ Block ::= (Paragraph|DelimitedBlock|List|Table)
374
+ List ::= (BulletedList|NumberedList|LabeledList|CalloutList)
375
+ BulletedList ::= (ListItem)+
376
+ NumberedList ::= (ListItem)+
377
+ CalloutList ::= (ListItem)+
378
+ LabeledList ::= (ItemLabel+,ListItem)+
379
+ ListItem ::= (ItemText,(List|ListParagraph|ListContinuation)*)
380
+ Table ::= (Ruler,TableHeader?,TableBody,TableFooter?)
381
+ TableHeader ::= (TableRow+,TableUnderline)
382
+ TableFooter ::= (TableRow+,TableUnderline)
383
+ TableBody ::= (TableRow+,TableUnderline)
384
+ TableRow ::= (TableData+)
385
+
386
+ Where:
387
+
388
+ - '?' implies zero or one occurrence, '+' implies one or more
389
+ occurrences, '*' implies zero or more occurrences.
390
+ - All block elements are separated by line boundaries.
391
+ - `BlockId`, `AttributeEntry` and `AttributeList` block elements (not
392
+ shown) can occur almost anywhere.
393
+ - There are a number of document type and backend specific
394
+ restrictions imposed on the block syntax.
395
+ - The following elements cannot contain blank lines: Header, Title,
396
+ Paragraph, ItemText.
397
+ - A ListParagraph is a Paragraph with its 'listelement' option set.
398
+ - A ListContinuation is a <<X15,list continuation element>>.
399
+
400
+ Header
401
+ ~~~~~~
402
+ The Header is optional but must start on the first line of the
403
+ document and must begin with a document <<X17,title>>. Optional Author
404
+ and Revision lines immediately follow the title. The header can be
405
+ preceded by a CommentBlock or comment lines.
406
+
407
+ The author line contains the author's name optionally followed by the
408
+ author's email address. The author's name consists of a first name
409
+ followed by optional middle and last names separated by white space.
410
+ Multi-word first, middle and last names can be entered in the header
411
+ author line using the underscore as a word separator. The email
412
+ address comes last and must be enclosed in angle <> brackets. Author
413
+ names cannot contain angle <> bracket characters.
414
+
415
+ The optional document header revision line should immediately follow
416
+ the author line. The revision line can be one of two formats:
417
+
418
+ . An alphanumeric document revision number followed by a date:
419
+ * The revision number and date must be separated by a comma.
420
+ * The revision number is optional but must contain at least one
421
+ numeric character.
422
+ * Any non-numeric characters preceding the first numeric character
423
+ will be dropped.
424
+ . An RCS/CSV/SVN $Id$ marker.
425
+
426
+ The document heading is separated from the remainder of the document
427
+ by one or more blank lines.
428
+
429
+ Here's an example AsciiDoc document header:
430
+
431
+ Writing Documentation using AsciiDoc
432
+ ====================================
433
+ Stuart Rackham <srackham@gmail.com>
434
+ v2.0, February 2003
435
+
436
+ You can override or set header parameters by passing 'revision',
437
+ 'data', 'email', 'author', 'authorinitials', 'firstname' and
438
+ 'lastname' attributes using the asciidoc(1) `-a` (`--attribute`)
439
+ command-line option. For example:
440
+
441
+ $ asciidoc -a date=2004/07/27 article.txt
442
+
443
+ Attributes can also be added to the header for substitution in the
444
+ header template with <<X18,Attribute Entry>> elements.
445
+
446
+ Preamble
447
+ ~~~~~~~~
448
+ The Preamble is an optional untitled section body between the document
449
+ Header and the first Section title.
450
+
451
+ Sections
452
+ ~~~~~~~~
453
+ AsciiDoc supports five section levels 0 to 4 (although only book
454
+ documents are allowed to contain level 0 sections). Section levels are
455
+ delineated by the section <<X17,titles>>.
456
+
457
+ Sections are translated using configuration file markup templates. To
458
+ determine which configuration file template to use AsciiDoc first
459
+ searches for special section titles in the <<X16,`[specialsections]`>>
460
+ configuration entries, if not found it uses the `[sect<level>]`
461
+ template.
462
+
463
+ The `-n` (`--section-numbers`) command-line option auto-numbers HTML
464
+ outputs (DocBook line numbering is handled automatically by the
465
+ DocBook toolchain commands).
466
+
467
+ Section IDs are auto-generated from section titles if the `sectids`
468
+ attribute is defined (the default behavior). The primary purpose of
469
+ this feature is to ensure persistence of table of contents links:
470
+ missing section IDs are generated dynamically by the JavaScript TOC
471
+ generator *after* the page is loaded. This means, for example, that if
472
+ you go to a bookmarked dynamically generated TOC address the page will
473
+ load but the browser will ignore the (as yet ungenerated) section ID.
474
+
475
+ The IDs are generated by the following algorithm:
476
+
477
+ - Replace all non-alphanumeric title characters with an underscore.
478
+ - Strip leading or trailing underscores.
479
+ - Convert to lowercase.
480
+ - Prepend an underscore (so there's no possibility of name clashes
481
+ with existing document IDs).
482
+ - A numbered suffix (`_2`, `_3` ...) is added if a same named
483
+ auto-generated section ID exists.
484
+
485
+ For example the title 'Jim's House' would generate the ID
486
+ `_jim_s_house`.
487
+
488
+ [[X16]]
489
+ Special Sections
490
+ ^^^^^^^^^^^^^^^^
491
+ In addition to normal sections, documents can contain optional
492
+ frontmatter and backmatter sections -- for example: preface,
493
+ bibliography, table of contents, index.
494
+
495
+ The AsciiDoc configuration file `[specialsections]` section specifies
496
+ special section titles and the corresponding backend markup templates.
497
+
498
+ `[specialsections]` entries are formatted like:
499
+
500
+ <pattern>=<name>
501
+
502
+ `<pattern>` is a Python regular expression and `<name>` is the name of
503
+ a configuration file markup template section. If the `<pattern>`
504
+ matches an AsciiDoc document section title then the backend output is
505
+ marked up using the `<name>` markup template (instead of the default
506
+ `sect<level>` section template). The \{title} attribute value is set
507
+ to the value of the matched regular expression group named 'title', if
508
+ there is no 'title' group \{title} defaults to the whole of the
509
+ AsciiDoc section title.
510
+
511
+ AsciiDoc comes preconfigured with the following special section
512
+ titles:
513
+
514
+ Preface (book documents only)
515
+ Abstract (article documents only)
516
+ Dedication (book documents only)
517
+ Glossary
518
+ Bibliography|References
519
+ Colophon (book documents only)
520
+ Index
521
+ Appendix [A-Z][:.] <title>
522
+
523
+ Inline Elements
524
+ ~~~~~~~~~~~~~~~
525
+ <<X34,Inline document elements>> are used to markup character
526
+ formatting and various types of text substitution. Inline elements and
527
+ inline element syntax is defined in the asciidoc(1) configuration
528
+ files.
529
+
530
+ Here is a list of AsciiDoc inline elements in the (default) order in
531
+ which they are processed:
532
+
533
+ Special characters::
534
+ These character sequences escape special characters used by
535
+ the backend markup (typically "<", ">", and "&"). See
536
+ `[specialcharacters]` configuration file sections.
537
+
538
+ Quotes::
539
+ Characters that markup words and phrases; usually for
540
+ character formatting. See `[quotes]` configuration file
541
+ sections.
542
+
543
+ Special Words::
544
+ Word or word phrase patterns singled out for markup without
545
+ the need for further annotation. See `[specialwords]`
546
+ configuration file sections.
547
+
548
+ Replacements::
549
+ Each Replacement defines a word or word phrase pattern to
550
+ search for along with corresponding replacement text. See
551
+ `[replacements]` configuration file sections.
552
+
553
+ Attributes::
554
+ Document attribute names enclosed in braces (attribute
555
+ references) are replaced by the corresponding attribute value.
556
+
557
+ Inline Macros::
558
+ Inline macros are replaced by the contents of parametrized
559
+ configuration file sections.
560
+
561
+
562
+ Document Processing
563
+ -------------------
564
+ The AsciiDoc source document is read and processed as follows:
565
+
566
+ 1. The document 'Header' is parsed, header parameter values are
567
+ substituted into the configuration file `[header]` template section
568
+ which is then written to the output file.
569
+ 2. Each document 'Section' is processed and its constituent elements
570
+ translated to the output file.
571
+ 3. The configuration file `[footer]` template section is substituted
572
+ and written to the output file.
573
+
574
+ When a block element is encountered asciidoc(1) determines the type of
575
+ block by checking in the following order (first to last): (section)
576
+ Titles, BlockMacros, Lists, DelimitedBlocks, Tables, AttributeEntrys,
577
+ AttributeLists, BlockTitles, Paragraphs.
578
+
579
+ The default paragraph definition `[paradef-default]` is last element
580
+ to be checked.
581
+
582
+ Knowing the parsing order will help you devise unambiguous macro, list
583
+ and block syntax rules.
584
+
585
+ Inline substitutions within block elements are performed in the
586
+ following default order:
587
+
588
+ 1. Special characters
589
+ 2. Quotes
590
+ 3. Special words
591
+ 4. Replacements
592
+ 5. Attributes
593
+ 6. Inline Macros
594
+ 7. Passthroughs
595
+ 8. Replacements2
596
+
597
+ The substitutions and substitution order performed on
598
+ Title, Paragraph and DelimitedBlock elements is determined by
599
+ configuration file parameters.
600
+
601
+
602
+ Text Formatting
603
+ ---------------
604
+ [[X51]]
605
+ Quoted Text
606
+ ~~~~~~~~~~~
607
+ Words and phrases can be formatted by enclosing inline text with
608
+ quote characters:
609
+
610
+ _Emphasized text_::
611
+ Word phrases \'enclosed in single quote characters' (acute
612
+ accents) or \_underline characters_ are emphasized.
613
+
614
+ *Strong text*::
615
+ Word phrases \*enclosed in asterisk characters* are rendered
616
+ in a strong font (usually bold).
617
+
618
+ +Monospaced text+::
619
+ Word phrases \`enclosed in backtick characters` (grave
620
+ accents) or \+plus characters+ are rendered in a monospaced font.
621
+
622
+ ``Quoted text''::
623
+ Phrases \``enclosed with two grave accents to the left and two
624
+ acute accents to the right\'' are rendered in quotation marks.
625
+
626
+ #Unquoted text#::
627
+ Placing \#hashes around text# does nothing, it is a mechanism
628
+ to allow inline attributes to be applied to otherwise
629
+ unformatted text (see example below).
630
+
631
+ The alternative underline and plus characters, while marginally less
632
+ readable, are arguably a better choice than the backtick and
633
+ apostrophe characters as they are not normally used for, and so not
634
+ confused with, punctuation.
635
+
636
+ Quoted text can be prefixed with an <<X21,attribute list>>. Currently
637
+ the only use made of this feature is to allow the font color,
638
+ background color and size to be specified (XHTML/HTML only, not
639
+ DocBook) using the first three positional attribute arguments. The
640
+ first argument is the text color; the second the background color; the
641
+ third is the font size. Colors are valid CSS colors and the font size
642
+ is a number which treated as em units. Here are some examples:
643
+
644
+ ---------------------------------------------------------------------
645
+ [red]#Red text#.
646
+ [,yellow]*bold text on a yellow background*.
647
+ [blue,#b0e0e6]+Monospaced blue text on a light blue background+
648
+ [,,2]#Double sized text#.
649
+ ---------------------------------------------------------------------
650
+
651
+ New quotes can be defined by editing asciidoc(1) configuration files.
652
+ See the <<X7,Configuration Files>> section for details.
653
+
654
+ .Quoted text properties
655
+ - Quoting cannot be overlapped.
656
+ - Different quoting types can be nested.
657
+ - To suppress quoted text formatting place a backslash character
658
+ immediately in front of the leading quote character(s). In the case
659
+ of ambiguity between escaped and non-escaped text you will need to
660
+ escape both leading and trailing quotes, in the case of
661
+ multi-character quotes you may even need to escape individual
662
+ characters.
663
+ - A configuration file `[quotes]` entry can be subsequently undefined
664
+ by setting it to a blank value.
665
+
666
+ [[X52]]
667
+ Constrained and Unconstrained Quotes
668
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
669
+ There are actually two types of quotes:
670
+
671
+ Constrained quotes
672
+ ++++++++++++++++++
673
+ Quote text that must be bounded by white space, for example a phrase
674
+ or a word. These are the most common type of quote and are the ones
675
+ discussed previously.
676
+
677
+ Unconstrained quotes
678
+ ++++++++++++++++++++
679
+ Unconstrained quotes have no boundary constraints and can be placed
680
+ anywhere within inline text. For consistency and to make them easier
681
+ to remember unconstrained quotes are double-ups of the `_`, `*`, `+`
682
+ and `#` constrained quotes:
683
+
684
+ __unconstrained emphasized text__
685
+ **unconstrained strong text**
686
+ ++unconstrained monospaced text++
687
+ ##unconstrained unquoted text##
688
+
689
+ The following example emboldens the letter F:
690
+
691
+ **F**ile Open...
692
+
693
+ [TIP]
694
+ =====================================================================
695
+ The `__`, `**`, `++` and `##` unconstrained quotes have to be
696
+ double-escaped (because of their similarity to the single character
697
+ constrained quotes) -- here's how to escape the previous example:
698
+
699
+ \*\*F**ile Open...
700
+
701
+ =====================================================================
702
+
703
+ [[X50]]
704
+ Inline Passthroughs
705
+ ~~~~~~~~~~~~~~~~~~~
706
+ This special text quoting mechanism passes inline text to the output
707
+ document without the usual substitutions. There are two flavors:
708
+
709
+ \+\++Triple-plus passthrough\+\++::
710
+ No change is made to the quoted text, it is passed verbatim to the
711
+ output document.
712
+
713
+ \$$Double-dollar passthrough$$::
714
+ Special characters are escaped but no other changes are made.
715
+ This passthrough can be prefixed with inline attributes.
716
+
717
+ Superscripts and Subscripts
718
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
719
+ Put \^carets on either^ side of the text to be superscripted, put
720
+ \~tildes on either side~ of text to be subscripted. For example, the
721
+ following line:
722
+
723
+ e^{amp}#960;i^+1 = 0. H~2~O and x^10^. Some ^super text^
724
+ and ~some sub text~
725
+
726
+ Is rendered like:
727
+
728
+ e^{amp}#960;i^+1 = 0. H~2~O and x^10^. Some ^super text^
729
+ and ~some sub text~
730
+
731
+ Superscripts and subscripts are implemented as <<X52,unconstrained
732
+ quotes>> so they can be escaped with a leading backslash and prefixed
733
+ with with an attribute list.
734
+
735
+ Line Breaks (HTML/XHTML)
736
+ ~~~~~~~~~~~~~~~~~~~~~~~~
737
+ A plus character preceded by at least one space character at the end
738
+ of a line forces a line break. It generates an HTML line break
739
+ (`<br />`) tag. Line breaks are ignored when outputting to DocBook
740
+ since it has no line break element.
741
+
742
+ Rulers (HTML/XHTML)
743
+ ~~~~~~~~~~~~~~~~~~~
744
+ A line of four or more apostrophe characters will generate an HTML
745
+ ruler (`<hr />`) tag. Ignored when generating non-HTML output formats.
746
+
747
+ Tabs
748
+ ~~~~
749
+ By default tab characters input files will translated to 8 spaces. Tab
750
+ expansion is set with the 'tabsize' entry in the configuration file
751
+ `[miscellaneous]` section and can be overridden in the 'include' block macro
752
+ by setting a 'tabsize' attribute in the macro's attribute list. For example:
753
+
754
+ include::addendum.txt[tabsize=2]
755
+
756
+ The tab size can also be set using the attribute command-line option,
757
+ for example `\--attribute tabsize=4`
758
+
759
+ Replacements
760
+ ~~~~~~~~~~~~
761
+ The following replacements are defined in the default AsciiDoc
762
+ configuration:
763
+
764
+ (C) copyright, (TM) trademark, (R) registered trademark,
765
+ -- em dash, ... ellipsis, -> right arrow, <- left arrow, => right
766
+ double arrow, <= left double arrow.
767
+
768
+ Which are rendered as:
769
+
770
+ (C) copyright, (TM) trademark, (R) registered trademark,
771
+ -- em dash, ... ellipsis, -> right arrow, <- left arrow, => right
772
+ double arrow, <= left double arrow.
773
+
774
+ The <<X7,Configuration Files>> section explains how to configure your
775
+ own replacements.
776
+
777
+ Special Words
778
+ ~~~~~~~~~~~~~
779
+ Words defined in `[specialwords]` configuration file sections are
780
+ automatically marked up without having to be explicitly notated.
781
+
782
+ The <<X7,Configuration Files>> section explains how to add and replace
783
+ special words.
784
+
785
+
786
+ [[X17]]
787
+ Titles
788
+ ------
789
+ Document and section titles can be in either of two formats:
790
+
791
+ Two line titles
792
+ ~~~~~~~~~~~~~~~
793
+ A two line title consists of a title line, starting hard against the
794
+ left margin, and an underline. Section underlines consist a repeated
795
+ character pairs spanning the width of the preceding title (give or
796
+ take up to three characters):
797
+
798
+ The default title underlines for each of the document levels are:
799
+
800
+
801
+ Level 0 (top level): ======================
802
+ Level 1: ----------------------
803
+ Level 2: ~~~~~~~~~~~~~~~~~~~~~~
804
+ Level 3: ^^^^^^^^^^^^^^^^^^^^^^
805
+ Level 4 (bottom level): ++++++++++++++++++++++
806
+
807
+ Examples:
808
+
809
+ Level One Section Title
810
+ -----------------------
811
+
812
+ Level 2 Subsection Title
813
+ ~~~~~~~~~~~~~~~~~~~~~~~~
814
+
815
+ [[X46]]
816
+ One line titles
817
+ ~~~~~~~~~~~~~~~
818
+ One line titles consist of a single line delimited on either side by
819
+ one or more equals characters (the number of equals characters
820
+ corresponds to the section level minus one). Here are some examples
821
+ (levels 2 and 3 illustrate the optional trailing equals characters
822
+ syntax):
823
+
824
+ = Document Title (level 0) =
825
+ == Section title (level 1) ==
826
+ === Section title (level 2) ===
827
+ ==== Section title (level 3) ====
828
+ ===== Section title (level 4) =====
829
+
830
+ .Note
831
+ - One or more spaces must fall between the title and the delimiters.
832
+ - The trailing title delimiter is optional.
833
+ - The one-line title syntax can be changed by editing the
834
+ configuration file `[titles]` section `sect0`...`sect4` entries.
835
+
836
+
837
+ [[X42]]
838
+ BlockTitles
839
+ -----------
840
+ A BlockTitle element is a single line beginning with a period followed
841
+ by a title. The title is applied to the next Paragraph,
842
+ DelimitedBlock, List, Table or BlockMacro. For example:
843
+
844
+ ........................
845
+ .Notes
846
+ - Note 1.
847
+ - Note 2.
848
+ ........................
849
+
850
+ is rendered as:
851
+
852
+ .Notes
853
+ - Note 1.
854
+ - Note 2.
855
+
856
+
857
+ [[X41]]
858
+ BlockId Element
859
+ ---------------
860
+ A 'BlockId' is a single line block element containing a unique
861
+ identifier enclosed in double square brackets. It is used to assign an
862
+ identifier to the ensuing block element for use by referring links. For
863
+ example:
864
+
865
+ [[chapter-titles]]
866
+ Chapter titles can be ...
867
+
868
+ The preceding example identifies the following paragraph so it can be
869
+ linked from other location, for example with
870
+ `\<<chapter-titles,chapter titles>>`.
871
+
872
+ 'BlockId' elements can be applied to Title, Paragraph, List,
873
+ DelimitedBlock, Table and BlockMacro elements. The BlockId element is
874
+ really just an AttributeList with a special syntax which sets the
875
+ `\{id}` attribute for substitution in the subsequent block's markup
876
+ template.
877
+
878
+ The 'BlockId' element has the same syntax and serves a similar
879
+ function to the <<X30,anchor inline macro>>.
880
+
881
+
882
+ Paragraphs
883
+ ----------
884
+ Paragraphs are terminated by a blank line, the end of file, or the
885
+ start of a DelimitedBlock.
886
+
887
+ Paragraph markup is specified by configuration file `[paradef*]`
888
+ sections. AsciiDoc ships with the following predefined paragraph
889
+ types:
890
+
891
+ Default Paragraph
892
+ ~~~~~~~~~~~~~~~~~
893
+ A Default paragraph (`[paradef-default]`) consists of one or more
894
+ non-blank lines of text. The first line must start hard against the
895
+ left margin (no intervening white space). The processing expectation
896
+ of the default paragraph type is that of a normal paragraph of text.
897
+
898
+ The 'verse' paragraph <<X23,style>> preserves line boundaries and is
899
+ useful for lyrics and poems. For example:
900
+
901
+ ---------------------------------------------------------------------
902
+ [verse]
903
+ Consul *necessitatibus* per id,
904
+ consetetur, eu pro everti postulant
905
+ homero verear ea mea, qui.
906
+ ---------------------------------------------------------------------
907
+
908
+ Renders:
909
+
910
+ [verse]
911
+ Consul *necessitatibus* per id,
912
+ consetetur, eu pro everti postulant
913
+ homero verear ea mea, qui.
914
+
915
+ Literal Paragraph
916
+ ~~~~~~~~~~~~~~~~~
917
+ A Literal paragraph (`[paradef-literal]`) consists of one or more
918
+ lines of text, where the first line is indented by one or more space
919
+ or tab characters. Literal paragraphs are rendered verbatim in a
920
+ monospaced font usually without any distinguishing background or
921
+ border. There is no text formatting or substitutions within Literal
922
+ paragraphs apart from Special Characters and Callouts. For example:
923
+
924
+ ---------------------------------------------------------------------
925
+ Consul *necessitatibus* per id,
926
+ consetetur, eu pro everti postulant
927
+ homero verear ea mea, qui.
928
+ ---------------------------------------------------------------------
929
+
930
+ Renders:
931
+
932
+ Consul *necessitatibus* per id,
933
+ consetetur, eu pro everti postulant
934
+ homero verear ea mea, qui.
935
+
936
+ NOTE: Because <<X64,lists>> can be indented it's possible for your
937
+ Literal paragraph to be misinterpreted as a list -- in situations like
938
+ this use a <<X65,LiteralBlock>> in place of a 'LiteralParagraph'.
939
+
940
+ [[X28]]
941
+ Admonition Paragraphs
942
+ ~~~~~~~~~~~~~~~~~~~~~
943
+ 'Tip', 'Note', 'Important', 'Warning' and 'Caution' paragraph
944
+ definitions support the corresponding DocBook admonishment elements --
945
+ just write a normal paragraph but place `NOTE:`, `TIP:`, `IMPORTANT:`,
946
+ `WARNING:` or `CAUTION:` as the first word of the paragraph. For
947
+ example:
948
+
949
+ NOTE: This is an example note.
950
+
951
+ or the alternative syntax:
952
+
953
+ [NOTE]
954
+ This is an example note.
955
+
956
+ Renders:
957
+
958
+ NOTE: This is an example note.
959
+
960
+ TIP: If your admonition is more than a single paragraph use an
961
+ <<X22,admonition block>> instead.
962
+
963
+ [[X47]]
964
+ Admonition Icons and Captions
965
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
966
+ NOTE: Admonition customization with `icons`, `iconsdir`, `icon` and
967
+ `caption` attributes does not apply when generating DocBook output. If
968
+ you are going the DocBook route then the <<X43,a2x(1)>> `--no-icons`
969
+ and `--icons-dir` options can be used to set the appropriate XSL
970
+ Stylesheets parameters.
971
+
972
+ By default the asciidoc(1) `xhtml11` and `html4` backends generate
973
+ text captions instead of icon image links. To generate links to icon
974
+ images define the <<X45,`icons`>> attribute, for example using the `-a
975
+ icons` command-line option.
976
+
977
+ The <<X44,`iconsdir`>> attribute sets the location of linked icon
978
+ images.
979
+
980
+ You can override the default icon image using the `icon` attribute to
981
+ specify the path of the linked image. For example:
982
+
983
+ [icon="./images/icons/wink.png"]
984
+ NOTE: What lovely war.
985
+
986
+ Use the `caption` attribute to customize the admonition captions (not
987
+ applicable to `docbook` backend). The following example suppresses the
988
+ icon image and customizes the caption of a NOTE admonition (undefining
989
+ the `icons` attribute with `icons=None` is only necessary if
990
+ <<X45,admonition icons>> have been enabled):
991
+
992
+ [icons=None, caption="My Special Note"]
993
+ NOTE: This is my special note.
994
+
995
+ This subsection also applies to <<X22,Admonition Blocks>>.
996
+
997
+
998
+ Delimited Blocks
999
+ ----------------
1000
+ Delimited blocks are blocks of text enveloped by leading and trailing
1001
+ delimiter lines (normally a series of four or more repeated
1002
+ characters). The behavior of Delimited Blocks is specified by entries
1003
+ in configuration file `[blockdef*]` sections.
1004
+
1005
+ Predefined Delimited Blocks
1006
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
1007
+ AsciiDoc ships with a number of predefined DelimitedBlocks (see the
1008
+ `asciidoc.conf` configuration file in the asciidoc(1) program
1009
+ directory):
1010
+
1011
+ Predefined delimited block underlines:
1012
+
1013
+ CommentBlock: //////////////////////////
1014
+ PassthroughBlock: ++++++++++++++++++++++++++
1015
+ ListingBlock: --------------------------
1016
+ LiteralBlock: ..........................
1017
+ SidebarBlock: **************************
1018
+ QuoteBlock: __________________________
1019
+ ExampleBlock: ==========================
1020
+ Filter blocks: ~~~~~~~~~~~~~~~~~~~~~~~~~~
1021
+
1022
+ The <<X56,code>>, <<X57,source>> and <<X58,music>> filter blocks are
1023
+ detailed in the <<X59,Filters>> section.
1024
+
1025
+ .Default DelimitedBlock substitutions
1026
+ `-------------.------------.---------.---------.---------.---------
1027
+ Passthrough Listing Literal Sidebar Quote
1028
+ -------------------------------------------------------------------
1029
+ Callouts No Yes Yes No No
1030
+ Attributes Yes No No Yes Yes
1031
+ Inline Macros Yes No No Yes Yes
1032
+ Quotes No No No Yes Yes
1033
+ Replacements No No No Yes Yes
1034
+ Special chars No Yes Yes Yes Yes
1035
+ Special words No No No Yes Yes
1036
+ -------------------------------------------------------------------
1037
+
1038
+ Listing Blocks
1039
+ ~~~~~~~~~~~~~~
1040
+ ListingBlocks are rendered verbatim in a monospaced font, they retain
1041
+ line and whitespace formatting and often distinguished by a background
1042
+ or border. There is no text formatting or substitutions within Listing
1043
+ blocks apart from Special Characters and Callouts. Listing blocks are
1044
+ often used for code and file listings.
1045
+
1046
+ Here's an example:
1047
+
1048
+ --------------------------------------
1049
+ #include <stdio.h>
1050
+
1051
+ int main() {
1052
+ printf("Hello World!\n");
1053
+ exit(0);
1054
+ }
1055
+ --------------------------------------
1056
+
1057
+ Which will be rendered like:
1058
+
1059
+ --------------------------------------
1060
+ #include <stdio.h>
1061
+
1062
+ int main() {
1063
+ printf("Hello World!\n");
1064
+ exit(0);
1065
+ }
1066
+ --------------------------------------
1067
+
1068
+ [[X65]]
1069
+ Literal Blocks
1070
+ ~~~~~~~~~~~~~~
1071
+ LiteralBlocks behave just like LiteralParagraphs except you don't have
1072
+ to indent the contents.
1073
+
1074
+ LiteralBlocks can be used to resolve list ambiguity. If the following
1075
+ list was just indented it would be processed as an ordered list (not
1076
+ an indented paragraph):
1077
+
1078
+ ---------------------------------------------------------------------
1079
+ ....................
1080
+ 1. Item 1
1081
+ 2. Item 2
1082
+ ....................
1083
+ ---------------------------------------------------------------------
1084
+
1085
+ Renders:
1086
+ ....................
1087
+ 1. Item 1
1088
+ 2. Item 2
1089
+ ....................
1090
+
1091
+ SidebarBlocks
1092
+ ~~~~~~~~~~~~~
1093
+ A sidebar is a short piece of text presented outside the narrative
1094
+ flow of the main text. The sidebar is normally presented inside a
1095
+ bordered box to set it apart from the main text.
1096
+
1097
+ The sidebar body is treated like a normal section body.
1098
+
1099
+ Here's an example:
1100
+
1101
+ ---------------------------------------------------------------------
1102
+ .An Example Sidebar
1103
+ ************************************************
1104
+ Any AsciiDoc SectionBody element (apart from
1105
+ SidebarBlocks) can be placed inside a sidebar.
1106
+ ************************************************
1107
+ ---------------------------------------------------------------------
1108
+
1109
+ Which will be rendered like:
1110
+
1111
+ .An Example Sidebar
1112
+ ************************************************
1113
+ Any AsciiDoc SectionBody element (apart from
1114
+ SidebarBlocks) can be placed inside a sidebar.
1115
+ ************************************************
1116
+
1117
+ [[X26]]
1118
+ Comment Blocks
1119
+ ~~~~~~~~~~~~~~
1120
+ The contents of CommentBlocks are not processed; they are useful for
1121
+ annotations and for excluding new or outdated content that you don't
1122
+ want displayed. Here's and example:
1123
+
1124
+ ---------------------------------------------------------------------
1125
+ //////////////////////////////////////////
1126
+ CommentBlock contents are not processed by
1127
+ asciidoc(1).
1128
+ //////////////////////////////////////////
1129
+ ---------------------------------------------------------------------
1130
+
1131
+ See also <<X25,Comment Lines>>.
1132
+
1133
+ Passthrough Blocks
1134
+ ~~~~~~~~~~~~~~~~~~
1135
+ PassthroughBlocks are for backend specific markup, text is only
1136
+ subject to attribute and macro substitution. PassthroughBlock content
1137
+ will generally be backend specific. Here's an example:
1138
+
1139
+ ---------------------------------------------------------------------
1140
+ ++++++++++++++++++++++++++++++++++++++
1141
+ <table border="1"><tr>
1142
+ <td>Cell 1</td>
1143
+ <td>Cell 2</td>
1144
+ </tr></table>
1145
+ ++++++++++++++++++++++++++++++++++++++
1146
+ ---------------------------------------------------------------------
1147
+
1148
+ Quote Blocks
1149
+ ~~~~~~~~~~~~
1150
+ QuoteBlocks are used for quoted passages of text. There are two
1151
+ styles: 'quote' and 'verse' (the first positional attribute). The
1152
+ 'attribution' and 'citetitle' attributes (positional attributes 2 and
1153
+ 3) specify the content author and source. If no attributes are
1154
+ specified the 'quote' style is used.
1155
+
1156
+ The 'quote' style treats the content like a SectionBody, for example:
1157
+
1158
+ ---------------------------------------------------------------------
1159
+ [quote, Bertrand Russell, The World of Mathematics (1956)]
1160
+ ____________________________________________________________________
1161
+ A good notation has subtlety and suggestiveness which at times makes
1162
+ it almost seem like a live teacher.
1163
+ ____________________________________________________________________
1164
+ ---------------------------------------------------------------------
1165
+
1166
+ Which is rendered as:
1167
+
1168
+ [quote, Bertrand Russell, The World of Mathematics (1956)]
1169
+ ____________________________________________________________________
1170
+ A good notation has subtlety and suggestiveness which at times makes
1171
+ it almost seem like a live teacher.
1172
+ ____________________________________________________________________
1173
+
1174
+ The 'verse' style
1175
+ retains the content's line breaks, for example:
1176
+
1177
+ ---------------------------------------------------------------------
1178
+ [verse, William Blake, from Auguries of Innocence]
1179
+ __________________________________________________
1180
+ To see a world in a grain of sand,
1181
+ And a heaven in a wild flower,
1182
+ Hold infinity in the palm of your hand,
1183
+ And eternity in an hour.
1184
+ __________________________________________________
1185
+ ---------------------------------------------------------------------
1186
+
1187
+ Which is rendered as:
1188
+
1189
+ [verse, William Blake, from Auguries of Innocence]
1190
+ __________________________________________________
1191
+ To see a world in a grain of sand,
1192
+ And a heaven in a wild flower,
1193
+ Hold infinity in the palm of your hand,
1194
+ And eternity in an hour.
1195
+ __________________________________________________
1196
+
1197
+ [[X48]]
1198
+ Example Blocks
1199
+ ~~~~~~~~~~~~~~
1200
+ ExampleBlocks encapsulate the DocBook Example element and are used
1201
+ for, well, examples. Example blocks can be titled by preceding them
1202
+ with a 'BlockTitle'. DocBook toolchains normally number examples and
1203
+ generate a 'List of Examples' backmatter section.
1204
+
1205
+ Example blocks are delimited by lines of equals characters and you can
1206
+ put any block elements apart from Titles, BlockTitles and Sidebars)
1207
+ inside an example block. For example:
1208
+
1209
+ ---------------------------------------------------------------------
1210
+ .An example
1211
+ =====================================================================
1212
+ Qui in magna commodo, est labitur dolorum an. Est ne magna primis
1213
+ adolescens.
1214
+ =====================================================================
1215
+ ---------------------------------------------------------------------
1216
+
1217
+ Renders:
1218
+
1219
+ .An example
1220
+ =====================================================================
1221
+ Qui in magna commodo, est labitur dolorum an. Est ne magna primis
1222
+ adolescens.
1223
+ =====================================================================
1224
+
1225
+ The title prefix that is automatically inserted by asciidoc(1) can be
1226
+ customized with the `caption` attribute (`xhtml11` and `html4`
1227
+ backends). For example
1228
+
1229
+ ---------------------------------------------------------------------
1230
+ [caption="Example 1: "]
1231
+ .An example with a custom caption
1232
+ =====================================================================
1233
+ Qui in magna commodo, est labitur dolorum an. Est ne magna primis
1234
+ adolescens.
1235
+ =====================================================================
1236
+ ---------------------------------------------------------------------
1237
+
1238
+ [[X22]]
1239
+ Admonition Blocks
1240
+ ~~~~~~~~~~~~~~~~~
1241
+ The ExampleBlock definition includes a set of admonition
1242
+ <<X23,styles>> (NOTE, TIP, IMPORTANT, WARNING, CAUTION) for generating
1243
+ admonition blocks (admonitions containing more than just a
1244
+ <<X28,simple paragraph>>). Just precede the ExampleBlock with an
1245
+ attribute list containing the admonition style name. For example:
1246
+
1247
+ ---------------------------------------------------------------------
1248
+ [NOTE]
1249
+ .A NOTE block
1250
+ =====================================================================
1251
+ Qui in magna commodo, est labitur dolorum an. Est ne magna primis
1252
+ adolescens.
1253
+
1254
+ . Fusce euismod commodo velit.
1255
+ . Vivamus fringilla mi eu lacus.
1256
+ .. Fusce euismod commodo velit.
1257
+ .. Vivamus fringilla mi eu lacus.
1258
+ . Donec eget arcu bibendum
1259
+ nunc consequat lobortis.
1260
+ =====================================================================
1261
+ ---------------------------------------------------------------------
1262
+
1263
+ Renders:
1264
+
1265
+ [NOTE]
1266
+ .A NOTE block
1267
+ =====================================================================
1268
+ Qui in magna commodo, est labitur dolorum an. Est ne magna primis
1269
+ adolescens.
1270
+
1271
+ . Fusce euismod commodo velit.
1272
+ . Vivamus fringilla mi eu lacus.
1273
+ .. Fusce euismod commodo velit.
1274
+ .. Vivamus fringilla mi eu lacus.
1275
+ . Donec eget arcu bibendum
1276
+ nunc consequat lobortis.
1277
+ =====================================================================
1278
+
1279
+ See also <<X47,Admonition Icons and Captions>>.
1280
+
1281
+
1282
+ [[X64]]
1283
+ Lists
1284
+ -----
1285
+ .List types
1286
+ - Bulleted lists. Also known as itemized or unordered lists.
1287
+ - Numbered lists. Also called ordered lists.
1288
+ - Labeled lists. Sometimes called variable or definition lists.
1289
+ - Callout lists (a list of callout annotations).
1290
+
1291
+ .List behavior
1292
+ - Indentation is optional and does not determine nesting, indentation
1293
+ does however make the source more readable.
1294
+ - A nested list must use a different syntax from its parent so that
1295
+ asciidoc(1) can distinguish the start of a nested list.
1296
+ - By default lists of the same type can only be nested two deep; this
1297
+ could be increased by defining new list definitions.
1298
+ - In addition to nested lists a list item will include immediately
1299
+ following Literal paragraphs.
1300
+ - Use <<X15, List Item Continuation>> to include other block elements
1301
+ in a list item.
1302
+ - The `listindex` <<X60,intrinsic attribute>> is the current list item
1303
+ index (1..). If this attribute is not inside a list then it's value
1304
+ is the number of items in the most recently closed list. Useful for
1305
+ displaying the number of items in a list.
1306
+
1307
+ Bulleted and Numbered Lists
1308
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
1309
+ Bulleted list items start with a dash or an asterisk followed by a
1310
+ space or tab character. Bulleted list syntaxes are:
1311
+
1312
+ ...................
1313
+ - List item.
1314
+ * List item.
1315
+ ...................
1316
+
1317
+ Numbered list items start with an optional number or letter followed
1318
+ by a period followed by a space or tab character. List numbering is
1319
+ optional. Numbered list syntaxes are:
1320
+ .....................................................................
1321
+ . Integer numbered list item.
1322
+ 1. Integer numbered list item with optional numbering.
1323
+ .. Lowercase letter numbered list item.
1324
+ a. Lowercase letter numbered list item with optional numbering.
1325
+ .....................................................................
1326
+
1327
+ Here are some examples:
1328
+ ---------------------------------------------------------------------
1329
+ - Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
1330
+ * Fusce euismod commodo velit.
1331
+ * Qui in magna commodo, est labitur dolorum an. Est ne magna primis
1332
+ adolescens. Sit munere ponderum dignissim et. Minim luptatum et
1333
+ vel.
1334
+ * Vivamus fringilla mi eu lacus.
1335
+ * Donec eget arcu bibendum nunc consequat lobortis.
1336
+ - Nulla porttitor vulputate libero.
1337
+ . Fusce euismod commodo velit.
1338
+ . Vivamus fringilla mi eu lacus.
1339
+ .. Fusce euismod commodo velit.
1340
+ .. Vivamus fringilla mi eu lacus.
1341
+ . Donec eget arcu bibendum nunc consequat lobortis.
1342
+ - Praesent eget purus quis magna eleifend eleifend.
1343
+ 1. Fusce euismod commodo velit.
1344
+ a. Fusce euismod commodo velit.
1345
+ b. Vivamus fringilla mi eu lacus.
1346
+ c. Donec eget arcu bibendum nunc consequat lobortis.
1347
+ 2. Vivamus fringilla mi eu lacus.
1348
+ 3. Donec eget arcu bibendum nunc consequat lobortis.
1349
+ 4. Nam fermentum mattis ante.
1350
+ ---------------------------------------------------------------------
1351
+
1352
+ Which render as:
1353
+
1354
+ - Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
1355
+ * Fusce euismod commodo velit.
1356
+ * Qui in magna commodo, est labitur dolorum an. Est ne magna primis
1357
+ adolescens. Sit munere ponderum dignissim et. Minim luptatum et
1358
+ vel.
1359
+ * Vivamus fringilla mi eu lacus.
1360
+ * Donec eget arcu bibendum nunc consequat lobortis.
1361
+ - Nulla porttitor vulputate libero.
1362
+ . Fusce euismod commodo velit.
1363
+ . Vivamus fringilla mi eu lacus.
1364
+ .. Fusce euismod commodo velit.
1365
+ .. Vivamus fringilla mi eu lacus.
1366
+ . Donec eget arcu bibendum nunc consequat lobortis.
1367
+ - Praesent eget purus quis magna eleifend eleifend.
1368
+ 1. Fusce euismod commodo velit.
1369
+ a. Fusce euismod commodo velit.
1370
+ b. Vivamus fringilla mi eu lacus.
1371
+ c. Donec eget arcu bibendum nunc consequat lobortis.
1372
+ 2. Vivamus fringilla mi eu lacus.
1373
+ 3. Donec eget arcu bibendum nunc consequat lobortis.
1374
+ 4. Nam fermentum mattis ante.
1375
+
1376
+ Vertical Labeled Lists
1377
+ ~~~~~~~~~~~~~~~~~~~~~~
1378
+ Labeled list items consist of one or more text labels followed the
1379
+ text of the list item.
1380
+
1381
+ An item label begins a line with an alphanumeric character hard
1382
+ against the left margin and ends with a double colon `::` or
1383
+ semi-colon `;;`.
1384
+
1385
+ The list item text consists of one or more lines of text starting on
1386
+ the line immediately following the label and can be followed by nested
1387
+ List or ListParagraph elements. Item text can be optionally indented.
1388
+
1389
+ Here are some examples:
1390
+ ---------------------------------------------------------------------
1391
+ Lorem::
1392
+ Fusce euismod commodo velit.
1393
+
1394
+ Fusce euismod commodo velit.
1395
+
1396
+ Ipsum::
1397
+ Vivamus fringilla mi eu lacus.
1398
+ * Vivamus fringilla mi eu lacus.
1399
+ * Donec eget arcu bibendum nunc consequat lobortis.
1400
+ Dolor::
1401
+ Donec eget arcu bibendum nunc consequat lobortis.
1402
+ Suspendisse;;
1403
+ A massa id sem aliquam auctor.
1404
+ Morbi;;
1405
+ Pretium nulla vel lorem.
1406
+ In;;
1407
+ Dictum mauris in urna.
1408
+ ---------------------------------------------------------------------
1409
+
1410
+ Which render as:
1411
+
1412
+ Lorem::
1413
+ Fusce euismod commodo velit.
1414
+
1415
+ Fusce euismod commodo velit.
1416
+
1417
+ Ipsum::
1418
+ Vivamus fringilla mi eu lacus.
1419
+ * Vivamus fringilla mi eu lacus.
1420
+ * Donec eget arcu bibendum nunc consequat lobortis.
1421
+ Dolor::
1422
+ Donec eget arcu bibendum nunc consequat lobortis.
1423
+ Suspendisse;;
1424
+ A massa id sem aliquam auctor.
1425
+ Morbi;;
1426
+ Pretium nulla vel lorem.
1427
+ In;;
1428
+ Dictum mauris in urna.
1429
+
1430
+ Horizontal Labeled Lists
1431
+ ~~~~~~~~~~~~~~~~~~~~~~~~
1432
+ Horizontal labeled lists differ from vertical labeled lists in that
1433
+ the label and the list item sit side-by-side as opposed to the item
1434
+ under the label. Item text must begin on the same line as the label
1435
+ although you can begin item text on the next line if you follow the
1436
+ label with a backslash.
1437
+
1438
+ The following horizontal list example also illustrates the omission
1439
+ of optional indentation:
1440
+
1441
+ ---------------------------------------------------------------------
1442
+ *Lorem*:: Fusce euismod commodo velit. Qui in magna commodo, est
1443
+ labitur dolorum an. Est ne magna primis adolescens.
1444
+
1445
+ Fusce euismod commodo velit.
1446
+
1447
+ *Ipsum*:: Vivamus fringilla mi eu lacus.
1448
+ - Vivamus fringilla mi eu lacus.
1449
+ - Donec eget arcu bibendum nunc consequat lobortis.
1450
+
1451
+ *Dolor*:: \
1452
+ - Vivamus fringilla mi eu lacus.
1453
+ - Donec eget arcu bibendum nunc consequat lobortis.
1454
+
1455
+ ---------------------------------------------------------------------
1456
+
1457
+ Which render as:
1458
+
1459
+ *Lorem*:: Fusce euismod commodo velit. Qui in magna commodo, est
1460
+ labitur dolorum an. Est ne magna primis adolescens.
1461
+
1462
+ Fusce euismod commodo velit.
1463
+
1464
+ *Ipsum*:: Vivamus fringilla mi eu lacus.
1465
+ - Vivamus fringilla mi eu lacus.
1466
+ - Donec eget arcu bibendum nunc consequat lobortis.
1467
+
1468
+ *Dolor*:: \
1469
+ - Vivamus fringilla mi eu lacus.
1470
+ - Donec eget arcu bibendum nunc consequat lobortis.
1471
+
1472
+ [WARNING]
1473
+ =====================================================================
1474
+ - Use vertical labeled lists in preference to horizontal labeled lists
1475
+ -- current PDF toolchains do not make a good job of determining
1476
+ the relative column widths.
1477
+ - If you are generating DocBook markup the horizontal labeled lists
1478
+ should not be nested because the 'DocBook XML V4.2' DTD does not
1479
+ permit nested informal tables (although <<X13,DocBook XSL
1480
+ Stylesheets>> process them correctly).
1481
+ =====================================================================
1482
+
1483
+ Question and Answer Lists
1484
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
1485
+ AsciiDoc comes pre-configured with a labeled list for generating
1486
+ DocBook question and answer (Q&A) lists (`??` label delimiter).
1487
+ Example:
1488
+
1489
+ ---------------------------------------------------------------------
1490
+ Question one??
1491
+ Answer one.
1492
+ Question two??
1493
+ Answer two.
1494
+ ---------------------------------------------------------------------
1495
+
1496
+ Renders:
1497
+
1498
+ Question one??
1499
+ Answer one.
1500
+ Question two??
1501
+ Answer two.
1502
+
1503
+ Glossary Lists
1504
+ ~~~~~~~~~~~~~~
1505
+ AsciiDoc comes pre-configured with a labeled list (`:-` label
1506
+ delimiter) for generating DocBook glossary lists. Example:
1507
+
1508
+ ---------------------------------------------------------------------
1509
+ A glossary term:-
1510
+ The corresponding definition.
1511
+ A second glossary term:-
1512
+ The corresponding definition.
1513
+ ---------------------------------------------------------------------
1514
+
1515
+ For working examples see the `article.txt` and `book.txt` documents in
1516
+ the AsciiDoc `./doc` distribution directory.
1517
+
1518
+ NOTE: To generate valid DocBook output glossary lists must be located
1519
+ in a glossary section.
1520
+
1521
+ Bibliography Lists
1522
+ ~~~~~~~~~~~~~~~~~~
1523
+ AsciiDoc comes with a predefined itemized list (`+` item bullet) for
1524
+ generating bibliography entries. Example:
1525
+
1526
+ ---------------------------------------------------------------------
1527
+ + [[[taoup]]] Eric Steven Raymond. 'The Art of UNIX
1528
+ Programming'. Addison-Wesley. ISBN 0-13-142901-9.
1529
+ + [[[walsh-muellner]]] Norman Walsh & Leonard Muellner.
1530
+ 'DocBook - The Definitive Guide'. O'Reilly & Associates.
1531
+ 1999. ISBN 1-56592-580-7.
1532
+ ---------------------------------------------------------------------
1533
+
1534
+ The `[[[<reference>]]]` syntax is a bibliography entry anchor, it
1535
+ generates an anchor named `<reference>` and additionally displays
1536
+ `[<reference>]` at the anchor position. For example `[\[[taoup]]]`
1537
+ generates an anchor named `taoup` that displays `[taoup]` at the
1538
+ anchor position. Cite the reference from elsewhere your document using
1539
+ `\<<taoup>>`, this displays a hyperlink (`[taoup]`) to the
1540
+ corresponding bibliography entry anchor.
1541
+
1542
+ For working examples see the `article.txt` and `book.txt` documents in
1543
+ the AsciiDoc `./doc` distribution directory.
1544
+
1545
+ NOTE: To generate valid DocBook output bibliography lists must be
1546
+ located in a bibliography section.
1547
+
1548
+ [[X15]]
1549
+ List Item Continuation
1550
+ ~~~~~~~~~~~~~~~~~~~~~~
1551
+ To include subsequent block elements in list items (in addition to
1552
+ implicitly included nested lists and Literal paragraphs) place a
1553
+ separator line containing a single plus character between the list
1554
+ item and the ensuing list continuation element. Multiple block
1555
+ elements (excluding section Titles and BlockTitles) may be included in
1556
+ a list item using this technique. For example:
1557
+
1558
+ Here's an example of list item continuation:
1559
+
1560
+ ---------------------------------------------------------------------
1561
+ 1. List item one.
1562
+ +
1563
+ List item one continued with a second paragraph followed by an
1564
+ Indented block.
1565
+ +
1566
+ .................
1567
+ $ ls *.sh
1568
+ $ mv *.sh ~/tmp
1569
+ .................
1570
+ +
1571
+ List item one continued with a third paragraph.
1572
+
1573
+ 2. List item two.
1574
+
1575
+ List item two literal paragraph (no continuation required).
1576
+
1577
+ - Nested list (item one).
1578
+
1579
+ Nested list literal paragraph (no continuation required).
1580
+ +
1581
+ Nested list appended list item one paragraph
1582
+
1583
+ - Nested list item two.
1584
+ ---------------------------------------------------------------------
1585
+
1586
+ Renders:
1587
+
1588
+ 1. List item one.
1589
+ +
1590
+ List item one continued with a second paragraph followed by a Listing
1591
+ block.
1592
+ +
1593
+ .................
1594
+ $ ls *.sh
1595
+ $ mv *.sh ~/tmp
1596
+ .................
1597
+ +
1598
+ List item one continued with a third paragraph.
1599
+
1600
+ 2. List item two.
1601
+
1602
+ List item two literal paragraph (no continuation required).
1603
+
1604
+ - Nested list (item one).
1605
+
1606
+ Nested list literal paragraph (no continuation required).
1607
+ +
1608
+ Nested list appended list item one paragraph
1609
+
1610
+ - Nested list item two.
1611
+
1612
+
1613
+ [[X29]]
1614
+ List Block
1615
+ ~~~~~~~~~~
1616
+ A List block is a special delimited block containing a list element.
1617
+
1618
+ - All elements between in the List Block are part of the preceding
1619
+ list item. In this respect the List block behaves like <<X15,List
1620
+ Item Continuation>> except that list items contained within the
1621
+ block do not require explicit `+` list item continuation lines:
1622
+ - The block delimiter is a single line containing two dashes.
1623
+ - Any block title or attributes are passed to the first element inside
1624
+ the block.
1625
+
1626
+ The List Block is useful for:
1627
+
1628
+ 1. Lists with long multi-element list items.
1629
+ 2. Nesting a list within a parent list item (by default nested lists
1630
+ follow the preceding list item).
1631
+
1632
+ Here's an example of a nested list block:
1633
+
1634
+ ---------------------------------------------------------------------
1635
+ .Nested List Block
1636
+ 1. List item one.
1637
+ +
1638
+ This paragraph is part of the preceding list item
1639
+ +
1640
+ --
1641
+ a. This list is nested and does not require explicit item continuation.
1642
+
1643
+ This paragraph is part of the preceding list item
1644
+
1645
+ b. List item b.
1646
+
1647
+ This paragraph belongs to list item b.
1648
+ --
1649
+ +
1650
+ This paragraph belongs to item 1.
1651
+
1652
+ 2. Item 2 of the outer list.
1653
+ ---------------------------------------------------------------------
1654
+
1655
+ Renders:
1656
+
1657
+ .Nested List Block
1658
+ 1. List item one.
1659
+ +
1660
+ This paragraph is part of the preceding list item
1661
+ +
1662
+ --
1663
+ a. This list is nested and does not require explicit item continuation.
1664
+
1665
+ This paragraph is part of the preceding list item
1666
+
1667
+ b. List item b.
1668
+
1669
+ This paragraph belongs to list item b.
1670
+ --
1671
+ +
1672
+ This paragraph belongs to item 1.
1673
+
1674
+ 2. Item 2 of the outer list.
1675
+
1676
+
1677
+ Footnotes
1678
+ ---------
1679
+ The shipped AsciiDoc configuration includes the `\footnote:[<text>]`
1680
+ inline macro for generating footnotes. The footnote text can span
1681
+ multiple lines. Example footnote:
1682
+
1683
+ A footnote footnote:[An example footnote.]
1684
+
1685
+ Which renders:
1686
+
1687
+ A footnote footnote:[An example footnote.]
1688
+
1689
+ Footnotes are primarily useful when generating DocBook output --
1690
+ DocBook conversion programs render footnote outside the primary text
1691
+ flow.
1692
+
1693
+
1694
+ Indexes
1695
+ -------
1696
+ The shipped AsciiDoc configuration includes the inline macros for
1697
+ generating document index entries.
1698
+
1699
+ `\indexterm:[<primary>,<secondary>,<tertiary>]`::
1700
+ `\(((<primary>,<secondary>,<tertiary>)))`::
1701
+ This inline macro generates an index term (the <secondary> and
1702
+ <tertiary> attributes are optional). For example
1703
+ `\indexterm:[Tigers,Big cats]` (or, using the alternative syntax
1704
+ `\(((Tigers,Big cats)))`. Index terms that have secondary and
1705
+ tertiary entries also generate separate index terms for the
1706
+ secondary and tertiary entries. The index terms appear in the
1707
+ index, not the primary text flow.
1708
+
1709
+ `\indexterm2:[<primary>]`::
1710
+ `\((<primary>))`::
1711
+ This inline macro generates an index term that appears in both the
1712
+ index and the primary text flow. The `<primary>` should not be
1713
+ padded to the left or right with white space characters.
1714
+
1715
+ For working examples see the `article.txt` and `book.txt` documents in
1716
+ the AsciiDoc `./doc` distribution directory.
1717
+
1718
+ NOTE: Index entries only really make sense if you are generating
1719
+ DocBook markup -- DocBook conversion programs automatically generate
1720
+ an index at the point an 'Index' section appears in source document.
1721
+
1722
+
1723
+ Callouts
1724
+ --------
1725
+ Callouts are a mechanism for annotating verbatim text (source code,
1726
+ computer output and user input for example). Callout markers are
1727
+ placed inside the annotated text while the actual annotations are
1728
+ presented in a callout list after the annotated text. Here's an
1729
+ example:
1730
+
1731
+ ---------------------------------------------------------------------
1732
+ .MS-DOS directory listing
1733
+ .....................................................
1734
+ 10/17/97 9:04 <DIR> bin
1735
+ 10/16/97 14:11 <DIR> DOS \<1>
1736
+ 10/16/97 14:40 <DIR> Program Files
1737
+ 10/16/97 14:46 <DIR> TEMP
1738
+ 10/17/97 9:04 <DIR> tmp
1739
+ 10/16/97 14:37 <DIR> WINNT
1740
+ 10/16/97 14:25 119 AUTOEXEC.BAT \<2>
1741
+ 2/13/94 6:21 54,619 COMMAND.COM \<2>
1742
+ 10/16/97 14:25 115 CONFIG.SYS \<2>
1743
+ 11/16/97 17:17 61,865,984 pagefile.sys
1744
+ 2/13/94 6:21 9,349 WINA20.386 \<3>
1745
+ .....................................................
1746
+
1747
+ \<1> This directory holds MS-DOS.
1748
+ \<2> System startup code for DOS.
1749
+ \<3> Some sort of Windows 3.1 hack.
1750
+ ---------------------------------------------------------------------
1751
+
1752
+ Which renders:
1753
+
1754
+ .MS-DOS directory listing
1755
+ .....................................................................
1756
+ 10/17/97 9:04 <DIR> bin
1757
+ 10/16/97 14:11 <DIR> DOS <1>
1758
+ 10/16/97 14:40 <DIR> Program Files
1759
+ 10/16/97 14:46 <DIR> TEMP
1760
+ 10/17/97 9:04 <DIR> tmp
1761
+ 10/16/97 14:37 <DIR> WINNT
1762
+ 10/16/97 14:25 119 AUTOEXEC.BAT <2>
1763
+ 2/13/94 6:21 54,619 COMMAND.COM <2>
1764
+ 10/16/97 14:25 115 CONFIG.SYS <2>
1765
+ 11/16/97 17:17 61,865,984 pagefile.sys
1766
+ 2/13/94 6:21 9,349 WINA20.386 <3>
1767
+ .....................................................................
1768
+
1769
+ <1> This directory holds MS-DOS.
1770
+ <2> System startup code for DOS.
1771
+ <3> Some sort of Windows 3.1 hack.
1772
+
1773
+ .Explanation
1774
+ - The callout marks are whole numbers enclosed in angle brackets that
1775
+ refer to an item index in the following callout list.
1776
+ - By default callout marks are confined to LiteralParagraphs,
1777
+ LiteralBlocks and ListingBlocks (although this is a configuration
1778
+ file option and can be changed).
1779
+ - Callout list item numbering is fairly relaxed -- list items can
1780
+ start with `<n>`, `n>` or `>` where `n` is the optional list item
1781
+ number (in the latter case list items starting with a single `>`
1782
+ character are implicitly numbered starting at one).
1783
+ - Callout lists should not be nested -- start list items hard against
1784
+ the left margin.
1785
+ - If you want to present a number inside angle brackets you'll need to
1786
+ escape it with a backslash to prevent it being interpreted as a
1787
+ callout mark.
1788
+
1789
+ NOTE: To include callout icons in PDF files generated by
1790
+ <<X43,a2x(1)>> you need to use the `--icons` command-line option.
1791
+
1792
+ Implementation Notes
1793
+ ~~~~~~~~~~~~~~~~~~~~
1794
+ Callout marks are generated by the 'callout' inline macro while
1795
+ callout lists are generated using the 'callout' list definition. The
1796
+ 'callout' macro and 'callout' list are special in that they work
1797
+ together. The 'callout' inline macro is not enabled by the normal
1798
+ 'macros' substitutions option, instead it has its own 'callouts'
1799
+ substitution option.
1800
+
1801
+ The following attributes are available during inline callout macro
1802
+ substitution:
1803
+
1804
+ `\{index}`::
1805
+ The callout list item index inside the angle brackets.
1806
+ `\{coid}`::
1807
+ An identifier formatted like `CO<listnumber>-<index>` that
1808
+ uniquely identifies the callout mark. For example `CO2-4`
1809
+ identifies the fourth callout mark in the second set of callout
1810
+ marks.
1811
+
1812
+ The `\{coids}` attribute can be used during callout list item
1813
+ substitution -- it is a space delimited list of callout IDs that refer
1814
+ to the explanatory list item.
1815
+
1816
+ Including callouts in included code
1817
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1818
+ You can annotate working code examples with callouts -- just remember
1819
+ to put the callouts inside source code comments. This example displays
1820
+ the `test.py` source file (containing a single callout) using the
1821
+ <<X57,Source Code Highlighter Filter>>:
1822
+
1823
+ .AsciiDoc source
1824
+ ---------------------------------------------------------------------
1825
+ [source,python]
1826
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1827
+ include::test.py[]
1828
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1829
+
1830
+ \<1> Print statement.
1831
+ ---------------------------------------------------------------------
1832
+
1833
+ .Included `test.py` source
1834
+ ---------------------------------------------------------------------
1835
+ print 'Hello World!' # \<1>
1836
+ ---------------------------------------------------------------------
1837
+
1838
+
1839
+ Macros
1840
+ ------
1841
+ Macros are a mechanism for substituting parametrized text into output
1842
+ documents.
1843
+
1844
+ Macros have a 'name', a single 'target' argument and an 'attribute
1845
+ list'. The default syntax is `<name>:<target>[<attributelist>]` (for
1846
+ inline macros) and `<name>::<target>[<attributelist>]` (for block
1847
+ macros). Here are some examples:
1848
+
1849
+ http://www.methods.co.nz/asciidoc/index.html[Asciidoc home page]
1850
+ include::chapt1.txt[tabsize=2]
1851
+ mailto:srackham@gmail.com[]
1852
+
1853
+ .Macro behavior
1854
+ - `<name>` is the macro name. It can only contain letters, digits or
1855
+ dash characters and cannot start with a dash.
1856
+ - The optional `<target>` cannot contain white space characters.
1857
+ - `<attributelist>` is a <<X21,list of attributes>> enclosed in square
1858
+ brackets.
1859
+ - The attribute list is mandatory except for URLs and email addresses.
1860
+ - Expansion of non-system macro references can be escaped by
1861
+ prefixing a backslash character.
1862
+ - Block macro attribute reference substitution is performed prior to
1863
+ macro expansion.
1864
+ - The substitutions performed prior to Inline macro macro expansion
1865
+ are determined by the inline context.
1866
+ - Macros are processed in the order they appear in the configuration
1867
+ file(s).
1868
+ - Calls to inline macros can be nested inside different inline macros
1869
+ (an inline macro call cannot contain a nested call to itself).
1870
+
1871
+ Inline Macros
1872
+ ~~~~~~~~~~~~~
1873
+ Inline Macros occur in an inline element context. Predefined Inline
1874
+ macros include 'URLs', 'image' and 'link' macros.
1875
+
1876
+ URLs
1877
+ ^^^^
1878
+ 'http', 'https', 'ftp', 'file', 'mailto' and 'callto' URLs are
1879
+ rendered using predefined inline macros.
1880
+
1881
+ - If you don't need a customized the link caption you can enter the
1882
+ 'http', 'https', 'ftp', 'file' URLs and email addresses without any
1883
+ special macro syntax.
1884
+ - If no caption text is specified the URL is displayed.
1885
+
1886
+ Here are some examples:
1887
+
1888
+ http://www.methods.co.nz/asciidoc/[The AsciiDoc home page]
1889
+ http://www.methods.co.nz/asciidoc/
1890
+ mailto:joe.bloggs@foobar.com[email Joe Bloggs]
1891
+ joe.bloggs@foobar.com
1892
+ callto:joe.bloggs[]
1893
+
1894
+ Which are rendered:
1895
+
1896
+ http://www.methods.co.nz/asciidoc/[The AsciiDoc home page]
1897
+
1898
+ http://www.methods.co.nz/asciidoc/
1899
+
1900
+ mailto:joe.bloggs@foobar.com[email Joe Bloggs]
1901
+
1902
+ joe.bloggs@foobar.com
1903
+
1904
+ callto:joe.bloggs[]
1905
+
1906
+ - If the `<target>` necessitates space characters they should be
1907
+ replaced by `%20`. For example `large%20image.png`.
1908
+ - Define an attribute entry if you refer to the same URL more than
1909
+ once, this will make your document <<X62,easier to maintain and
1910
+ easier to read>>.
1911
+
1912
+ Internal Cross References
1913
+ ^^^^^^^^^^^^^^^^^^^^^^^^^
1914
+ Two AsciiDoc inline macros are provided for creating hypertext links
1915
+ within an AsciiDoc document. You can use either the standard macro
1916
+ syntax or the (preferred) alternative.
1917
+
1918
+ [[X30]]
1919
+ anchor
1920
+ ++++++
1921
+ Used to specify hypertext link targets:
1922
+
1923
+ [[<id>,<xreflabel>]]
1924
+ anchor:<id>[<xreflabel>]
1925
+
1926
+ The `<id>` is a unique identifier that must begin with a letter. The
1927
+ optional `<xreflabel>` is the text to be displayed by captionless
1928
+ 'xref' macros that refer to this anchor. The optional `<xreflabel>` is
1929
+ only really useful when generating DocBook output. Example anchor:
1930
+
1931
+ [[X1]]
1932
+
1933
+ You may have noticed that the syntax of this inline element is the
1934
+ same as that of the <<X41,BlockId block element>>, this is no
1935
+ coincidence since they are functionally equivalent.
1936
+
1937
+ xref
1938
+ ++++
1939
+ Creates a hypertext link to a document anchor.
1940
+
1941
+ <<<id>,<caption>>>
1942
+ xref:<id>[<caption>]
1943
+
1944
+ The `<id>` refers to an existing anchor `<id>`. The optional
1945
+ `<caption>` is the link's displayed text. Example:
1946
+
1947
+ <<X21,attribute lists>>
1948
+
1949
+ If `<caption>` is not specified then the displayed text is
1950
+ auto-generated:
1951
+
1952
+ - The AsciiDoc `xhtml11` backend displays the `<id>` enclosed in
1953
+ square brackets.
1954
+ - If DocBook is produced the DocBook toolchain is responsible for the
1955
+ displayed text which will normally be the referenced figure, table
1956
+ or section title number followed by the element's title text.
1957
+
1958
+ Here is an example:
1959
+
1960
+ ---------------------------------------------------------------------
1961
+ [[tiger_image]]
1962
+ .Tyger tyger
1963
+ image::tiger.png[]
1964
+
1965
+ This can be seen in <<tiger_image>>.
1966
+ ---------------------------------------------------------------------
1967
+
1968
+ Linking to Local Documents
1969
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^
1970
+ Hypertext links to files on the local file system are specified using
1971
+ the 'link' inline macro.
1972
+
1973
+ link:<target>[<caption>]
1974
+
1975
+ The 'link' macro generates relative URLs. The link macro `<target>` is
1976
+ the target file name (relative to the file system location of the
1977
+ referring document). The optional `<caption>` is the link's displayed
1978
+ text. If `<caption>` is not specified then `<target>` is displayed.
1979
+ Example:
1980
+
1981
+ link:downloads/foo.zip[download foo.zip]
1982
+
1983
+ You can use the `<filename>#<id>` syntax to refer to an anchor within
1984
+ a target document but this usually only makes sense when targeting
1985
+ HTML documents.
1986
+
1987
+ Images can serve as hyperlinks using the <<X9,`image` macro>>.
1988
+
1989
+ [[X9]]
1990
+ Images
1991
+ ^^^^^^
1992
+ Inline images are inserted into the output document using the 'image'
1993
+ macro. The inline syntax is:
1994
+
1995
+ image:<target>[<attributes>]
1996
+
1997
+ The contents of the image file `<target>` is displayed. To display the
1998
+ image its file format must be supported by the target backend
1999
+ application. HTML and DocBook applications normally support PNG or JPG
2000
+ files.
2001
+
2002
+ `<target>` file name paths are relative to the location of the
2003
+ referring document.
2004
+
2005
+ [[X55]]
2006
+ .Image macro attributes
2007
+ - The optional first positional attribute list entry specifies the
2008
+ alternative text which is displayed if the output application is
2009
+ unable to process the image file. For example:
2010
+
2011
+ image:images/logo.png[Company Logo]
2012
+
2013
+ - The optional `width` and `height` attributes scale the image size
2014
+ and can be used in any combination. The units are pixels. The
2015
+ following example scales the previous example to a height of 32
2016
+ pixels:
2017
+
2018
+ image:images/logo.png["Company Logo",height=32]
2019
+
2020
+ - The optional `link` attribute is used to link the image to an
2021
+ external document. The following example links a screenshot
2022
+ thumbnail to a full size version:
2023
+
2024
+ image:screen-thumbnail.png[height=32,link="screen.png"]
2025
+
2026
+ - The optional `scaledwidth` attribute is only used in DocBook block
2027
+ images (specifically for PDF documents). The following example
2028
+ scales the images to 75% of the available print width:
2029
+
2030
+ image::images/logo.png["Company Logo",scaledwidth="75%"]
2031
+
2032
+ - The optional `align` attribute is used for horizontal image
2033
+ alignment in DocBook block images (specifically for PDF documents).
2034
+ Allowed values are `center`, `left` and `right`. For example:
2035
+
2036
+ image::images/tiger.png["Tiger image",align="left"]
2037
+
2038
+ Block Macros
2039
+ ~~~~~~~~~~~~
2040
+ A Block macro reference must be contained in a single line separated
2041
+ either side by a blank line or a block delimiter.
2042
+
2043
+ Block macros behave just like Inline macros, with the following
2044
+ differences:
2045
+
2046
+ - They occur in a block context.
2047
+ - The default syntax is `<name>::<target>[<attributelist>]` (two
2048
+ colons, not one).
2049
+ - Markup template section names end in `-blockmacro` instead of
2050
+ `-inlinemacro`.
2051
+
2052
+ Block Identifier
2053
+ ^^^^^^^^^^^^^^^^
2054
+ The Block Identifier macro sets the `id` attribute and has the same
2055
+ syntax as the <<X30,anchor inline macro>> since it performs
2056
+ essentially the same function -- block templates employ the `id`
2057
+ attribute as a block link target. For example:
2058
+
2059
+ [[X30]]
2060
+
2061
+ This is equivalent to the `[id="X30"]` block attribute list.
2062
+
2063
+ [[X49]]
2064
+ Images
2065
+ ^^^^^^
2066
+ Formal titled images are inserted into the output document using the
2067
+ 'image' macro. The syntax is:
2068
+
2069
+ image::<target>[<attributes>]
2070
+
2071
+ The block `image` macro has the same <<X55,macro attributes>> as its
2072
+ <<X9,inline counterpart>>.
2073
+
2074
+ Images can be titled by preceding the `image` macro with a
2075
+ 'BlockTitle'. DocBook toolchains normally number examples and
2076
+ generate a 'List of Figures' backmatter section.
2077
+
2078
+ For example:
2079
+
2080
+ .Main circuit board
2081
+ image::images/layout.png[J14P main circuit board]
2082
+
2083
+ `xhtml11` and `html4` backends precede the title with a `Figure :`
2084
+ prefix. You can customize this prefix with the `caption` attribute.
2085
+ For example:
2086
+
2087
+ .Main circuit board
2088
+ [caption="Figure 2:"]
2089
+ image::images/layout.png[J14P main circuit board]
2090
+
2091
+ [[X66]]
2092
+ .Embedding images in XHTML documents
2093
+ *********************************************************************
2094
+ If you define the `data-uri` attribute then images referenced by
2095
+ 'image' macros will be embedded in XHTML outputs using the
2096
+ http://en.wikipedia.org/wiki/Data:_URI_scheme[data: URI scheme]. You
2097
+ can use the `data-uri` attribute to produce single-file XHTML
2098
+ documents with embedded images and CSS, for example:
2099
+
2100
+ $ asciidoc --unsafe -a data-uri mydocument.txt
2101
+
2102
+ You will need to specify the `--unsafe` option because the AsciiDoc
2103
+ `data-uri` is implemented using the `\{sys}` attribute.
2104
+
2105
+ NOTE: Internet Explorer up to version 7 does not support 'data: URIs',
2106
+ but it is supported by Internet Explorer 8 Beta 1.
2107
+
2108
+ *********************************************************************
2109
+
2110
+ [[X25]]
2111
+ Comment Lines
2112
+ ^^^^^^^^^^^^^
2113
+ Single lines starting with two forward slashes hard up against the
2114
+ left margin are treated as comments and are stripped from the output.
2115
+ Comment lines have been implemented as a block macro and are only
2116
+ valid in a block context -- they are not treated as comments inside
2117
+ paragraphs or delimited blocks. Example comment line:
2118
+
2119
+ // This is a comment.
2120
+
2121
+ See also <<X26,Comment Blocks>>.
2122
+
2123
+
2124
+ System Macros
2125
+ ~~~~~~~~~~~~~
2126
+ System macros are block macros that perform a predefined task which is
2127
+ hardwired into the asciidoc(1) program.
2128
+
2129
+ - You can't escape system macros with a leading backslash character
2130
+ (as you can with other macros).
2131
+ - The syntax and tasks performed by system macros is built into
2132
+ asciidoc(1) so they don't appear in configuration files. You can
2133
+ however customize the syntax by adding entries to a configuration
2134
+ file `[macros]` section.
2135
+
2136
+ [[X63]]
2137
+ Include Macros
2138
+ ^^^^^^^^^^^^^^
2139
+ The `include` and `include1` system macros to include the contents of
2140
+ a named file into the source document.
2141
+
2142
+ The `include` macro includes a file as if it were part of the parent
2143
+ document -- tabs are expanded and system macros processed. The
2144
+ contents of `include1` files are not subject to tab expansion or
2145
+ system macro processing nor are attribute or lower priority
2146
+ substitutions performed. The `include1` macro's main use is to include
2147
+ verbatim embedded CSS or scripts into configuration file headers.
2148
+ Example:
2149
+
2150
+ ------------------------------------
2151
+ include::chapter1.txt[tabsize=4]
2152
+ ------------------------------------
2153
+
2154
+ .Include macro behavior
2155
+ - If the included file name is specified with a relative path then the
2156
+ path is relative to the location of the referring document.
2157
+ - Include macros can appear inside configuration files.
2158
+ - Files included from within `DelimitedBlocks` are read to completion
2159
+ to avoid false end-of-block underline termination.
2160
+ - File inclusion is limited to a depth of 5 to catch recursive loops.
2161
+ - Attribute references are expanded inside the include `target`; if an
2162
+ attribute is undefined then the included file is silently skipped.
2163
+ - The 'tabsize' macro attribute sets the number of space characters to
2164
+ be used for tab expansion in the included file.
2165
+ - Internally the `include1` macro is translated to the `include1`
2166
+ system attribute which means it must be evaluated in a region where
2167
+ attribute substitution is enabled -- use the `include` macro
2168
+ instead.
2169
+
2170
+ Conditional Inclusion Macros
2171
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2172
+ Lines of text in the source document can be selectively included or
2173
+ excluded from processing based on the existence (or not) of a
2174
+ document attribute. There are two forms of conditional inclusion
2175
+ macro usage, the first includes document text between the `ifdef` and
2176
+ `endif` macros if a document attribute is defined:
2177
+
2178
+ ifdef::<attribute>[]
2179
+ :
2180
+ endif::<attribute>[]
2181
+
2182
+ The second for includes document text between the `ifndef` and `endif`
2183
+ macros if the attribute is not defined:
2184
+
2185
+ ifndef::<attribute>[]
2186
+ :
2187
+ endif::<attribute>[]
2188
+
2189
+ `<attribute>` is an attribute name which is optional in the trailing
2190
+ `endif` macro.
2191
+
2192
+ Take a look at the `*.conf` configuration files in the AsciiDoc
2193
+ distribution for examples of conditional inclusion macro usage.
2194
+
2195
+ .Two types of conditional inclusion
2196
+ *********************************************************************
2197
+ Conditional inclusion macros are evaluated when they are read, but
2198
+ there is another type of conditional inclusion based on attribute
2199
+ references, the latter being evaluated when the output file is
2200
+ written.
2201
+
2202
+ These examples illustrate the two forms of conditional inclusion. The
2203
+ only difference between them is that the first is evaluated at program
2204
+ load time while the second is evaluated when the output is written:
2205
+
2206
+ ifdef::world[]
2207
+ Hello World!
2208
+ endif::world[]
2209
+
2210
+ {world#}Hello World!
2211
+
2212
+ In this example when the `\{world#}` conditional attribute reference
2213
+ is evaluates to a zero length string if `world` is defined; if `world`
2214
+ is not defined the whole line is dropped.
2215
+
2216
+ The subtle difference between the two types of conditional inclusion
2217
+ has implications for AsciiDoc configuration files: AsciiDoc has to
2218
+ read the configuration files *before* reading the source document,
2219
+ this is necessary because the AsciiDoc source syntax is mostly defined
2220
+ by the configuration files. This means that any lines of markup
2221
+ enveloped by conditional inclusion macros will be included or excluded
2222
+ *before* the attribute entries in the AsciiDoc document header are
2223
+ read, so setting related attributes in the AsciiDoc source document
2224
+ header will have no effect. If you need to control configuration file
2225
+ markup inclusion with attribute entries in the AsciiDoc source file
2226
+ header you need to use attribute references to control inclusion
2227
+ instead of conditional inclusion macros (attribute references are
2228
+ substituted at the time the output is written rather than at program
2229
+ startup).
2230
+
2231
+ *********************************************************************
2232
+
2233
+ eval, sys and sys2 System Macros
2234
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2235
+ These block macros exhibit the same behavior as their same named
2236
+ <<X24, system attribute references>>. The difference is that system
2237
+ macros occur in a block macro context whereas system attributes are
2238
+ confined to an inline context where attribute substitution is enabled.
2239
+
2240
+ The following example displays a long directory listing inside a
2241
+ literal block:
2242
+
2243
+ ------------------
2244
+ sys::[ls -l *.txt]
2245
+ ------------------
2246
+
2247
+ Template System Macro
2248
+ ^^^^^^^^^^^^^^^^^^^^^
2249
+ The `template` block macro allows the inclusion of one configuration
2250
+ file template section within another. The following example includes
2251
+ the `[admonitionblock]` section in the `[admonitionparagraph]`
2252
+ section:
2253
+
2254
+ [admonitionparagraph]
2255
+ template::[admonitionblock]
2256
+
2257
+ .Template macro behavior
2258
+ - The `\template::[]` macro is useful for factoring configuration file
2259
+ markup.
2260
+ - `\template::[]` macros cannot be nested.
2261
+ - `\template::[]` macro expansion is applied to all sections
2262
+ after all configuration files have been read.
2263
+
2264
+
2265
+ Macro Definitions
2266
+ ~~~~~~~~~~~~~~~~~
2267
+ Each entry in the configuration `[macros]` section is a macro
2268
+ definition which can take one of the following forms:
2269
+
2270
+ `<pattern>=<name>`::
2271
+ Inline macro definition.
2272
+ `<pattern>=#<name>`::
2273
+ Block macro definition.
2274
+ `<pattern>=+<name>`::
2275
+ System macro definition.
2276
+ `<pattern>`::
2277
+ Delete the existing macro with this `<pattern>`.
2278
+
2279
+ `<pattern>` is a Python regular expression and `<name>` is the name of
2280
+ a markup template. If `<name>` is omitted then it is the value of the
2281
+ regular expression match group named 'name'.
2282
+
2283
+ .Here's what happens during macro substitution
2284
+ - Each contextually relevant macro 'pattern' from the `[macros]`
2285
+ section is matched against the input source line.
2286
+ - If a match is found the text to be substituted is loaded from a
2287
+ configuration markup template section named like
2288
+ `<name>-inlinemacro` or `<name>-blockmacro` (depending on the macro
2289
+ type).
2290
+ - Global and macro attribute list attributes are substituted in the
2291
+ macro's markup template.
2292
+ - The substituted template replaces the macro reference in the output
2293
+ document.
2294
+
2295
+
2296
+ Tables
2297
+ ------
2298
+ Tables are the most complex AsciiDoc elements and this section is
2299
+ quite long. footnote:[The current table syntax is overly complicated
2300
+ and unwieldy to edit, hopefully a more usable syntax will appear in
2301
+ future versions of AsciiDoc.]
2302
+
2303
+ NOTE: AsciiDoc generates nice HTML tables, but the current crop of
2304
+ DocBook toolchains render tables with varying degrees of success. Use
2305
+ tables only when really necessary.
2306
+
2307
+ Example Tables
2308
+ ~~~~~~~~~~~~~~
2309
+ The following annotated examples are all you'll need to start creating
2310
+ your own tables.
2311
+
2312
+ The only non-obvious thing you'll need to remember are the column stop
2313
+ characters:
2314
+
2315
+ - Backtick (`) -- align left.
2316
+ - Single quote (') -- align right.
2317
+ - Period (.) -- align center.
2318
+
2319
+ Simple table:
2320
+
2321
+ ---------------------------------------------------------------------
2322
+ `---`---
2323
+ 1 2
2324
+ 3 4
2325
+ 5 6
2326
+ --------
2327
+ ---------------------------------------------------------------------
2328
+
2329
+ Output:
2330
+
2331
+ `---`---
2332
+ 1 2
2333
+ 3 4
2334
+ 5 6
2335
+ --------
2336
+
2337
+ Table with title, header and footer:
2338
+
2339
+ ---------------------------------------------------------------------
2340
+ .An example table
2341
+ [grid="all"]
2342
+ '---------.--------------
2343
+ Column 1 Column 2
2344
+ -------------------------
2345
+ 1 Item 1
2346
+ 2 Item 2
2347
+ 3 Item 3
2348
+ -------------------------
2349
+ 6 Three items
2350
+ -------------------------
2351
+ ---------------------------------------------------------------------
2352
+
2353
+ Output:
2354
+
2355
+ .An example table
2356
+ [grid="all"]
2357
+ `-----------.--------------
2358
+ Column 1 Column 2
2359
+ ---------------------------
2360
+ 1 Item 1
2361
+ 2 Item 2
2362
+ 3 Item 3
2363
+ ---------------------------
2364
+ 6 Three items
2365
+ ---------------------------
2366
+
2367
+ Four columns totaling 15% of the 'pagewidth', CSV data:
2368
+
2369
+ ---------------------------------------------------------------------
2370
+ [frame="all"]
2371
+ ````~15
2372
+ 1,2,3,4
2373
+ a,b,c,d
2374
+ A,B,C,D
2375
+ ~~~~~~~~
2376
+ ---------------------------------------------------------------------
2377
+
2378
+ Output:
2379
+
2380
+ [frame="all"]
2381
+ ````~15
2382
+ 1,2,3,4
2383
+ a,b,c,d
2384
+ A,B,C,D
2385
+ ~~~~~~~~
2386
+
2387
+ A table with a numeric ruler and externally sourced CSV data:
2388
+
2389
+ ---------------------------------------------------------------------
2390
+ [frame="all", grid="all"]
2391
+ .15`20`25`20`~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2392
+ ID,Customer Name,Contact Name,Customer Address,Phone
2393
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2394
+ include::customers.csv[]
2395
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2396
+ ---------------------------------------------------------------------
2397
+
2398
+ Renders:
2399
+
2400
+ [frame="all", grid="all"]
2401
+ .15`20`25`20`~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2402
+ ID,Customer Name,Contact Name,Customer Address,Phone
2403
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2404
+ include::customers.csv[]
2405
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2406
+
2407
+ AsciiDoc Table Block Elements
2408
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2409
+ This sub-section details the AsciiDoc table format.
2410
+
2411
+ Table ::= (Ruler,Header?,Body,Footer?)
2412
+ Header ::= (Row+,Underline)
2413
+ Footer ::= (Row+,Underline)
2414
+ Body ::= (Row+,Underline)
2415
+ Row ::= (Data+)
2416
+
2417
+ A table is terminated when the table underline is followed by a blank
2418
+ line or an end of file. Table underlines which separate table headers,
2419
+ bodies and footers should not be followed by a blank line.
2420
+
2421
+ Ruler
2422
+ ^^^^^
2423
+ The first line of the table is called the 'Ruler'. The Ruler specifies
2424
+ which configuration file table definition to use, column widths,
2425
+ column alignments and the overall table width.
2426
+
2427
+ There are two ruler formats:
2428
+
2429
+ Character ruler::
2430
+ The column widths are determined by the number of table fill
2431
+ characters between column stop characters.
2432
+ Numeric ruler::
2433
+ The column widths are specified numerically. If a column width
2434
+ is omitted the previous width is used. In the degenerate case
2435
+ of no widths being specified columns are allocated equal
2436
+ widths.
2437
+
2438
+ The ruler format can be summarized as:
2439
+
2440
+ ruler ::= ((colstop,colwidth?,fillchar*)+, fillchar+, tablewidth?
2441
+
2442
+ - The 'ruler' starts with a column stop character (designating the
2443
+ start of the first column).
2444
+ - Column stop characters specify the start and alignment of each
2445
+ column:
2446
+ * Backtick (`) -- align left.
2447
+ * Single quote (') -- align right.
2448
+ * Period (.) -- align center.
2449
+ - In the case of 'fixed' format tables the ruler column widths specify
2450
+ source row data column boundaries.
2451
+ - The optional 'tablewidth' is a number representing the size of the
2452
+ output table relative to the 'pagewidth'. If 'tablewidth' is less
2453
+ than one then it is interpreted as a fraction of the page width; if
2454
+ it is greater than one then it is interpreted as a percentage of
2455
+ the page width. If 'tablewidth' is not specified then the table
2456
+ occupies the full 'pagewidth' (numeric rulers) or the relative width
2457
+ of the ruler compared to the 'textwidth' (character rulers).
2458
+
2459
+ Row and Data Elements
2460
+ ^^^^^^^^^^^^^^^^^^^^^
2461
+ Each table row consists of a line of text containing the same number
2462
+ of 'Data' items as there are columns in the table,
2463
+
2464
+ Lines ending in a backslash character are continued on the next line.
2465
+
2466
+ Each 'Data' item is an AsciiDoc substitutable string. The substitutions
2467
+ performed are specified by the 'subs' table definition entry. Data
2468
+ cannot contain AsciiDoc block elements.
2469
+
2470
+ The format of the row is determined by the table definition 'format'
2471
+ value:
2472
+
2473
+ fixed::
2474
+ Row data items are assigned by chopping the row up at ruler column
2475
+ width boundaries.
2476
+
2477
+ csv::
2478
+ Data items are assigned the parsed CSV (Comma Separated Values)
2479
+ data.
2480
+
2481
+ dsv::
2482
+ The DSV (Delimiter Separated Values) format is a common UNIX tabular
2483
+ text file format.
2484
+ - The separator character is a colon (although this can be set to
2485
+ any letter using the 'separator' table attribute).
2486
+ - Common C-style backslash escapes are supported.
2487
+ - Blank lines are skipped.
2488
+
2489
+ Underline
2490
+ ^^^^^^^^^
2491
+ A table 'Underline' consists of a line of three or more 'fillchar'
2492
+ characters which are end delimiters for table header, footer and body
2493
+ sections.
2494
+
2495
+ Attribute List
2496
+ ^^^^^^^^^^^^^^
2497
+ The following optional table attributes can be specified in an
2498
+ <<X21,AttributeList>> preceding the table:
2499
+
2500
+ separator::
2501
+ The default DSV format colon separator can be changed using the
2502
+ 'separator' attribute. For example: `[separator="|"]`.
2503
+
2504
+ frame::
2505
+ Defines the table border and can take the following values: 'topbot'
2506
+ (top and bottom), 'all' (all sides), 'none' and 'sides' (left and
2507
+ right sides). The default value is 'topbot'.
2508
+
2509
+ grid::
2510
+ Defines which ruler lines are drawn between table rows and columns.
2511
+ The 'grid' attribute value can be any of the following values:
2512
+ 'none', 'cols', 'rows' and 'all'. The default value is 'none'. For
2513
+ example `[frame="all", grid="none"]`.
2514
+
2515
+ format, tablewidth::
2516
+ See <<X37,Markup Attributes>> below.
2517
+
2518
+ You can also use an AttributeList to override the following table
2519
+ definition and ruler parameters: 'format', 'subs', 'tablewidth'.
2520
+
2521
+ [[X37]]
2522
+ Markup Attributes
2523
+ ^^^^^^^^^^^^^^^^^
2524
+ The following attributes are automatically available inside table tag
2525
+ and markup templates.
2526
+
2527
+ cols::
2528
+ The number of columns in the table.
2529
+
2530
+ colalign::
2531
+ Column alignment assumes one of three values ('left', 'right' or
2532
+ 'center'). The value is determined by the corresponding ruler column
2533
+ stop character (only valid inside 'colspec', 'headdata', 'bodydata'
2534
+ and 'footdata' tags).
2535
+
2536
+ colwidth::
2537
+ The output column widths are calculated integers (only valid inside
2538
+ 'colspec', 'headdata', 'bodydata' and 'footdata' tags).
2539
+
2540
+ colnumber::
2541
+ The table column number starting at 1 (only valid inside 'colspec',
2542
+ 'headdata`, `bodydata` and `footdata` tags).
2543
+
2544
+ format::
2545
+ The table definition 'format' value (can be overridden with
2546
+ attribute list entry).
2547
+
2548
+ tablewidth::
2549
+ The ruler 'tablewidth' value (can be overridden with attribute list
2550
+ entry).
2551
+
2552
+ pagewidth::
2553
+ The 'pagewidth' miscellaneous configuration option.
2554
+
2555
+ pageunits::
2556
+ The 'pageunits' miscellaneous configuration option.
2557
+
2558
+ The 'colwidth' value is calculated as (`N` is the ruler column width
2559
+ number and `M` is the sum of the ruler column widths):
2560
+
2561
+ ( N / M ) * pagewidth
2562
+
2563
+ If the ruler 'tablewidth' was specified the column width is multiplied
2564
+ again by this value.
2565
+
2566
+ There is one exception: character rulers that have no 'pagewidth'
2567
+ specified. In this case the 'colwidth' value is calculated as (where
2568
+ `N` is the column character width measured on the table ruler):
2569
+
2570
+ ( N / textwidth ) * pagewidth
2571
+
2572
+ The following attributes are available to the table markup template:
2573
+
2574
+ comspecs::
2575
+ Expands to N substituted 'comspec' tags where N is the number of
2576
+ columns.
2577
+
2578
+ headrows, footrows, bodyrows::
2579
+ These references expand to sets of substituted header, footer and
2580
+ body rows as defined by the corresponding row and data configuration
2581
+ parameters.
2582
+
2583
+ rows::
2584
+ Experimental attribute (number of source lines in table) available
2585
+ in table markup templates (used by experimental LaTeX backend).
2586
+
2587
+
2588
+ [[X1]]
2589
+ Manpage Documents
2590
+ -----------------
2591
+ Sooner or later, if you program for a UNIX environment, you're going
2592
+ to have to write a man page.
2593
+
2594
+ By observing a couple of additional conventions you can compose
2595
+ AsciiDoc files that will translate to a DocBook refentry (man page)
2596
+ document. The resulting DocBook file can then be translated to the
2597
+ native roff man page format (or other formats).
2598
+
2599
+ For example, the `asciidoc.1.txt` file in the AsciiDoc distribution
2600
+ `./doc` directory was used to generate both the
2601
+ `asciidoc.1.css-embedded.html` HTML file the `asciidoc.1` roff
2602
+ formatted `asciidoc(1)` man page.
2603
+
2604
+ .Viewing and printing manpage files
2605
+ **********************************************************************
2606
+ Use the `man(1)` command to view the manpage file:
2607
+
2608
+ $ man -l asciidoc.1
2609
+
2610
+ To print a high quality man page to a postscript printer:
2611
+
2612
+ $ man -l -Tps asciidoc.1 | lpr
2613
+
2614
+ You could also create a PDF version of the man page by converting
2615
+ PostScript to PDF using `ps2pdf(1)`:
2616
+
2617
+ $ man -l -Tps asciidoc.1 | ps2pdf - asciidoc.1.pdf
2618
+
2619
+ The `ps2pdf(1)` command is included in the Ghostscript distribution.
2620
+
2621
+ **********************************************************************
2622
+
2623
+ To find out more about man pages view the `man(7)` manpage
2624
+ (`man 7 man` and `man man-pages` commands).
2625
+
2626
+
2627
+ Document Header
2628
+ ~~~~~~~~~~~~~~~
2629
+ A document Header is mandatory. The title line contains the man page
2630
+ name followed immediately by the manual section number in brackets,
2631
+ for example 'ASCIIDOC(1)'. The title name should not contain white
2632
+ space and the manual section number is a single digit optionally
2633
+ followed by a single character.
2634
+
2635
+ The NAME Section
2636
+ ~~~~~~~~~~~~~~~~
2637
+ The first manpage section is mandatory, must be titled 'NAME' and must
2638
+ contain a single paragraph (usually a single line) consisting of a
2639
+ list of one or more comma separated command name(s) separated from the
2640
+ command purpose by a dash character. The dash must have at least one
2641
+ white space character on either side. For example:
2642
+
2643
+ printf, fprintf, sprintf - print formatted output
2644
+
2645
+ The SYNOPSIS Section
2646
+ ~~~~~~~~~~~~~~~~~~~~
2647
+ The second manpage section is mandatory and must be titled 'SYNOPSIS'.
2648
+
2649
+ refmiscinfo attributes
2650
+ ~~~~~~~~~~~~~~~~~~~~~~
2651
+ In addition to the automatically created man page <<X60,intrinsic
2652
+ attributes>> you can assign DocBook
2653
+ http://www.docbook.org/tdg5/en/html/refmiscinfo.html[refmiscinfo]
2654
+ element 'source', 'version' and 'manual' values using AsciiDoc
2655
+ `\{mansource}`, `\{manversion}` and `\{manmanual}` attributes
2656
+ respectively. This example is from the AsciiDoc header of a man page
2657
+ source file:
2658
+
2659
+ :man source: AsciiDoc
2660
+ :man version: {revision}
2661
+ :man manual: AsciiDoc Manual
2662
+
2663
+
2664
+ [[X7]]
2665
+ Configuration Files
2666
+ -------------------
2667
+ AsciiDoc source file syntax and output file markup is largely
2668
+ controlled by a set of cascading, text based, configuration files. At
2669
+ runtime The AsciiDoc default configuration files are combined with
2670
+ optional user and document specific configuration files.
2671
+
2672
+ Configuration File Format
2673
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
2674
+ Configuration files contain named sections. Each section begins with a
2675
+ section name in square brackets []. The section body consists of the
2676
+ lines of text between adjacent section headings.
2677
+
2678
+ - Section names consist of one or more alphanumeric, underscore or
2679
+ dash characters and cannot begin or end with a dash.
2680
+ - Lines starting with a hash character "#" are treated as comments and
2681
+ ignored.
2682
+ - Same named sections and section entries override previously loaded
2683
+ sections and section entries (this is sometimes referred to as
2684
+ 'cascading'). Consequently, downstream configuration files need
2685
+ only contain those sections and section entries that need to be
2686
+ overridden.
2687
+
2688
+ TIP: When creating custom configuration files you only need to include
2689
+ the sections and entries that differ from the default configuration.
2690
+
2691
+ TIP: The best way to learn about configuration files is to read the
2692
+ default configuration files in the AsciiDoc distribution in
2693
+ conjunction with asciidoc(1) output files. You can view configuration
2694
+ file load sequence by turning on the asciidoc(1) `-v` (`--verbose`)
2695
+ command-line option.
2696
+
2697
+ Markup Template Sections
2698
+ ~~~~~~~~~~~~~~~~~~~~~~~~
2699
+ Markup template sections supply backend markup for translating
2700
+ AsciiDoc elements. Since the text is normally backend dependent
2701
+ you'll find these sections in the backend specific configuration
2702
+ files. A markup template section body can contain:
2703
+
2704
+ - Backend markup
2705
+ - Attribute references
2706
+ - System macro calls.
2707
+ - A document content placeholder
2708
+
2709
+ The document content placeholder is a single | character and is
2710
+ replaced by text from the source element. Use the `\{brvbar}`
2711
+ attribute reference if you need a literal | character in the template.
2712
+
2713
+ Special Sections
2714
+ ~~~~~~~~~~~~~~~~
2715
+ AsciiDoc reserves the following predefined special section names for
2716
+ specific purposes:
2717
+
2718
+ miscellaneous::
2719
+ Configuration options that don't belong anywhere else.
2720
+ attributes::
2721
+ Attribute name/value entries.
2722
+ specialcharacters::
2723
+ Special characters reserved by the backend markup.
2724
+ tags::
2725
+ Backend markup tags.
2726
+ quotes::
2727
+ Definitions for quoted inline character formatting.
2728
+ specialwords::
2729
+ Lists of words and phrases singled out for special markup.
2730
+ replacements, replacements2::
2731
+ Find and replace substitution definitions.
2732
+ specialsections::
2733
+ Used to single out special section names for specific markup.
2734
+ macros::
2735
+ Macro syntax definitions.
2736
+ titles::
2737
+ Heading, section and block title definitions.
2738
+ paradef*::
2739
+ Paragraph element definitions.
2740
+ blockdef*::
2741
+ DelimitedBlock element definitions.
2742
+ listdef*::
2743
+ List element definitions.
2744
+ tabledef*::
2745
+ Table element definitions.
2746
+
2747
+ Each line of text in a special section is a 'section entry'. Section
2748
+ entries share the following syntax:
2749
+
2750
+ 'name=value'::
2751
+ The entry value is set to 'value'.
2752
+ 'name='::
2753
+ The entry value is set to a zero length string.
2754
+ 'name'::
2755
+ The entry is undefined (deleted from the configuration).
2756
+
2757
+ .Section entry behavior
2758
+ - All equals characters inside the `name` must be escaped with a
2759
+ backslash character.
2760
+ - `name` and `value` are stripped of leading and trailing white space.
2761
+ - Attribute names, tag entry names and markup template section names
2762
+ consist of one or more alphanumeric, underscore or dash characters.
2763
+ Names should not begin or end with a dash.
2764
+ - A blank configuration file section (one without any entries) deletes
2765
+ any preceding section with the same name (applies to non-markup
2766
+ template sections).
2767
+
2768
+
2769
+ Miscellaneous
2770
+ ^^^^^^^^^^^^^
2771
+ The optional `[miscellaneous]` section specifies the following
2772
+ `name=value` options:
2773
+
2774
+ newline::
2775
+ Output file line termination characters. Can include any
2776
+ valid Python string escape sequences. The default value is
2777
+ `\r\n` (carriage return, line feed). Should not be quoted or
2778
+ contain explicit spaces (use `\x20` instead). For example:
2779
+
2780
+ $ asciidoc -a 'newline=\n' -b docbook mydoc.txt
2781
+
2782
+ outfilesuffix::
2783
+ The default extension for the output file, for example
2784
+ `outfilesuffix=.html`. Defaults to backend name.
2785
+ tabsize::
2786
+ The number of spaces to expand tab characters, for example
2787
+ `tabsize=4`. Defaults to 8. A 'tabsize' of zero suppresses tab
2788
+ expansion (useful when piping included files through block
2789
+ filters). Included files can override this option using the
2790
+ 'tabsize' attribute.
2791
+ textwidth, pagewidth, pageunits::
2792
+ These global table related options are documented in the
2793
+ <<X4,Table Configuration File Definitions>> sub-section.
2794
+
2795
+ NOTE: `[miscellaneous]` configuration file entries can be set using
2796
+ the asciidoc(1) `-a` (`--attribute`) command-line option.
2797
+
2798
+ Titles
2799
+ ^^^^^^
2800
+ sectiontitle::
2801
+ Two line section title pattern. The entry value is a Python
2802
+ regular expression containing the named group 'title'.
2803
+
2804
+ underlines::
2805
+ A comma separated list of document and section title underline
2806
+ character pairs starting with the section level 0 and ending
2807
+ with section level 4 underline. The default setting is:
2808
+
2809
+ underlines="==","--","~~","^^","++"
2810
+
2811
+ sect0...sect4::
2812
+ One line section title patterns. The entry value is a Python
2813
+ regular expression containing the named group 'title'.
2814
+
2815
+ blocktitle::
2816
+ <<X42,BlockTitle element>> pattern. The entry value is a
2817
+ Python regular expression containing the named group 'title'.
2818
+
2819
+ subs::
2820
+ A comma separated list of substitutions that are performed on
2821
+ the document header and section titles. Defaults to 'normal'
2822
+ substitution.
2823
+
2824
+ Tags
2825
+ ^^^^
2826
+ The `[tags]` section contains backend tag definitions (one per
2827
+ line). Tags are used to translate AsciiDoc elements to backend
2828
+ markup.
2829
+
2830
+ An AsciiDoc tag definition is formatted like
2831
+ `<tagname>=<starttag>|<endtag>`. For example:
2832
+
2833
+ emphasis=<em>|</em>
2834
+
2835
+ In this example asciidoc(1) replaces the | character with the
2836
+ emphasized text from the AsciiDoc input file and writes the result to
2837
+ the output file.
2838
+
2839
+ Use the `\{brvbar}` attribute reference if you need to include a | pipe
2840
+ character inside tag text.
2841
+
2842
+ Attributes Section
2843
+ ^^^^^^^^^^^^^^^^^^
2844
+ The optional `[attributes]` section contains predefined attributes.
2845
+
2846
+ If the attribute value requires leading or trailing spaces then the
2847
+ text text should be enclosed in double-quote (") characters.
2848
+
2849
+ To delete a attribute insert a name only entry in a downstream
2850
+ configuration file or use the asciidoc(1) `--attribute name!`
2851
+ command-line option (the attribute name is suffixed with a ! character
2852
+ to delete it).
2853
+
2854
+ Special Characters
2855
+ ^^^^^^^^^^^^^^^^^^
2856
+ The `[specialcharacters]` section specifies how to escape characters
2857
+ reserved by the backend markup. Each translation is specified on a
2858
+ single line formatted like:
2859
+
2860
+ special_character=translated_characters
2861
+
2862
+ Special characters are normally confined to those that resolve
2863
+ markup ambiguity (in the case of SGML/XML markups the ampersand, less
2864
+ than and greater than characters). The following example causes all
2865
+ occurrences of the `<` character to be replaced by `&lt;`.
2866
+
2867
+ <=&lt;
2868
+
2869
+ Quoted Text
2870
+ ^^^^^^^^^^^
2871
+ Quoting is used primarily for text formatting. The `[quotes]` section
2872
+ defines AsciiDoc quoting characters and their corresponding backend
2873
+ markup tags. Each section entry value is the name of a of a `[tags]`
2874
+ section entry. The entry name is the character (or characters) that
2875
+ quote the text. The following examples are taken from AsciiDoc
2876
+ configuration files:
2877
+
2878
+ [quotes]
2879
+ _=emphasis
2880
+
2881
+ [tags]
2882
+ emphasis=<em>|</em>
2883
+
2884
+ You can specify the left and right quote strings separately by
2885
+ separating them with a | character, for example:
2886
+
2887
+ ``|''=quoted
2888
+
2889
+ Omitting the tag will disable quoting, for example, if you don't want
2890
+ superscripts or subscripts put the following in a custom configuration
2891
+ file or edit the global `asciidoc.conf` configuration file:
2892
+
2893
+ [quotes]
2894
+ ^=
2895
+ ~=
2896
+
2897
+ <<X52,Unconstrained quotes>> are differentiated by prefixing the tag
2898
+ name with a hash character, for example:
2899
+
2900
+ __=#emphasis
2901
+
2902
+ .Quoted text behavior
2903
+ - Quote characters must be non-alphanumeric.
2904
+ - To minimize quoting ambiguity try not to use the same quote
2905
+ characters in different quote types.
2906
+
2907
+ Special Words
2908
+ ^^^^^^^^^^^^^
2909
+ The `[specialwords]` section is used to single out words and phrases
2910
+ that you want to consistently format in some way throughout your
2911
+ document without having to repeatedly specify the markup. The name of
2912
+ each entry corresponds to a markup template section and the entry
2913
+ value consists of a list of words and phrases to be marked up. For
2914
+ example:
2915
+
2916
+ [specialwords]
2917
+ strongwords=NOTE: IMPORTANT:
2918
+
2919
+ [strongwords]
2920
+ <strong>{words}</strong>
2921
+
2922
+ The examples specifies that any occurrence of `NOTE:` or `IMPORTANT:`
2923
+ should appear in a bold font.
2924
+
2925
+ Words and word phrases are treated as Python regular expressions: for
2926
+ example, the word `^NOTE:` would only match `NOTE:` if appeared at
2927
+ the start of a line.
2928
+
2929
+ AsciiDoc comes with three built-in Special Word types:
2930
+ 'emphasizedwords', 'monospacedwords' and 'strongwords', each has a
2931
+ corresponding (backend specific) markup template section. Edit the
2932
+ configuration files to customize existing Special Words and to add new
2933
+ ones.
2934
+
2935
+ .Special word behavior
2936
+ - Word list entries must be separated by space characters.
2937
+ - Word list entries with embedded spaces should be enclosed in quotation (")
2938
+ characters.
2939
+ - A `[specialwords]` section entry of the form
2940
+ `name=word1{nbsp}[word2...]` adds words to existing `name` entries.
2941
+ - A `[specialwords]` section entry of the form `name` undefines
2942
+ (deletes) all existing `name` words.
2943
+ - Since word list entries are processed as Python regular expressions
2944
+ you need to be careful to escape regular expression special
2945
+ characters.
2946
+ - By default Special Words are substituted before Inline Macros, this
2947
+ may lead to undesirable consequences. For example the special word
2948
+ `foobar` would be expanded inside the macro call
2949
+ `\http://www.foobar.com[]`. A possible solution is to emphasize
2950
+ whole words only by defining the word using regular expression
2951
+ characters, for example `\bfoobar\b`.
2952
+ - If the first matched character of a special word is a backslash then
2953
+ the remaining characters are output without markup i.e. the
2954
+ backslash can be used to escape special word markup. For example
2955
+ the special word `\\?\b[Tt]en\b` will mark up the words `Ten` and
2956
+ `ten` only if they are not preceded by a backslash.
2957
+
2958
+ [[X10]]
2959
+ Replacements
2960
+ ^^^^^^^^^^^^
2961
+ `[replacements]` and `[replacements2]` configuration file entries
2962
+ specify find and replace text and are formatted like:
2963
+
2964
+ find_pattern=replacement_text
2965
+
2966
+ The find text can be a Python regular expression; the replace text can
2967
+ contain Python regular expression group references.
2968
+
2969
+ Use Replacement shortcuts for often used macro references, for
2970
+ example (the second replacement allows us to backslash escape the
2971
+ macro name):
2972
+
2973
+ NEW!=image:./images/smallnew.png[New!]
2974
+ \\NEW!=NEW!
2975
+
2976
+ .Replacement behavior
2977
+ - The built-in replacements can be escaped with a backslash.
2978
+ - If the find or replace text has leading or trailing spaces then the
2979
+ text should be enclosed in quotation (") characters.
2980
+ - Since the find text is processed as a regular expression you need to
2981
+ be careful to escape regular expression special characters.
2982
+ - Replacements are performed in the same order they appear in the
2983
+ configuration file replacements section.
2984
+
2985
+ [[X27]]
2986
+ Configuration File Names and Locations
2987
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2988
+ Configuration files have a `.conf` file name extension; they are
2989
+ loaded implicitly (using predefined file names and locations) or
2990
+ explicitly (using the asciidoc(1) `-f` (`--conf-file`) command-line
2991
+ option).
2992
+
2993
+ Implicit configuration files are loaded from the following directories
2994
+ in the following order:
2995
+
2996
+ 1. The `/etc/asciidoc` directory (if it exists).
2997
+ 2. The directory containing the asciidoc executable.
2998
+ 3. The user's `$HOME/.asciidoc` directory (if it exists).
2999
+ 4. The directory containing the AsciiDoc source file.
3000
+
3001
+ The following implicit configuration files from each of the above
3002
+ locations are loaded in the following order:
3003
+
3004
+ 1. `asciidoc.conf`
3005
+ 2. `<backend>.conf`
3006
+ 3. `<backend>-<doctype>.conf`
3007
+ 4. `lang-<lang>.conf`
3008
+
3009
+ Where `<backend>` and `<doctype>` are values specified by the
3010
+ asciidoc(1) `-b` (`--backend`) and `-d` (`--doctype`) command-line
3011
+ options. `<lang>` is the value of the AsciiDoc `lang` attribute
3012
+ (defaults to `en` (English)).
3013
+
3014
+ Finally, configuration files named like the source file will be
3015
+ automatically loaded if they are found in the source file directory.
3016
+ For example if the source file is `mydoc.txt` and the
3017
+ `--backend=html4` option is used then asciidoc(1) will look for
3018
+ `mydoc.conf` and `mydoc-html4.conf` in that order.
3019
+
3020
+ Implicit configuration files that don't exist will be silently
3021
+ skipped.
3022
+
3023
+ The user can explicitly specify additional configuration files using
3024
+ the asciidoc(1) `-f` (`--conf-file`) command-line option. The `-f`
3025
+ option can be specified multiple times, in which case configuration
3026
+ files will be processed in the order they appear on the command-line.
3027
+
3028
+ For example, when we translate our AsciiDoc document `mydoc.txt` with:
3029
+
3030
+ $ asciidoc -f extra.conf mydoc.txt
3031
+
3032
+ Configuration files (if they exist) will be processed in the following
3033
+ order:
3034
+
3035
+ 1. First default global configuration files from the asciidoc program
3036
+ directory are loaded:
3037
+
3038
+ asciidoc.conf
3039
+ xhtml11.conf
3040
+
3041
+ 2. Then, from the users home `~/.asciidoc` directory. This is were
3042
+ you put customization specific to your own asciidoc documents:
3043
+
3044
+ asciidoc.conf
3045
+ xhtml11.conf
3046
+ xhtml11-article.conf
3047
+
3048
+ 3. Next from the source document project directory (the first three
3049
+ apply to all documents in the directory, the last two are specific
3050
+ to the mydoc.txt document):
3051
+
3052
+ asciidoc.conf
3053
+ xhtml11.conf
3054
+ xhtml11-article.conf
3055
+ mydoc.conf
3056
+ mydoc-xhtml11.conf
3057
+
3058
+ 4. Finally the file specified by the `-f` command-line option is
3059
+ loaded:
3060
+
3061
+ extra.conf
3062
+
3063
+ TIP: Use the asciidoc(1) `-v` (`--verbose`) command-line option to see
3064
+ which configuration files are loaded and the order in which they are
3065
+ loaded.
3066
+
3067
+
3068
+ Document Attributes
3069
+ -------------------
3070
+ A document attribute is comprised of a 'name' and a textual 'value'
3071
+ and is used for textual substitution in AsciiDoc documents and
3072
+ configuration files. An attribute reference (an attribute name
3073
+ enclosed in braces) is replaced by its corresponding attribute
3074
+ value.
3075
+
3076
+ There are four sources of document attributes (from highest to lowest
3077
+ precedence):
3078
+
3079
+ - Command-line attributes.
3080
+ - AttributeEntry, AttributeList, Macro and BlockId elements.
3081
+ - Configuration file `[attributes]` sections.
3082
+ - Intrinsic attributes.
3083
+
3084
+ Within each of these divisions the last processed entry takes
3085
+ precedence.
3086
+
3087
+ IMPORTANT: If an attribute is not defined then the line containing the
3088
+ attribute reference is dropped. This property is used extensively in
3089
+ AsciiDoc configuration files to facilitate conditional markup
3090
+ generation.
3091
+
3092
+
3093
+ [[X18]]
3094
+ Attribute Entries
3095
+ -----------------
3096
+ The `AttributeEntry` block element allows document attributes to be
3097
+ assigned within an AsciiDoc document. Attribute entries are added to
3098
+ the global document attributes dictionary. The attribute name/value
3099
+ syntax is a single line like:
3100
+
3101
+ :<name>: <value>
3102
+
3103
+ For example:
3104
+
3105
+ :Author Initials: JB
3106
+
3107
+ This will set an attribute reference `\{authorinitials}` to the value
3108
+ 'JB' in the current document.
3109
+
3110
+ To delete (undefine) an attribute use the following syntax:
3111
+
3112
+ :<name>!:
3113
+
3114
+ .AttributeEntry properties
3115
+ - The attribute entry line begins with colon -- no white space allowed
3116
+ in left margin.
3117
+ - AsciiDoc converts the `<name>` to a legal attribute name (lower
3118
+ case, alphanumeric and dash characters only -- all other characters
3119
+ deleted). This allows more reader friendly text to be used.
3120
+ - Leading and trailing white space is stripped from the `<value>`.
3121
+ - If the `<value>` is blank then the corresponding attribute value is
3122
+ set to an empty string.
3123
+ - Special characters in the entry `<value>` are substituted. To
3124
+ include special characters use the predefined `\{gt}`, `\{lt}`,
3125
+ `\{amp}` attribute references.
3126
+ - Attribute references contained in the entry `<value>` will be
3127
+ expanded.
3128
+ - By default AttributeEntry values are substituted for
3129
+ `specialcharacters` and `attributes` (see above), if you want a
3130
+ different AttributeEntry substitution set the `attributeentry-subs`
3131
+ attribute.
3132
+ - Attribute entries in the document Header are available for header
3133
+ markup template substitution.
3134
+ - Attribute elements override configuration file and intrinsic
3135
+ attributes but do not override command-line attributes.
3136
+
3137
+ Here's another example:
3138
+
3139
+ ---------------------------------------------------------------------
3140
+ AsciiDoc User Manual
3141
+ ====================
3142
+ :Author: Stuart Rackham
3143
+ :Email: srackham@gmail.com
3144
+ :Date: April 23, 2004
3145
+ :Revision: 5.1.1
3146
+ :Key words: linux, ralink, debian, wireless
3147
+ :Revision history:
3148
+ ---------------------------------------------------------------------
3149
+
3150
+ Which creates these attributes:
3151
+
3152
+ {author}, {firstname}, {lastname}, {authorinitials}, {email},
3153
+ {date}, {revision}, {keywords}, {revisionhistory}
3154
+
3155
+ The preceding example is equivalent to the standard AsciiDoc two line
3156
+ document header. Actually it's a little bit different with the
3157
+ addition of the `\{keywords}` and `\{revisionhistory}` attributes
3158
+ footnote:[The existence of a `\{revisionhistory}` attribute causes a
3159
+ revision history file (if it exists) to be included in DocBook
3160
+ outputs. If a file named like `\{docname}-revhistory.xml` exists in
3161
+ the document's directory then it will be added verbatim to the DocBook
3162
+ header (see the `./doc/asciidoc-revhistory.xml` example that comes
3163
+ with the AsciiDoc distribution).].
3164
+
3165
+ [[X62]]
3166
+ .Attribute entries promote clarity and eliminate repetition
3167
+ *********************************************************************
3168
+ URLs and file names in AsciiDoc macros are often quite long -- they
3169
+ break paragraph flow and readability suffers. The problem is
3170
+ compounded by redundancy if the same name is used repeatedly.
3171
+ Attribute entries can be used to make your documents easier to read
3172
+ and write, here are some examples:
3173
+
3174
+ :1: http://freshmeat.net/projects/asciidoc/
3175
+ :homepage: http://hg.sharesource.org/asciidoc/[AsciiDoc home page]
3176
+ :new: image:./images/smallnew.png[]
3177
+
3178
+ Using previously defined attributes: See the {1}[Freshmeat summary]
3179
+ or the {homepage} for something new {new}.
3180
+
3181
+ .Note
3182
+ - The attribute entry definition must precede it's usage.
3183
+ - You are not limited to URLs or file names, entire macro calls or
3184
+ arbitrary lines of text can be abbreviated.
3185
+ - Shared attributes entries could be grouped into a separate file and
3186
+ <<X63,included>> in multiple documents.
3187
+
3188
+ *********************************************************************
3189
+
3190
+
3191
+ [[X21]]
3192
+ Attribute Lists
3193
+ ---------------
3194
+ An attribute list is a comma separated list of attribute values. The
3195
+ entire list is enclosed in square brackets. Attribute lists are used
3196
+ to pass parameters to macros, blocks and inline quotes.
3197
+
3198
+ The list consists of zero or more positional attribute values followed
3199
+ by zero or more named attribute values. Here are three examples:
3200
+
3201
+ [Hello]
3202
+ [quote, Bertrand Russell, The World of Mathematics (1956)]
3203
+ ["22 times", backcolor="#0e0e0e", options="noborders,wide"]
3204
+
3205
+ .Attribute list properties
3206
+ - If one or more attribute values contains a comma the all values must
3207
+ be quoted (enclosed in quotation characters).
3208
+ - If the list contains any named attributes the all string attribute
3209
+ values must be quoted.
3210
+ - List attributes take precedence over existing attributes.
3211
+ - List attributes can only be referenced in configuration file markup
3212
+ templates and tags, they are not available inside the document.
3213
+ - Attribute references are allowed inside attribute lists.
3214
+ - Setting a named attribute to `None` undefines the attribute.
3215
+ - Positional attributes are referred to as `\{1}`,`\{2}`,`\{3}`,...
3216
+ - Attribute `\{0}` refers to the entire list (excluding the enclosing
3217
+ square brackets).
3218
+ - If an attribute named `options` is present it is processed as a
3219
+ comma separated list of attributes with zero length string values.
3220
+ For example `[options="opt1,opt2,opt3"]` is equivalent to
3221
+ `[opt1="",opt2="",opt2=""]`.
3222
+ - Attribute lists are evaluated as a list of Python function
3223
+ arguments. If this fails or any of the items do not evaluate to a
3224
+ string, a number or None then all list items are treated as string
3225
+ literals.
3226
+
3227
+ Macro Attribute lists
3228
+ ~~~~~~~~~~~~~~~~~~~~~
3229
+ Macros calls are suffixed with an attribute list. The list may be
3230
+ empty but it cannot be omitted. List entries are used to pass
3231
+ attribute values to macro markup templates.
3232
+
3233
+ AttributeList Element
3234
+ ~~~~~~~~~~~~~~~~~~~~~
3235
+ An attribute list on a line by itself constitutes an 'AttributeList'
3236
+ block element, its function is to parametrize the following block
3237
+ element. The list attributes are passed to the next block element for
3238
+ markup template substitution.
3239
+
3240
+
3241
+ Attribute References
3242
+ --------------------
3243
+ An attribute references is an attribute name (possibly followed by an
3244
+ additional parameters) enclosed in braces. When an attribute
3245
+ reference is encountered it is evaluated and replaced by its
3246
+ corresponding text value. If the attribute is undefined the line
3247
+ containing the attribute is dropped.
3248
+
3249
+ There are three types of attribute reference: 'Simple', 'Conditional'
3250
+ and 'System'.
3251
+
3252
+ .Attribute reference behavior
3253
+ - You can suppress attribute reference expansion by placing a
3254
+ backslash character immediately in front of the opening brace
3255
+ character.
3256
+ - By default attribute references are not expanded in
3257
+ LiteralParagraphs, ListingBlocks or LiteralBlocks.
3258
+
3259
+ Simple Attributes References
3260
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3261
+ Simple attribute references take the form `\{<name>}`. If the
3262
+ attribute name is defined its text value is substituted otherwise the
3263
+ line containing the reference is dropped from the output.
3264
+
3265
+ Conditional Attribute References
3266
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3267
+ Additional parameters are used in conjunction with the attribute name
3268
+ to calculate a substitution value. Conditional attribute references
3269
+ take the following forms:
3270
+
3271
+ `\{<name>=<value>}`::
3272
+ `<value>` is substituted if the attribute `<name>` is
3273
+ undefined otherwise its value is substituted. `<value>` can
3274
+ contain simple attribute references.
3275
+
3276
+ `\{<name>?<value>}`::
3277
+ `<value>` is substituted if the attribute `<name>` is defined
3278
+ otherwise an empty string is substituted. `<value>` can
3279
+ contain simple attribute references.
3280
+
3281
+ `\{<name>!<value>}`::
3282
+ `<value>` is substituted if the attribute `<name>` is
3283
+ undefined otherwise an empty string is substituted. `<value>`
3284
+ can contain simple attribute references.
3285
+
3286
+ `\{<name>#<value>}`::
3287
+ `<value>` is substituted if the attribute `<name>` is defined
3288
+ otherwise the undefined attribute entry causes the containing
3289
+ line to be dropped. `<value>` can contain simple attribute
3290
+ references.
3291
+
3292
+ `\{<name>%<value>}`::
3293
+ `<value>` is substituted if the attribute `<name>` is not
3294
+ defined otherwise the containing line is dropped. `<value>`
3295
+ can contain simple attribute references.
3296
+
3297
+ `\{<name>@<regexp>:<value1>[:<value2>]}`::
3298
+ `<value1>` is substituted if the value of attribute `<name>`
3299
+ matches the regular expression `<regexp>` otherwise `<value2>`
3300
+ is substituted. If attribute `<name>` is not defined the
3301
+ containing line is dropped. If `<value2>` is omitted an empty
3302
+ string is assumed. The values and the regular expression can
3303
+ contain simple attribute references. To embed colons in the
3304
+ values or the regular expression escape them with backslashes.
3305
+
3306
+ `\{<name>$<regexp>:<value1>[:<value2>]}`::
3307
+ Same behavior as the previous ternary attribute except for
3308
+ the following cases:
3309
+
3310
+ `\{<name>$<regexp>:<value>}`;;
3311
+ Substitutes `<value>` if `<name>` matches `<regexp>`
3312
+ otherwise the result is undefined and the containing
3313
+ line is dropped.
3314
+
3315
+ `\{<name>$<regexp>::<value>}`;;
3316
+ Substitutes `<value>` if `<name>` does not match
3317
+ `<regexp>` otherwise the result is undefined and the
3318
+ containing line is dropped.
3319
+
3320
+ Conditional attribute examples
3321
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3322
+ Conditional attributes are mainly used in AsciiDoc configuration
3323
+ files -- see the distribution `.conf` files for examples.
3324
+
3325
+ Attribute equality test::
3326
+ If `\{backend}` is `docbook` or `xhtml11` the example evaluates to
3327
+ ``DocBook or XHTML backend'' otherwise it evaluates to ``some other
3328
+ backend'':
3329
+
3330
+ {backend@docbook|xhtml11:DocBook or XHTML backend:some other backend}
3331
+
3332
+ Attribute value map::
3333
+ This example maps the `frame` attribute values [`topbot`, `all`,
3334
+ `none`, `sides`] to [`hsides`, `border`, `void`, `vsides`]:
3335
+
3336
+ {frame@topbot:hsides}{frame@all:border}{frame@none:void}{frame@sides:vsides}
3337
+
3338
+
3339
+ [[X24]]
3340
+ System Attribute References
3341
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
3342
+ System attribute references generate the attribute text value by
3343
+ executing a predefined action that is parametrized by a single
3344
+ argument. The syntax is `{<action>:<argument>}`.
3345
+
3346
+ `\{eval:<expression>}`::
3347
+ Substitutes the result of the Python `<expression>`. If
3348
+ `<expression>` evaluates to `None` or `False` the reference is
3349
+ deemed undefined and the line containing the reference is
3350
+ dropped from the output. If the expression evaluates to
3351
+ `True` the attribute evaluates to an empty string. In all
3352
+ remaining cases the attribute evaluates to a string
3353
+ representation of the `<expression>` result.
3354
+
3355
+ `\{include:<filename>}`::
3356
+ Substitutes contents of the file named `<filename>`.
3357
+ - The included file is read at the time of attribute
3358
+ substitution.
3359
+ - If the file does not exist a warning is emitted and the line
3360
+ containing the reference is dropped from the output file.
3361
+ - Tabs are expanded based on the current 'tabsize' attribute
3362
+ value.
3363
+
3364
+ `\{sys:<command>}`::
3365
+ Substitutes the stdout generated by the execution of the shell
3366
+ `<command>`.
3367
+
3368
+ `\{sys2:<command>}`::
3369
+ Substitutes the stdout and stderr generated by the execution
3370
+ of the shell `<command>`.
3371
+
3372
+ .System reference behavior
3373
+ - System attribute arguments can contain non-system attribute
3374
+ references.
3375
+ - Closing brace characters inside system attribute arguments must be
3376
+ escaped them with a backslash.
3377
+
3378
+ [[X60]]
3379
+ Intrinsic Attributes
3380
+ --------------------
3381
+ Intrinsic attributes are simple attributes that are created
3382
+ automatically from AsciiDoc document header parameters, asciidoc(1)
3383
+ command-line arguments, execution parameters along with attributes
3384
+ defined in the default configuration files. Here's the list of
3385
+ predefined intrinsic attributes:
3386
+
3387
+ {asciidoc-dir} the asciidoc(1) application directory
3388
+ {asciidoc-version} the version of asciidoc(1)
3389
+ {author} author's full name
3390
+ {authored} empty string '' if {author} or {email} defined,
3391
+ {authorinitials} author initials (from document header)
3392
+ {backend-<backend>} empty string ''
3393
+ {<backend>-<doctype>} empty string ''
3394
+ {backend} document backend specified by `-b` option
3395
+ {basebackend-<base>} empty string ''
3396
+ {basebackend} html or docbook
3397
+ {brvbar} broken vertical bar (|) character
3398
+ {date} document date (from document header)
3399
+ {docname} document file name without extension
3400
+ {doctitle} document title (from document header)
3401
+ {doctype-<doctype>} empty string ''
3402
+ {doctype} document type specified by `-d` option
3403
+ {email} author's email address (from document header)
3404
+ {empty} empty string ''
3405
+ {filetype-<fileext>} empty string ''
3406
+ {filetype} output file name file extension
3407
+ {firstname} author first name (from document header)
3408
+ {gt} greater than (>) character
3409
+ {id} running block id generated by BlockId elements
3410
+ {indir} document input directory name (note 1)
3411
+ {infile} input file name (note 1)
3412
+ {lastname} author last name (from document header)
3413
+ {listindex} the list index (1..) of the most recent list item
3414
+ {localdate} the current date
3415
+ {localtime} the current time
3416
+ {lt} less than (<) character
3417
+ {manname} manpage name (defined in NAME section)
3418
+ {manpurpose} manpage (defined in NAME section)
3419
+ {mantitle} document title minus the manpage volume number
3420
+ {manvolnum} manpage volume number (1..8) (from document header)
3421
+ {middlename} author middle name (from document header)
3422
+ {outdir} document output directory name (note 1)
3423
+ {outfile} output file name (note 1)
3424
+ {revision} document revision number (from document header)
3425
+ {sectnum} section number (in section titles)
3426
+ {title} section title (in titled elements)
3427
+ {user-dir} the ~/.asciidoc directory (if it exists)
3428
+ {verbose} defined as '' if --verbose command option specified
3429
+
3430
+ .NOTES
3431
+ 1. Intrinsic attributes are global so avoid defining custom attributes
3432
+ with the same names.
3433
+
3434
+ 2. `\{infile}`, `\{outdir}`, `\{infile}`, `\{indir}` attributes are
3435
+ effectively read-only (you can set them but it won't affect the
3436
+ input or output file paths).
3437
+
3438
+ 3. See also the <<X33,xhtml11>> subsection for attributes that relate
3439
+ to AsciiDoc XHTML file generation.
3440
+
3441
+ 4. The entries that translate to blank strings are designed to be used
3442
+ for conditional text inclusion. You can also use the `ifdef`,
3443
+ `ifndef` and `endif` System macros for conditional inclusion.
3444
+ footnote:[Conditional inclusion using `ifdef` and `ifndef` macros
3445
+ differs from attribute conditional inclusion in that the former
3446
+ occurs when the file is read while the latter occurs when the
3447
+ contents are written.]
3448
+
3449
+
3450
+ Block Element Definitions
3451
+ -------------------------
3452
+ The syntax and behavior of Paragraph, DelimitedBlock, List and Table
3453
+ block elements is determined by block definitions contained in
3454
+ <<X7,AsciiDoc configuration file>> sections.
3455
+
3456
+ Each definition consists of a section title followed by one or more
3457
+ section entries. Each entry defines a block parameter controlling some
3458
+ aspect of the block's behavior. Here's an example:
3459
+
3460
+ ---------------------------------------------------------------------
3461
+ [blockdef-listing]
3462
+ delimiter=^-{4,}$
3463
+ template=listingblock
3464
+ presubs=specialcharacters,callouts
3465
+ ---------------------------------------------------------------------
3466
+
3467
+ AsciiDoc Paragraph, DelimitedBlock, List and Table block elements
3468
+ share a common subset of configuration file parameters:
3469
+
3470
+ delimiter::
3471
+ A Python regular expression that matches the first line of a block
3472
+ element -- in the case of DelimitedBlocks it also matches the last
3473
+ line. Table elements don't have an explicit delimiter -- they
3474
+ synthesize their delimiters at runtime.
3475
+
3476
+ template::
3477
+ The name of the configuration file markup template section that will
3478
+ envelope the block contents. The pipe | character is substituted for
3479
+ the block contents. List elements use a set of (list specific) tag
3480
+ parameters instead of a single template.
3481
+
3482
+ options::
3483
+ A comma delimited list of element specific option names.
3484
+
3485
+ subs, presubs, postsubs::
3486
+ * 'presubs' and 'postsubs' are lists of comma separated substitutions that are
3487
+ performed on the block contents. 'presubs' is applied first,
3488
+ 'postsubs' (if specified) second.
3489
+
3490
+ * 'subs' is an alias for 'presubs'.
3491
+
3492
+ * If a 'filter' is allowed (Paragraphs and DelimitedBlocks) and has
3493
+ been specified then 'presubs' and 'postsubs' substitutions are
3494
+ performed before and after the filter is run respectively.
3495
+
3496
+ * Allowed values: 'specialcharacters', 'quotes', 'specialwords',
3497
+ 'replacements', 'macros', 'attributes', 'callouts'.
3498
+
3499
+ * The following composite values are also allowed:
3500
+
3501
+ 'none';;
3502
+ No substitutions.
3503
+ 'normal';;
3504
+ The following substitutions:
3505
+ 'specialcharacters','quotes','attributes','specialwords',
3506
+ 'replacements','macros','passthroughs'.
3507
+ 'verbatim';;
3508
+ 'specialcharacters' and 'callouts' substitutions.
3509
+
3510
+ * 'normal' and 'verbatim' substitutions can be redefined by with
3511
+ `subsnormal` and `subsverbatim` entries in a configuration file
3512
+ `[miscellaneous]` section.
3513
+
3514
+ * The substitutions are processed in the order in which they are
3515
+ listed and can appear more than once.
3516
+
3517
+ filter::
3518
+ This optional entry specifies an executable shell command for
3519
+ processing block content (Paragraphs and DelimitedBlocks). The
3520
+ filter command can contain attribute references.
3521
+
3522
+ posattrs::
3523
+ Optional comma separated list of positional attribute names. This
3524
+ list maps positional attributes (in the block's <<X21,attribute
3525
+ list>>) to named block attributes. The following example, from the
3526
+ QuoteBlock definition, maps the first and section positional
3527
+ attributes:
3528
+
3529
+ posattrs=attribution,citetitle
3530
+
3531
+ style::
3532
+ This optional parameter specifies the default style name.
3533
+
3534
+
3535
+ <stylename>-style::
3536
+ Optional style definition (see <<X23,Styles>> below).
3537
+
3538
+ The following block parameters behave like document attributes and can
3539
+ be set in block attribute lists and style definitions: 'template',
3540
+ 'options', 'subs', 'presubs', 'postsubs', 'filter'.
3541
+
3542
+ [[X23]]
3543
+ Styles
3544
+ ~~~~~~
3545
+ A style is a set of block attributes bundled as a single named
3546
+ attribute. The following example defines a style named 'verbatim':
3547
+
3548
+ verbatim-style=template="literalblock",subs="verbatim",font="monospaced"
3549
+
3550
+ - All style parameter names must be suffixed with `-style` and the
3551
+ style parameter value is in the form of a list of <<X21,named
3552
+ attributes>>.
3553
+ - Multi-item style attributes ('subs','presubs','postsubs','posattrs')
3554
+ must be specified using Python tuple syntax rather than a simple
3555
+ list of values as they in separate entries e.g.
3556
+ `postsubs=("callouts",)` not `postsubs="callouts"`.
3557
+
3558
+ Paragraphs
3559
+ ~~~~~~~~~~
3560
+ Paragraph translation is controlled by `[paradef*]` configuration file
3561
+ section entries. Users can define new types of paragraphs and modify
3562
+ the behavior of existing types by editing AsciiDoc configuration
3563
+ files.
3564
+
3565
+ Here is the shipped Default paragraph definition:
3566
+
3567
+ --------------------------------------------------------------------
3568
+ [paradef-default]
3569
+ delimiter=(?P<text>\S.*)
3570
+ template=paragraph
3571
+ --------------------------------------------------------------------
3572
+
3573
+ The Default paragraph definition has a couple of special properties:
3574
+
3575
+ 1. It must exist and be defined in a configuration file section named
3576
+ `[paradef-default]`.
3577
+ 2. Irrespective of its position in the configuration files default
3578
+ paragraph document matches are attempted only after trying all
3579
+ other paragraph types.
3580
+
3581
+ Paragraph specific block parameter notes:
3582
+
3583
+ delimiter::
3584
+ This regular expression must contain the named group 'text' which
3585
+ matches the text on the first line. Paragraphs are terminated by a
3586
+ blank line, the end of file, or the start of a DelimitedBlock.
3587
+
3588
+ options::
3589
+ The only allowable option is 'listelement'. The 'listelement'
3590
+ option specifies that paragraphs of this type will automatically be
3591
+ considered part of immediately preceding list items.
3592
+
3593
+ .Paragraph processing proceeds as follows:
3594
+ 1. The paragraph text is aligned to the left margin.
3595
+ 2. Optional 'presubs' inline substitutions are performed on the
3596
+ paragraph text.
3597
+ 3. If a filter command is specified it is executed and the paragraph
3598
+ text piped to its standard input; the filter output replaces the
3599
+ paragraph text.
3600
+ 4. Optional 'postsubs' inline substitutions are performed on the
3601
+ paragraph text.
3602
+ 5. The paragraph text is enveloped by the paragraph's markup template
3603
+ and written to the output file.
3604
+
3605
+ Delimited Blocks
3606
+ ~~~~~~~~~~~~~~~~
3607
+ DelimitedBlock specific block definition notes:
3608
+
3609
+ options::
3610
+ Allowed values are:
3611
+
3612
+ 'sectionbody';;
3613
+ The block contents are processed as a SectionBody.
3614
+
3615
+ 'skip';;
3616
+ The block is treated as a comment (see 'CommentBlocks').
3617
+
3618
+ 'list';;
3619
+ The block is a <<X29,list block>>.
3620
+
3621
+ 'presubs', 'postsubs' and 'filter' entries are meaningless when
3622
+ 'sectionbody', 'skip' or 'list' options are set.
3623
+
3624
+ DelimitedBlock processing proceeds as follows:
3625
+
3626
+ 1. Optional 'presubs' substitutions are performed on the block
3627
+ contents.
3628
+ 2. If a filter is specified it is executed and the block's contents
3629
+ piped to its standard input. The filter output replaces the block
3630
+ contents.
3631
+ 3. Optional 'postsubs' substitutions are performed on the block
3632
+ contents.
3633
+ 4. The block contents is enveloped by the block's markup template and
3634
+ written to the output file.
3635
+
3636
+ TIP: Attribute expansion is performed on the block filter command
3637
+ before it is executed, this is useful for passing arguments to the
3638
+ filter.
3639
+
3640
+ Lists
3641
+ ~~~~~
3642
+ List behavior and syntax is determined by `[listdef*]` configuration
3643
+ file sections. The user can change existing list behavior and add new
3644
+ list types by editing configuration files.
3645
+
3646
+ List specific block definition notes:
3647
+
3648
+ type::
3649
+ This is either 'bulleted','numbered','labeled' or 'callout'.
3650
+
3651
+ delimiter::
3652
+ A Python regular expression that matches the first line of a
3653
+ list element entry. This expression must contain the named
3654
+ group 'text' which matches text in the first line.
3655
+
3656
+ subs::
3657
+ Substitutions that are performed on list item text and terms.
3658
+
3659
+ listtag::
3660
+ The name of the tag that envelopes the List.
3661
+
3662
+ itemtag::
3663
+ The name of the tag that envelopes the ListItem.
3664
+
3665
+ texttag::
3666
+ The name of the tag that envelopes the list item text.
3667
+
3668
+ labeltag::
3669
+ The name of the tag that envelopes a variable list label.
3670
+
3671
+ entrytag::
3672
+ The name of the tag that envelopes a labeled list entry.
3673
+
3674
+ The tag entries map the AsciiDoc list structure to backend markup; see
3675
+ the AsciiDoc distribution `.conf` configuration files for examples.
3676
+
3677
+ Tables
3678
+ ~~~~~~
3679
+ Table behavior and syntax is determined by `[tabledef*]` configuration
3680
+ file sections. The user can change existing list behavior and add new
3681
+ list types by editing configuration files.
3682
+
3683
+ Table specific block definition notes:
3684
+
3685
+ fillchar::
3686
+ A single character that fills table ruler and underline
3687
+ lines.
3688
+
3689
+ subs::
3690
+ Substitutions performed on table data items.
3691
+
3692
+ format::
3693
+ The source row data format ('fixed', 'csv' or 'dsv').
3694
+
3695
+ comspec::
3696
+ The table 'comspec' tag definition.
3697
+
3698
+ headrow, footrow, bodyrow::
3699
+ Table header, footer and body row tag definitions. 'headrow' and
3700
+ 'footrow' table definition entries default to 'bodyrow' if
3701
+ they are undefined.
3702
+
3703
+ headdata, footdata, bodydata::
3704
+ Table header, footer and body data tag definitions. 'headdata' and
3705
+ 'footdata' table definition entries default to 'bodydata' if they
3706
+ are undefined.
3707
+
3708
+ [[X4]]
3709
+ Table behavior is also influenced by the following `[miscellaneous]`
3710
+ configuration file entries:
3711
+
3712
+ textwidth::
3713
+ The page width (in characters) of the source text. This setting is
3714
+ compared to the table ruler width when calculating the relative
3715
+ size of character ruler tables on the output page.
3716
+
3717
+ pagewidth::
3718
+ This integer value is the printable width of the output media. Used
3719
+ to calculate 'colwidth' and 'tablewidth' substitution values.
3720
+
3721
+ pageunits::
3722
+ The units of width in output markup width attribute values.
3723
+
3724
+ .Table definition behavior
3725
+ - The output markup generation is specifically designed to work with
3726
+ the HTML and CALS (DocBook) table models, but should be adaptable to
3727
+ most XML table schema.
3728
+ - Table definitions can be ``mixed in'' from multiple cascading
3729
+ configuration files.
3730
+ - New table definitions inherit the default table definition
3731
+ ('[tabledef-default]') so you only need to override those conf file
3732
+ entries that require modification when defining a new table type.
3733
+
3734
+
3735
+ [[X59]]
3736
+ Filters
3737
+ -------
3738
+ Filters are external shell commands used to process Paragraph and
3739
+ DelimitedBlock content; they are specified in configuration file
3740
+ Paragraph and DelimitedBlock definitions.
3741
+
3742
+ There's nothing special about the filters, they're just standard UNIX
3743
+ filters: they read text from the standard input, process it, and write
3744
+ to the standard output.
3745
+
3746
+ Attribute substitution is performed on the filter command prior to
3747
+ execution -- attributes can be used to pass parameters from the
3748
+ AsciiDoc source document to the filter.
3749
+
3750
+ WARNING: Filters can potentially generate unsafe output. Before
3751
+ installing a filter you should verify that it can't be coerced into
3752
+ generating malicious output or exposing sensitive information.
3753
+
3754
+ NOTE: Filter functionality is currently only available on POSIX
3755
+ platforms (this includes Cygwin).
3756
+
3757
+ Filter Search Paths
3758
+ ~~~~~~~~~~~~~~~~~~~
3759
+ If the filter command does not specify a directory path then
3760
+ asciidoc(1) searches for the command:
3761
+
3762
+ - First it looks in the user's `$HOME/.asciidoc/filters` directory.
3763
+ - Next the `/etc/asciidoc/filters` directory is searched.
3764
+ - Then it looks in the asciidoc(1) `./filters` directory.
3765
+ - Finally it relies on the executing shell to search the environment
3766
+ search path (`$PATH`).
3767
+
3768
+ Filter Configuration Files
3769
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
3770
+ Filters are normally accompanied by a configuration file containing a
3771
+ Paragraph or DelimitedBlock definition along with corresponding markup
3772
+ templates.
3773
+
3774
+ There are two ways to implement filters:
3775
+
3776
+ - As a new Paragraph or DelimitedBlock definition.
3777
+ - By styling an existing Paragraph or DelimitedBlock using a 'style'
3778
+ configuration entry -- the 'source highlight' and 'music' filters
3779
+ use this technique to customize the ListingBlock. By convention the
3780
+ style is given the same name as the filter.
3781
+
3782
+ asciidoc(1) auto-loads all `.conf` files found in the filter search
3783
+ paths (see previous section).
3784
+
3785
+ [[X56]]
3786
+ Code Filter
3787
+ ~~~~~~~~~~~
3788
+ AsciiDoc comes with a simple minded for highlighting source code
3789
+ keywords and comments. See also the
3790
+ `./filters/code-filter-readme.txt` file.
3791
+
3792
+ NOTE: This filter primarily to demonstrate how to write a filter --
3793
+ it's much to simplistic to be passed off as a code syntax highlighter.
3794
+ If you want a full featured multi-language highlighter use the
3795
+ <<X57,Source Code Highlighter Filter>>.
3796
+
3797
+ .Code filter example
3798
+ [code,python]
3799
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3800
+ ''' A multi-line
3801
+ comment.'''
3802
+ def sub_word(mo):
3803
+ ''' Single line comment.'''
3804
+ word = mo.group('word') # Inline comment
3805
+ if word in keywords[language]:
3806
+ return quote + word + quote
3807
+ else:
3808
+ return word
3809
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3810
+
3811
+ Outputs:
3812
+
3813
+ .Code filter example
3814
+ [code,python]
3815
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3816
+ ''' A multi-line
3817
+ comment.'''
3818
+ def sub_word(mo):
3819
+ ''' Single line comment.'''
3820
+ word = mo.group('word') # Inline comment
3821
+ if word in keywords[language]:
3822
+ return quote + word + quote
3823
+ else:
3824
+ return word
3825
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3826
+
3827
+ [[X57]]
3828
+ Source Code Highlighter Filter
3829
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3830
+ A
3831
+ http://www.methods.co.nz/asciidoc/source-highlight-filter.html[source
3832
+ code highlighter filter] can be found in the AsciiDoc distribution
3833
+ `./filters` directory.
3834
+
3835
+ [[X58]]
3836
+ Music Filter
3837
+ ~~~~~~~~~~~~
3838
+ A http://www.methods.co.nz/asciidoc/music-filter.html[music filter] is
3839
+ included in the distribution `./filters` directory. It translates
3840
+ music in http://lilypond.org/[LilyPond] or
3841
+ http://abcnotation.org.uk/[ABC] notation to standard Western classical
3842
+ notation in the form of a trimmed PNG image which is automatically
3843
+ inserted into the output document.
3844
+
3845
+
3846
+ [[X12]]
3847
+ Converting DocBook to other file formats
3848
+ ----------------------------------------
3849
+ DocBook files are validated, parsed and translated by a combination of
3850
+ applications collectively called a DocBook 'tool chain'. The function
3851
+ of a tool chain is to read the DocBook markup (produced by AsciiDoc)
3852
+ and transform it to a presentation format (for example HTML, PDF, HTML
3853
+ Help, DVI, PostScript, LaTeX).
3854
+
3855
+ A wide range of user output format requirements coupled with a choice
3856
+ of available tools and stylesheets results in many valid tool chain
3857
+ combinations.
3858
+
3859
+ [[X43]]
3860
+ a2x Toolchain Wrapper
3861
+ ~~~~~~~~~~~~~~~~~~~~~
3862
+ One of the biggest hurdles for new users is installing, configuring
3863
+ and using a DocBook XML toolchain. `a2x(1)` can help -- it's a
3864
+ toolchain wrapper command that will generate XHTML (chunked and
3865
+ unchunked), PDF, DVI, PS, LaTeX, man page, HTML Help and text file
3866
+ outputs from an AsciiDoc text file. a2x(1) does all the grunt work
3867
+ associated with generating and sequencing the toolchain commands and
3868
+ managing intermediate and output files. a2x(1) also optionally
3869
+ deploys admonition and navigation icons and a CSS stylesheet. See the
3870
+ `a2x(1)` man page for more details. All you need is
3871
+ <<X40,xsltproc(1)>>, <<X13,DocBook XSL Stylesheets>> and, optionally
3872
+ <<X31,dblatex>> or <<X14,FOP>> (if you want PDF), or `lynx(1)` (if you
3873
+ want text).
3874
+
3875
+ The following examples generate `doc/source-highlight-filter.pdf` from
3876
+ the AsciiDoc `doc/source-highlight-filter.txt` source file. The first
3877
+ example uses `dblatex(1)` (the default PDF generator) the second
3878
+ example forces FOP to be used:
3879
+
3880
+ $ a2x -f pdf doc/source-highlight-filter.txt
3881
+ $ a2x -f pdf --fop-options="" doc/source-highlight-filter.txt
3882
+
3883
+ See the `a2x(1)` man page for details.
3884
+
3885
+ TIP: Use the `--verbose` command-line option to view executed
3886
+ toolchain commands.
3887
+
3888
+ HTML generation
3889
+ ~~~~~~~~~~~~~~~
3890
+ AsciiDoc produces nicely styled HTML directly without requiring a
3891
+ DocBook toolchain but there are also advantages in going the DocBook
3892
+ route:
3893
+
3894
+ - HTML from DocBook includes automatically generated indexes, tables
3895
+ of contents, footnotes, lists of figures and tables.
3896
+ - DocBook toolchains can also (optionally) generate separate (chunked)
3897
+ linked HTML pages for each document section.
3898
+ - Toolchain processing performs link and document validity checks.
3899
+ - If the DocBook 'lang' attribute is set then things like table of
3900
+ contents, revision history, figure and table captions and admonition
3901
+ captions will be output in the specified language (setting the
3902
+ AsciiDoc 'lang' attribute sets the DocBook 'lang' attribute).
3903
+
3904
+ On the other hand, HTML output directly from AsciiDoc is much faster,
3905
+ is easily customized and can be used in situations where there is no
3906
+ suitable DocBook toolchain (see the
3907
+ http://www.methods.co.nz/asciidoc/[AsciiDoc website] for example).
3908
+
3909
+ PDF generation
3910
+ ~~~~~~~~~~~~~~
3911
+ There are two commonly used tools to generate PDFs from DocBook,
3912
+ <<X31,dblatex>> and <<X14,FOP>>.
3913
+
3914
+ .dblatex or FOP?
3915
+ - 'dblatex' is easier to install, there's zero configuration
3916
+ required and no Java VM to install -- it just works out of the box.
3917
+ - 'dblatex' source code highlighting and numbering is superb.
3918
+ - 'dblatex' is easier to use as it converts DocBook directly to PDF
3919
+ whereas before using 'FOP' you have to convert DocBook to XML-FO
3920
+ using <<X13,DocBook XSL Stylesheets>>.
3921
+ - 'FOP' is more feature complete (for example, callouts are processed
3922
+ inside literal layouts) and arguably produces nicer looking output.
3923
+
3924
+ HTML Help generation
3925
+ ~~~~~~~~~~~~~~~~~~~~
3926
+ . Convert DocBook XML documents to HTML Help compiler source files
3927
+ using <<X13,DocBook XSL Stylesheets>> and <<X40,xsltproc(1)>>.
3928
+ . Convert the HTML Help source (`.hhp` and `.html`) files to HTML Help
3929
+ (`.chm`) files using the <<X67,Microsoft HTML Help Compiler>>.
3930
+
3931
+ Toolchain components summary
3932
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3933
+ AsciiDoc::
3934
+ Converts AsciiDoc (`.txt`) files to DocBook XML (`.xml`) files.
3935
+
3936
+ [[X13]]
3937
+ http://docbook.sourceforge.net/projects/xsl/[DocBook XSL Stylesheets]::
3938
+ These are a set of XSL stylesheets containing rules for converting
3939
+ DocBook XML documents to HTML, XSL-FO, manpage and HTML Help files.
3940
+ The stylesheets are used in conjunction with an XML parser such as
3941
+ <<X40,xsltproc(1)>>.
3942
+
3943
+ [[X40]]
3944
+ http://www.xmlsoft.org[xsltproc]::
3945
+ An XML parser for applying XSLT stylesheets (in our case the
3946
+ <<X13,DocBook XSL Stylesheets>>) to XML documents.
3947
+
3948
+ [[X31]]
3949
+ http://dblatex.sourceforge.net/[dblatex]::
3950
+ Generates PDF, DVI, PostScript and LaTeX formats directly from
3951
+ DocBook source via the intermediate LaTeX typesetting language --
3952
+ uses <<X13,DocBook XSL Stylesheets>>, <<X40,xsltproc(1)>> and
3953
+ `latex(1)`.
3954
+
3955
+ [[X14]]
3956
+ http://xml.apache.org/fop/[FOP]::
3957
+ The Apache Formatting Objects Processor converts XSL-FO (`.fo`)
3958
+ files to PDF files. The XSL-FO files are generated from DocBook
3959
+ source files using <<X13,DocBook XSL Stylesheets>> and
3960
+ <<X40,xsltproc(1)>>.
3961
+
3962
+ [[X67]]
3963
+ Microsoft Help Compiler::
3964
+ The Microsoft HTML Help Compiler (`hhc.exe`) is a command-line tool
3965
+ that converts HTML Help source files to a single HTML Help (`.chm`)
3966
+ file. It runs on MS Windows platforms and can be downloaded from
3967
+ http://www.microsoft.com.
3968
+
3969
+ AsciiDoc dblatex configuration files
3970
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3971
+ The AsciiDoc distribution `./dblatex` directory contains
3972
+ `asciidoc-dblatex.xsl` (customized XSL parameter settings) and
3973
+ `asciidoc-dblatex.sty` (customized LaTeX settings). These are examples
3974
+ of optional <<X31,dblatex>> output customization and are used by
3975
+ <<X43,a2x(1)>>.
3976
+
3977
+ AsciiDoc DocBook XSL Stylesheets drivers
3978
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3979
+ You will have noticed that the distributed HTML and HTML Help
3980
+ documentation files (for example `./doc/asciidoc.html`) are not the
3981
+ plain outputs produced using the default 'DocBook XSL Stylesheets'
3982
+ configuration. This is because they have been processed using
3983
+ customized DocBook XSL Stylesheets along with (in the case of HTML
3984
+ outputs) the custom `./stylesheets/docbook.css` CSS stylesheet.
3985
+
3986
+ You'll find the customized DocBook XSL drivers along with additional
3987
+ documentation in the distribution `./docbook-xsl` directory. The
3988
+ examples that follow are executed from the distribution documentation
3989
+ (`./doc`) directory.
3990
+
3991
+ `common.xsl`::
3992
+ Shared driver parameters. This file is not used directly but is
3993
+ included in all the following drivers.
3994
+
3995
+ `chunked.xsl`::
3996
+ Generate chunked XHTML (separate HTML pages for each document
3997
+ section) in the `./doc/chunked` directory. For example:
3998
+
3999
+ $ python ../asciidoc.py -b docbook asciidoc.txt
4000
+ $ xsltproc --nonet ../docbook-xsl/chunked.xsl asciidoc.xml
4001
+
4002
+ `fo.xsl`::
4003
+ Generate XSL Formatting Object (`.fo`) files for subsequent PDF
4004
+ file generation using FOP. For example:
4005
+
4006
+ $ python ../asciidoc.py -b docbook article.txt
4007
+ $ xsltproc --nonet ../docbook-xsl/fo.xsl article.xml > article.fo
4008
+ $ fop.sh article.fo article.pdf
4009
+
4010
+ `htmlhelp.xsl`::
4011
+ Generate Microsoft HTML Help source files for the MS HTML Help
4012
+ Compiler in the `./doc/htmlhelp` directory. This example is run on
4013
+ MS Windows from a Cygwin shell prompt:
4014
+
4015
+ $ python ../asciidoc.py -b docbook asciidoc.txt
4016
+ $ xsltproc --nonet ../docbook-xsl/htmlhelp.xsl asciidoc.xml
4017
+ $ c:/Program\ Files/HTML\ Help\ Workshop/hhc.exe htmlhelp.hhp
4018
+
4019
+ `manpage.xsl`::
4020
+ Generate a `roff(1)` format UNIX man page from a DocBook XML
4021
+ 'refentry' document. This example generates an `asciidoc.1` man
4022
+ page file:
4023
+
4024
+ $ python ../asciidoc.py -d manpage -b docbook asciidoc.1.txt
4025
+ $ xsltproc --nonet ../docbook-xsl/manpage.xsl asciidoc.1.xml
4026
+
4027
+ `xhtml.xsl`::
4028
+ Convert a DocBook XML file to a single XHTML file. For example:
4029
+
4030
+ $ python ../asciidoc.py -b docbook asciidoc.txt
4031
+ $ xsltproc --nonet ../docbook-xsl/xhtml.xsl asciidoc.xml > asciidoc.html
4032
+
4033
+ If you want to see how the complete documentation set is processed
4034
+ take a look at the A-A-P script `./doc/main.aap`.
4035
+
4036
+
4037
+ Generating Plain Text Files
4038
+ ---------------------------
4039
+ AsciiDoc does not have a text backend (for most purposes AsciiDoc
4040
+ source text is fine), however you can convert AsciiDoc text files to
4041
+ formatted text using the AsciiDoc <<X43,a2x(1)>> toolchain wrapper
4042
+ utility.
4043
+
4044
+
4045
+ XML and Character Sets
4046
+ ----------------------
4047
+ The default XML character set `UTF-8` is used when AsciiDoc generates
4048
+ DocBook files but this can be changed by setting the `xmldecl` entry
4049
+ in the `[attributes]` section of the `docbook.conf` file or by
4050
+ composing your own configuration file `[header]` section).
4051
+
4052
+ TIP: If you get an 'undefined entity' error when processing DocBook
4053
+ files you'll may find that you've used an undefined HTML character
4054
+ entity. An easy (although inelegant) fix is to use the character's
4055
+ character code instead of its symbolic name (for example use `&#160;`
4056
+ instead of `&nbsp;`).
4057
+
4058
+ If your system has been configured with an XML catalog you may find a
4059
+ number of entity sets are already automatically included.
4060
+
4061
+ PDF Fonts
4062
+ ~~~~~~~~~
4063
+ The Adobe PDF Specification states that the following 14 fonts should
4064
+ be available to every PDF reader: Helvetica (normal, bold, italic,
4065
+ bold italic), Times (normal, bold, italic, bold italic), Courier
4066
+ (normal, bold, italic, bold italic), Symbol and ZapfDingbats.
4067
+ Non-standard fonts should be embedded in the distributed document.
4068
+
4069
+
4070
+ [[X36]]
4071
+ Help Commands
4072
+ -------------
4073
+ The asciidoc(1) command has a `\--help` option which prints help topics
4074
+ to stdout. The default topic summarizes asciidoc(1) usage:
4075
+
4076
+ $ asciidoc --help
4077
+
4078
+ To print a list of help topics:
4079
+
4080
+ $ asciidoc --help=topics
4081
+
4082
+ To print a help topic specify the topic name as a command argument.
4083
+ Help topic names can be shortened so long as they are not ambiguous.
4084
+ Examples:
4085
+
4086
+ $ asciidoc --help=manpage
4087
+ $ asciidoc -hm # Short version of previous example.
4088
+ $ asciidoc --help=syntax
4089
+ $ asciidoc -hs # Short version of previous example.
4090
+
4091
+ Customizing Help
4092
+ ~~~~~~~~~~~~~~~~
4093
+ To change, delete or add your own help topics edit a help
4094
+ configuration file. The help file name `help-<lang>.conf` is based on
4095
+ the setting of the `lang` attribute, it defaults to `help.conf`
4096
+ (English). The <<X27,help file location>> will depend on whether you
4097
+ want the topics to apply to all users or just the current user.
4098
+
4099
+ The help topic files have the same named section format as other
4100
+ <<X7,configuration files>>. The `help.conf` files are stored in the
4101
+ same locations and loaded in the same order as other configuration
4102
+ files.
4103
+
4104
+ When the `\--help` command-line option is specified AsciiDoc loads the
4105
+ appropriate help files and then prints the contents of the section
4106
+ whose name matches the help topic name. If a topic name is not
4107
+ specified `default` is used. You don't need to specify the whole help
4108
+ topic name on the command-line, just enough letters to ensure it's not
4109
+ ambiguous. If a matching help file section is not found a list of
4110
+ available topics is printed.
4111
+
4112
+
4113
+ Tips and Tricks
4114
+ ---------------
4115
+
4116
+ Know Your Editor
4117
+ ~~~~~~~~~~~~~~~~
4118
+ Writing AsciiDoc documents will be a whole lot more pleasant if you
4119
+ know your favorite text editor. Learn how to indent and reformat text
4120
+ blocks, paragraphs, lists and sentences. <<X20,Tips for 'vim' users>>
4121
+ follow.
4122
+
4123
+ [[X20]]
4124
+ Vim Commands for Formatting AsciiDoc
4125
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4126
+ Text Wrap Paragraphs
4127
+ ^^^^^^^^^^^^^^^^^^^^
4128
+ Use the vim `:gq` command to reformat paragraphs. Setting the
4129
+ 'textwidth' sets the right text wrap margin; for example:
4130
+
4131
+ :set textwidth=70
4132
+
4133
+ To reformat a paragraph:
4134
+
4135
+ 1. Position the cursor at the start of the paragraph.
4136
+ 2. Type `gq}`.
4137
+
4138
+ Execute `:help gq` command to read about the vim gq command.
4139
+
4140
+ [TIP]
4141
+ =====================================================================
4142
+ - Assign the `gq}` command to the Q key with the `nnoremap Q gq}`
4143
+ command or put it in your `\~/.vimrc` file to so it's always
4144
+ available (see the <<X61, Example `\~/.vimrc` file>>).
4145
+ - Put `set` commands in your `\~/.vimrc` file so you don't have to
4146
+ enter them manually <<X61, Example `\~/.vimrc` file>>).
4147
+ - The Vim website (http://www.vim.org) has a wealth of resources,
4148
+ including scripts for automated spell checking and ASCII Art
4149
+ drawing.
4150
+
4151
+ =====================================================================
4152
+
4153
+ Format Lists
4154
+ ^^^^^^^^^^^^
4155
+ The `gq` command can also be used to format bulleted and numbered
4156
+ lists. First you need to set the `comments` and `formatoptions` (see
4157
+ the <<X61, Example `\~/.vimrc` file>>).
4158
+
4159
+ Now you can format simple lists that use dash, asterisk, period and
4160
+ plus bullets along with numbered ordered lists:
4161
+
4162
+ 1. Position the cursor at the start of the list.
4163
+ 2. Type `gq}`.
4164
+
4165
+ Indent Paragraphs
4166
+ ^^^^^^^^^^^^^^^^^
4167
+ Indent whole paragraphs by indenting the fist line with the desired
4168
+ indent and then executing the `gq}` command.
4169
+
4170
+ [[X61]]
4171
+ Example `\~/.vimrc` File
4172
+ ^^^^^^^^^^^^^^^^^^^^^^^^
4173
+ ---------------------------------------------------------------------
4174
+ " Show tabs and trailing characters.
4175
+ set listchars=tab:»·,trail:·
4176
+ set list
4177
+
4178
+ " Don't highlight searched text.
4179
+ highlight clear Search
4180
+
4181
+ " Don't move to matched text while search pattern is being entered.
4182
+ set noincsearch
4183
+
4184
+ " Q command to reformat paragraphs and list.
4185
+ nnoremap Q gq}
4186
+
4187
+ " W command to delete trailing white space and Dos-returns and to expand tabs
4188
+ " to spaces.
4189
+ nnoremap W :%s/[\r \t]\+$//<CR>:set et<CR>:retab!<CR>
4190
+
4191
+ autocmd BufRead,BufNewFile *.txt,README,TODO,CHANGELOG,NOTES
4192
+ \ setlocal autoindent expandtab tabstop=8 softtabstop=2 shiftwidth=2
4193
+ \ textwidth=70 wrap formatoptions=tcqn
4194
+ \ comments=s1:/*,ex:*/,://,b:#,:%,:XCOMM,fb:-,fb:*,fb:+,fb:.,fb:>
4195
+ ---------------------------------------------------------------------
4196
+
4197
+ Troubleshooting
4198
+ ~~~~~~~~~~~~~~~
4199
+ - The asciidoc(1) `-v` (`--verbose`) command-line option displays the
4200
+ order of configuration file loading and warns of potential
4201
+ configuration file problems.
4202
+ - Not all valid AsciiDoc documents produce valid backend markup. Read
4203
+ the <<X5,AsciiDoc Backends>> section if AsciiDoc output is rejected
4204
+ as non-conformant by a backend processor.
4205
+
4206
+ Gotchas
4207
+ ~~~~~~~
4208
+ Incorrect character encoding::
4209
+ If you get an error message like `\'UTF-8' codec can't decode ...`
4210
+ then you source file contains invalid UTF-8 characters -- set the
4211
+ AsciiDoc <<X54,encoding attribute>> for the correct character set
4212
+ (typically ISO-8859-1 (Latin-1) for European languages).
4213
+
4214
+ Misinterpreted text formatting::
4215
+ If text in your document is incorrectly interpreted as formatting
4216
+ instructions you can suppress formatting by placing a backslash
4217
+ character immediately in front of the leading quote character(s).
4218
+ For example in the following line the backslash prevents text
4219
+ between the two asterisks from being output in a strong (bold)
4220
+ font:
4221
+
4222
+ Add `\*.cs` files and `*.resx` files.
4223
+
4224
+ Overlapping text formatting::
4225
+ Overlapping text formatting will generate illegal overlapping
4226
+ markup tags which will result in downstream XML parsing errors.
4227
+ Here's an example:
4228
+
4229
+ Some *strong markup _that overlaps* emphasized markup_.
4230
+
4231
+ Ambiguous underlines::
4232
+ A DelimitedBlock can immediately follow paragraph without an
4233
+ intervening blank line, but be careful, a single line paragraph
4234
+ underline may be misinterpreted as a section title underline
4235
+ resulting in a ``closing block delimiter expected'' error.
4236
+
4237
+ Ambiguous ordered list items::
4238
+ Lines beginning with numbers at the end of sentences will be
4239
+ interpreted as ordered list items. The following example
4240
+ (incorrectly) begins a new list with item number 1999:
4241
+
4242
+ He was last sighted in
4243
+ 1999. Since then things have moved on.
4244
+ +
4245
+ The 'list item out of sequence' warning makes it unlikely that this
4246
+ problem will go unnoticed.
4247
+
4248
+ Escaping inside DSV table data::
4249
+ Delimiter separated text uses C style backslash escape sequences.
4250
+ If you want to enter a backslash (for example, to escape AsciiDoc
4251
+ text formatting or an inline macro) you need to escape it by
4252
+ entering two backslashes.
4253
+
4254
+ Special characters in attribute values::
4255
+ Special character substitution precedes attribute substitution so
4256
+ if attribute values contain special characters you may, depending
4257
+ on the substitution context, need to escape the special characters
4258
+ yourself. For example:
4259
+
4260
+ $ asciidoc -a 'companyname=Bill &amp; Ben' mydoc.txt
4261
+
4262
+ Macro attribute lists::
4263
+ If named attribute list entries are present then all string
4264
+ attribute values must be quoted. For example:
4265
+
4266
+ ["Desktop screenshot",width=32]
4267
+
4268
+ Combining Separate Documents
4269
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4270
+ You have a number of stand-alone AsciiDoc documents that you want to
4271
+ process as a single document. Simply processing them with a series of
4272
+ `include` macros won't work, because instead of starting at level 1
4273
+ the section levels of the combined document start at level 0 (the
4274
+ document title level).
4275
+
4276
+ The solution is to redefine the title underlines so that document and
4277
+ section titles are pushed down one level.
4278
+
4279
+ . Push the standard title underlines down one level by defining a new
4280
+ level 0 underline in a custom configuration file. For example
4281
+ `combined.conf`:
4282
+
4283
+ [titles]
4284
+ underlines="__","==","--","~~","^^"
4285
+
4286
+ . If you use single line titles you'll need to make corresponding
4287
+ adjustments to the `[titles]` section `sect0`...`sect4` entries.
4288
+
4289
+ . Create a top level wrapper document. For example `combined.txt`:
4290
+ +
4291
+ ---------------------------------------------------------------------
4292
+ Combined Document Title
4293
+ _______________________
4294
+
4295
+ include::document1.txt[]
4296
+
4297
+ include::document2.txt[]
4298
+
4299
+ include::document3.txt[]
4300
+ ---------------------------------------------------------------------
4301
+
4302
+ . Process the wrapper document. For example:
4303
+
4304
+ $ asciidoc --conf-file=combined.conf combined.txt
4305
+
4306
+ Actually the `--conf-file` option is unnecessary as asciidoc(1)
4307
+ automatically looks for a same-named `.conf` file.
4308
+
4309
+ - The combined document title uses the newly defined level 0 underline
4310
+ (underscore characters).
4311
+ - Put a blank line between the `include` macro lines to ensure the
4312
+ title of the included document is not seen as part of the last
4313
+ paragraph of the previous document.
4314
+ - You won't want document Headers (Author and Revision lines) in the
4315
+ included files -- conditionally exclude them if they are necessary
4316
+ for stand-alone processing.
4317
+
4318
+ Processing Document Sections Separately
4319
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4320
+ You have divided your AsciiDoc document into separate files (one per top level
4321
+ section) which are combined and processed with the following top level
4322
+ document:
4323
+
4324
+ ---------------------------------------------------------------------
4325
+ Combined Document Title
4326
+ =======================
4327
+ Joe Bloggs
4328
+ v1.0, 12-Aug-03
4329
+
4330
+ include::section1.txt[]
4331
+
4332
+ include::section2.txt[]
4333
+
4334
+ include::section3.txt[]
4335
+ ---------------------------------------------------------------------
4336
+
4337
+ You also want to process the section files as separate documents.
4338
+ This is easy because asciidoc(1) will quite happily process
4339
+ `section1.txt`, `section2.txt` and `section3.txt` separately.
4340
+
4341
+ If you want to promote the section levels up one level, so the
4342
+ document is processed just like a stand-alone document, then pop the
4343
+ section underline definition up one level:
4344
+
4345
+ [titles]
4346
+ underlines="--","~~","^^","++","__"
4347
+
4348
+ The last `"__"` underline is a dummy that won't actually be used but
4349
+ is necessary to legitimize the underline definition.
4350
+
4351
+ This is just the reverse of the technique used for combining separate
4352
+ documents explained in the previous section.
4353
+
4354
+ Processing Document Chunks
4355
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
4356
+ asciidoc(1) can be used as a filter, so you can pipe chunks of text
4357
+ through it. For example:
4358
+
4359
+ $ echo 'Hello *World!*' | asciidoc -s -
4360
+ <div class="para"><p>Hello <strong>World!</strong></p></div>
4361
+
4362
+ The `-s` (`--no-header-footer`) command-line option suppresses header
4363
+ and footer output and is useful if the processed output is to be
4364
+ included in another file.
4365
+
4366
+ Badges in HTML Page Footers
4367
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
4368
+ See the `[footer]` section in the AsciiDoc distribution `xhtml11.conf`
4369
+ configuration file.
4370
+
4371
+ Pretty Printing AsciiDoc Output
4372
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4373
+ If the indentation and layout of the asciidoc(1) output is not to your
4374
+ liking you can:
4375
+
4376
+ 1. Change the indentation and layout of configuration file markup
4377
+ template sections. The `\{empty}` glossary entry is useful for
4378
+ outputting trailing blank lines in markup templates.
4379
+
4380
+ 2. Or use Dave Raggett's excellent 'HTML Tidy' program to tidy
4381
+ asciidoc(1) output. Example:
4382
+
4383
+ $ asciidoc -b docbook -o - mydoc.txt | tidy -indent -xml >mydoc.xml
4384
+
4385
+ 'HTML Tidy' can be downloaded from http://tidy.sourceforge.net/
4386
+
4387
+ Supporting Minor DocBook DTD Variations
4388
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4389
+ The conditional inclusion of DocBook SGML markup at the end of the
4390
+ distribution `docbook.conf` file illustrates how to support minor DTD
4391
+ variations. The included sections override corresponding entries from
4392
+ preceding sections.
4393
+
4394
+ Shipping Stand-alone AsciiDoc Source
4395
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4396
+ Reproducing presentation documents from someone else's source has one
4397
+ major problem: unless your configuration files are the same as the
4398
+ creator's you won't get the same output.
4399
+
4400
+ The solution is to create a single backend specific configuration file
4401
+ using the asciidoc(1) `-c` (`--dump-conf`) command-line option. You
4402
+ then ship this file along with the AsciiDoc source document plus the
4403
+ `asciidoc.py` script. The only end user requirement is that they have
4404
+ Python installed (and of course that they consider you a trusted
4405
+ source). This example creates a composite HTML configuration
4406
+ file for `mydoc.txt`:
4407
+
4408
+ $ asciidoc -cb xhtml11 mydoc.txt > mydoc-xhtml11.conf
4409
+
4410
+ Ship `mydoc.txt`, `mydoc-html.conf`, and `asciidoc.py`. With
4411
+ these three files (and a Python interpreter) the recipient can
4412
+ regenerate the HMTL output:
4413
+
4414
+ $ ./asciidoc.py -eb xhtml11 mydoc.txt
4415
+
4416
+ The `-e` (`--no-conf`) option excludes the use of implicit
4417
+ configuration files, ensuring that only entries from the
4418
+ `mydoc-html.conf` configuration are used.
4419
+
4420
+ Inserting Blank Space
4421
+ ~~~~~~~~~~~~~~~~~~~~~
4422
+ Adjust your style sheets to add the correct separation between block
4423
+ elements. Inserting blank paragraphs containing a single non-breaking
4424
+ space character `\{nbsp}` works but is an ad hoc solution compared
4425
+ to using style sheets.
4426
+
4427
+ Closing Open Sections
4428
+ ~~~~~~~~~~~~~~~~~~~~~
4429
+ You can close off section tags up to level `N` by calling the
4430
+ `\eval::[Section.setlevel(N)]` system macro. This is useful if you
4431
+ want to include a section composed of raw markup. The following
4432
+ example includes a DocBook glossary division at the top section level
4433
+ (level 0):
4434
+
4435
+ ---------------------------------------------------------------------
4436
+ ifdef::backend-docbook[]
4437
+
4438
+ eval::[Section.setlevel(0)]
4439
+
4440
+ +++++++++++++++++++++++++++++++
4441
+ <glossary>
4442
+ <title>Glossary</title>
4443
+ <glossdiv>
4444
+ ...
4445
+ </glossdiv>
4446
+ </glossary>
4447
+ +++++++++++++++++++++++++++++++
4448
+ endif::backend-docbook[]
4449
+ ---------------------------------------------------------------------
4450
+
4451
+
4452
+ Validating Output Files
4453
+ ~~~~~~~~~~~~~~~~~~~~~~~
4454
+ Use `xmllint(1)` to check the AsciiDoc generated markup is both well
4455
+ formed and valid. Here are some examples:
4456
+
4457
+ $ xmllint --nonet --noout --valid docbook-file.xml
4458
+ $ xmllint --nonet --noout --valid xhtml11-file.html
4459
+ $ xmllint --nonet --noout --valid --html html4-file.html
4460
+
4461
+ The `--valid` option checks the file is valid against the document
4462
+ type's DTD, if the DTD is not installed in your system's catalog then
4463
+ it will be fetched from its Internet location. If you omit the
4464
+ `--valid` option the document will only be checked that it is well
4465
+ formed.
4466
+
4467
+
4468
+ Glossary
4469
+ --------
4470
+ [[X8]] Block element:-
4471
+ An AsciiDoc block element is a document entity composed of one or
4472
+ more whole lines of text.
4473
+
4474
+ [[X34]] Inline element:-
4475
+ AsciiDoc inline elements occur within block element textual
4476
+ content, they perform formatting and substitution tasks.
4477
+
4478
+ Formal element:-
4479
+ An AsciiDoc block element that has a BlockTitle. Formal elements
4480
+ are normally listed in front or back matter, for example lists of
4481
+ tables, examples and figures.
4482
+
4483
+ Verbatim element:-
4484
+ The word verbatim indicates that white space and line breaks in
4485
+ the source document are to be preserved in the output document.
4486
+
4487
+
4488
+ Appendix A: Migration Notes
4489
+ ---------------------------
4490
+ [[X53]]
4491
+ Version 7 to version 8
4492
+ ~~~~~~~~~~~~~~~~~~~~~~
4493
+ - A new set of quotes has been introduced which may match inline text
4494
+ in existing documents -- if they do you'll need to escape the
4495
+ matched text with backslashes.
4496
+ - The index entry inline macro syntax has changed -- if your documents
4497
+ include indexes you may need to edit them.
4498
+ - Replaced a2x(1) `\--no-icons` and `\--no-copy` options with their
4499
+ negated equivalents: `\--icons` and `\--copy` respectively. The
4500
+ default behavior has also changed -- the use of icons and copying of
4501
+ icon and CSS files must be specified explicitly with the `\--icons`
4502
+ and `\--copy` options.
4503
+
4504
+ The rationale for the changes can be found in the AsciiDoc
4505
+ `CHANGELOG`.
4506
+
4507
+ NOTE: If you want to disable unconstrained quotes, the new alternative
4508
+ constrained quotes syntax and the new index entry syntax then you can
4509
+ define the attribute `asciidoc7compatible` (for example by using the
4510
+ `-a asciidoc7compatible` command-line option).
4511
+
4512
+ [[X32]]
4513
+ Version 6 to version 7
4514
+ ~~~~~~~~~~~~~~~~~~~~~~
4515
+ The changes that affect the most users relate to renamed and
4516
+ deprecated backends and command-line syntax:
4517
+
4518
+ . The 'html' backend has been renamed 'html4'.
4519
+ . The 'xhtml' backend has been deprecated to 'xhtml-deprecated' (use
4520
+ the new 'xhtml11' backend in preference).
4521
+ . The use of CSS specific `css` and `css-embedded` backends has been
4522
+ dropped in favor of using attributes (see the table below and
4523
+ <<X33,xhtml backend attributes>>).
4524
+ . Deprecated features that emitted warnings in prior versions are no
4525
+ longer tolerated.
4526
+ . The command-line syntax for deleting (undefining) an attribute has
4527
+ changed from `-a ^name` to `-a name!`.
4528
+
4529
+ .Equivalent command-line syntax
4530
+ [grid="all"]
4531
+ ```~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4532
+ Version 6 (old),Version 7 (new),Version 7 (backward compatible)
4533
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4534
+ -b html,-b html4,-b html4
4535
+ -b css,-b xhtml11 -a linkcss -a icons,-b xhtml-deprecated -a css -a linkcss -a icons
4536
+ -b css-embedded,-b xhtml11 -a icons,-b xhtml-deprecated -a css -a icons
4537
+ -b xhtml,-b xhtml11,-b xhtml-deprecated
4538
+ -b docbook-sgml,-b docbook -a sgml,-b docbook -a sgml
4539
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4540
+
4541
+ If you've customized version 6 distribution stylesheets then you'll
4542
+ need to either bring them in line with the new
4543
+ `./stylesheets/xhtml11*.css` class and id names or stick with the
4544
+ backward compatible `xhtml-deprecated` backend.
4545
+
4546
+ Changes to configuration file syntax:
4547
+
4548
+ . To undefine an attribute in the `[attributes]` section use `name!`
4549
+ instead of `name` (`name` now sets that attribute to a blank
4550
+ string).
4551
+
4552
+
4553
+ [[X38]]
4554
+ Appendix B: Packager Notes
4555
+ ---------------------------
4556
+ Read the `README` and `INSTALL` files (in the distribution root
4557
+ directory) for install prerequisites and procedures.
4558
+
4559
+ The distribution `install.sh` shell script is the canonical
4560
+ installation procedure and is the definitive installation description.
4561
+ Here's a summary of the installation procedure:
4562
+
4563
+ - Unpack entire distribution tarball to `/usr/share/asciidoc/`.
4564
+ - Move `asciidoc.py` to `/usr/bin/`; rename to `asciidoc`; if
4565
+ necessary modify shebang line; ensure executable permissions are
4566
+ set.
4567
+ - Move `a2x` to `/usr/bin/`; if necessary modify shebang line; ensure
4568
+ executable permissions are set.
4569
+ - Move the `./*.conf` files to `/etc/asciidoc/`.
4570
+ - Move `./filters/{\*.conf,*.py}` to `/etc/asciidoc/filters/`.
4571
+ - Move `./docbook-xsl/*.xsl` to `/etc/asciidoc/docbook-xsl/`.
4572
+ - Move `./dblatex/*.{xsl,sty}` to `/etc/asciidoc/dblatex/`.
4573
+ - Copy `./stylesheets/*.css` to `/etc/asciidoc/stylesheets/`.
4574
+ - Copy `./javascripts/*.js` to `/etc/asciidoc/javascripts/`.
4575
+ - Copy `./images/icons/*` to `/etc/asciidoc/images/icons/`
4576
+ (recursively including the `icons` subdirectory and its contents).
4577
+ - Compress the asciidoc(1) and ax2(1) man pages (`./doc/*.1`) with
4578
+ gzip(1) and move them to `/usr/share/man/man1/`.
4579
+ - If Vim is installed then install Vim syntax and filetype detection
4580
+ files.
4581
+
4582
+ Leaving stylesheets and images in `/usr/share/asciidoc/` ensures the
4583
+ docs and example website are not broken.
4584
+
4585
+
4586
+ [[X39]]
4587
+ Appendix C: AsciiDoc Safe Mode
4588
+ ------------------------------
4589
+ AsciiDoc 'safe mode' skips potentially dangerous sections in AsciiDoc
4590
+ source files by inhibiting the execution of arbitrary code or the
4591
+ inclusion of arbitrary files.
4592
+
4593
+ The safe mode is enabled by default and can only be disabled using the
4594
+ asciidoc(1) `--unsafe` command-line option.
4595
+
4596
+ .Safe mode constraints
4597
+ - `eval`, `sys` and `sys2` executable attributes and block macros are
4598
+ not executed.
4599
+ - `\include::<filename>[]` and `\include1::<filename>[]` block macro
4600
+ files must reside inside the parent file's directory.
4601
+ - `\{include:<filename>}` executable attribute files must reside
4602
+ inside the source document directory.
4603
+ - Passthrough Blocks are dropped.
4604
+
4605
+ [WARNING]
4606
+ =====================================================================
4607
+ The safe mode is not designed to protect against unsafe AsciiDoc
4608
+ configuration files. Be especially careful when:
4609
+
4610
+ 1. Implementing filters.
4611
+ 2. Implementing elements that don't escape special characters.
4612
+ 3. Accepting configuration files from untrusted sources.
4613
+ =====================================================================
4614
+
4615
+
4616
+ Appendix D: Using AsciiDoc with non-English Languages
4617
+ -----------------------------------------------------
4618
+ AsciiDoc can process UTF-8 character sets but there are some things
4619
+ you need to be aware of:
4620
+
4621
+ - If you are generating output documents using a DocBook toolchain
4622
+ then you should set the AsciiDoc `lang` attribute to the appropriate
4623
+ language (it defaults to `en` (English)). This will ensure things
4624
+ like table of contents, revision history, figure and table captions
4625
+ and admonition captions are output in the specified language.
4626
+ For example:
4627
+
4628
+ $ a2x -a lang=es doc/article.txt
4629
+
4630
+ - If you are outputting html or xhtml directly from asciidoc(1) you'll
4631
+ need to set the various `*_caption` attributes to match your target
4632
+ language (see the list of captions and titles in the `[attributes]`
4633
+ section of the default `asciidoc.conf` file). The easiest way is to
4634
+ create a language `.conf` file (see the example `lang-es.conf` file
4635
+ that comes with the AsciiDoc distribution).
4636
+
4637
+ - asciidoc(1) automatically loads configuration files named like
4638
+ `lang-<lang>.conf` where `<lang>` is a two letter language code that
4639
+ matches the current AsciiDoc `lang` attribute. See also
4640
+ <<X27,Configuration File Names and Locations>>.
4641
+
4642
+ - Some character sets display double-width characters (for example
4643
+ Japanese). As far as <<X17,title underlines>> are concerned they
4644
+ should be treated as single character. If you think this looks
4645
+ untidy so you may prefer to use the <<X46,single line title>>
4646
+ format.
4647
+
4648
+
4649
+ Appendix E: ASCIIMathML Support
4650
+ -------------------------------
4651
+ http://www1.chapman.edu/~jipsen/mathml/asciimath.html[ASCIIMathML] is
4652
+ a clever JavaScript written by Peter Jipsen that transforms
4653
+ mathematical formulae written in plain text to standard mathematical
4654
+ notation on an HTML page.
4655
+
4656
+ To enable ASCIIMathML support on the `xhtml11` backend include the `-a
4657
+ asciimath` command-line option. Here's what the `asciimath` attribute
4658
+ does:
4659
+
4660
+ - Embeds the `ASCIIMathML.js` script in the output document (links it
4661
+ if `-a linkcss` has been specified).
4662
+ - Escapes ASCIIMathML delimiters.
4663
+
4664
+ When entering ASCIIMathML formulas you *must* enclose them inside
4665
+ <<X50,double-dollar passthroughs>> (this is necessary because
4666
+ ASCIIMathML characters clash with AsciiDoc formatting characters). The
4667
+ double-dollar passthrough has the bonus of also escaping special
4668
+ characters so the output document is valid XHTML. You can see an
4669
+ ASCIIMathML example at
4670
+ http://www.methods.co.nz/asciidoc/asciimath.html, the same example
4671
+ can be found in the AsciiDoc distribution `./doc` directory.
4672
+
4673
+ [NOTE]
4674
+ =====================================================================
4675
+ - See the
4676
+ http://www1.chapman.edu/~jipsen/mathml/asciimath.html[ASCIIMathML]
4677
+ website for ASCIIMathML documentation and the latest version.
4678
+ - If you use Mozilla you need to install the
4679
+ http://www.mozilla.org/projects/mathml/fonts/[required math fonts].
4680
+ - If you use Microsoft Internet Explorer 6 you need to install
4681
+ http://www.dessci.com/en/products/mathplayer/[MathPlayer].
4682
+ =====================================================================
4683
+
4684
+
4685
+ Appendix F: Vim Syntax Highlighter
4686
+ ----------------------------------
4687
+ The AsciiDoc `./vim/` distribution directory contains Vim syntax
4688
+ highlighter and filetype detection scripts for AsciiDoc. Syntax
4689
+ highlighting makes it much easier to spot AsciiDoc syntax errors.
4690
+
4691
+ If Vim is installed on your system the AsciiDoc installer
4692
+ (`install.sh`) will automatically install the vim scripts in the Vim
4693
+ global configuration directory (`/etc/vim`).
4694
+
4695
+ You can also turn on syntax highlighting by adding the following line
4696
+ to the end of you AsciiDoc source files:
4697
+
4698
+ // vim: set syntax=asciidoc:
4699
+
4700
+ NOTE: Dag Wieers has implemented an alternative Vim syntax file for
4701
+ AsciiDoc which can be found here
4702
+ http://svn.rpmforge.net/svn/trunk/tools/asciidoc-vim/.
4703
+
4704
+ NOTE: Emacs users: The http://xpt.sourceforge.net/[*Nix Power Tools
4705
+ project] has released an
4706
+ http://xpt.sourceforge.net/tools/doc-mode/[AsciiDoc syntax highlighter
4707
+ for emacs].
4708
+
4709
+ Limitations
4710
+ ~~~~~~~~~~~
4711
+ The current implementation does a reasonable job but on occasions gets
4712
+ things wrong. This list of limitations also discusses how to work
4713
+ around the problems:
4714
+
4715
+ - Indented lists with preceding blank lines are sometimes mistaken
4716
+ for literal (indented) paragraphs. You can work around this by
4717
+ deleting the preceding blank line, or inserting a space in the
4718
+ preceding blank lines, or putting a list continuation character
4719
+ (`+`) in the preceding blank line.
4720
+
4721
+ - Nested text formatting is highlighted according to the outer format.
4722
+
4723
+ - Most escaped inline elements will be highlighted.
4724
+
4725
+ - Unterminated quotes are highlighted, for example `'tis` would be
4726
+ seen as the start of emphasized text. As a damage control measure
4727
+ quoted text and macro attribute list containing quoted text always
4728
+ terminate at a blank line. This problem is usually ameliorated by
4729
+ the fact that characters such as `\~`, `+`, `^` and `_` will
4730
+ normally occur inside monospaced quotes (unless they are used for
4731
+ quoting), for example `~/projects`.
4732
+
4733
+ - If a closing block delimiter is not preceded by a blank line it is
4734
+ sometimes mistaken for a title underline. A workaround is to insert
4735
+ a blank line before the closing delimiter.
4736
+
4737
+ - If a list block delimiter is mistaken for a title underline precede
4738
+ it with a blank line.
4739
+
4740
+ - Tables are terminated by a blank line -- use a space character on
4741
+ blank lines within your table.
4742
+
4743
+ - Lines within a paragraph beginning with a period will be highlighted
4744
+ as block titles. For example:
4745
+
4746
+ .chm file.
4747
+ +
4748
+ To work around this restriction move the last word of the previous
4749
+ line to the start of the current (although words starting with a
4750
+ period should probably be quoted monospace which would also get around
4751
+ the problem).
4752
+
4753
+ TIP: Sometimes incorrect highlighting is caused by preceding lines
4754
+ that appear blank but contain white space characters -- setting your
4755
+ editor options so that white space characters are visible is a good
4756
+ idea.
4757
+