git-scribe 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. data/.gitignore +1 -0
  2. data/Rakefile +31 -0
  3. data/SPEC.asciidoc +126 -0
  4. data/TODO.txt +29 -0
  5. data/bin/git-scribe +2 -1
  6. data/docbook-xsl/.CatalogManager.properties.example +61 -0
  7. data/docbook-xsl/.urilist +1 -0
  8. data/git-scribe.gemspec +32 -0
  9. data/lib/git-scribe.rb +21 -315
  10. data/lib/git-scribe/check.rb +60 -0
  11. data/lib/git-scribe/cli.rb +84 -0
  12. data/lib/git-scribe/generate.rb +222 -0
  13. data/lib/git-scribe/init.rb +16 -0
  14. data/lib/git-scribe/version.rb +3 -0
  15. data/template/.gitignore +1 -0
  16. data/template/.gitscribe +5 -0
  17. data/test/check_test.rb +12 -0
  18. data/test/gen_test.rb +78 -0
  19. data/test/init_test.rb +36 -0
  20. data/test/test_helper.rb +44 -0
  21. metadata +49 -161
  22. data/example/book/big.asc +0 -5604
  23. data/example/book/holmes.asc +0 -12983
  24. data/example/output/META-INF/container.xml +0 -6
  25. data/example/output/OEBPS/ar01s02.html +0 -15
  26. data/example/output/OEBPS/ar01s03.html +0 -3
  27. data/example/output/OEBPS/content.opf +0 -21
  28. data/example/output/OEBPS/index.html +0 -5
  29. data/example/output/OEBPS/toc.ncx +0 -37
  30. data/example/output/a_case_of_identity.html +0 -725
  31. data/example/output/a_example_appendix.html +0 -63
  32. data/example/output/a_migration_notes.html +0 -95
  33. data/example/output/apa.html +0 -20
  34. data/example/output/apb.html +0 -6
  35. data/example/output/apc.html +0 -24
  36. data/example/output/apd.html +0 -30
  37. data/example/output/ape.html +0 -26
  38. data/example/output/apf.html +0 -9
  39. data/example/output/apg.html +0 -42
  40. data/example/output/aph.html +0 -89
  41. data/example/output/ar01s02.html +0 -12
  42. data/example/output/ar01s03.html +0 -34
  43. data/example/output/ar01s04.html +0 -77
  44. data/example/output/ar01s05.html +0 -272
  45. data/example/output/ar01s06.html +0 -35
  46. data/example/output/ar01s07.html +0 -105
  47. data/example/output/ar01s08.html +0 -33
  48. data/example/output/ar01s09.html +0 -12
  49. data/example/output/ar01s10.html +0 -14
  50. data/example/output/ar01s11.html +0 -34
  51. data/example/output/ar01s12.html +0 -63
  52. data/example/output/ar01s13.html +0 -156
  53. data/example/output/ar01s14.html +0 -330
  54. data/example/output/ar01s15.html +0 -22
  55. data/example/output/ar01s16.html +0 -27
  56. data/example/output/ar01s17.html +0 -94
  57. data/example/output/ar01s18.html +0 -359
  58. data/example/output/ar01s19.html +0 -373
  59. data/example/output/ar01s20.html +0 -27
  60. data/example/output/ar01s21.html +0 -33
  61. data/example/output/ar01s22.html +0 -351
  62. data/example/output/ar01s23.html +0 -21
  63. data/example/output/ar01s24.html +0 -69
  64. data/example/output/ar01s25.html +0 -60
  65. data/example/output/ar01s26.html +0 -217
  66. data/example/output/ar01s27.html +0 -88
  67. data/example/output/ar01s28.html +0 -237
  68. data/example/output/ar01s29.html +0 -68
  69. data/example/output/ar01s30.html +0 -154
  70. data/example/output/ar01s31.html +0 -6
  71. data/example/output/ar01s32.html +0 -22
  72. data/example/output/ar01s33.html +0 -209
  73. data/example/output/asciidoc_backends.html +0 -190
  74. data/example/output/asciidoc_document_types.html +0 -131
  75. data/example/output/attribute_entries.html +0 -185
  76. data/example/output/attribute_lists.html +0 -157
  77. data/example/output/attribute_references.html +0 -414
  78. data/example/output/attributelist_element.html +0 -143
  79. data/example/output/b_packager_notes.html +0 -68
  80. data/example/output/bi01.html +0 -18
  81. data/example/output/big.asc +0 -5604
  82. data/example/output/block_element_definitions.html +0 -448
  83. data/example/output/block_titles.html +0 -83
  84. data/example/output/blockid_element.html +0 -80
  85. data/example/output/book.asc +0 -5604
  86. data/example/output/book.epub +0 -0
  87. data/example/output/book.fo +0 -3788
  88. data/example/output/book.html +0 -8793
  89. data/example/output/book.xml +0 -8265
  90. data/example/output/c_asciidoc_safe_mode.html +0 -105
  91. data/example/output/callouts.html +0 -214
  92. data/example/output/catalog +0 -10
  93. data/example/output/colophon.html +0 -397
  94. data/example/output/configuration_files.html +0 -672
  95. data/example/output/converting_docbook_to_other_file_formats.html +0 -324
  96. data/example/output/d_using_asciidoc_with_non-english_languages.html +0 -107
  97. data/example/output/delimited_blocks.html +0 -455
  98. data/example/output/document_attributes.html +0 -95
  99. data/example/output/document_processing.html +0 -116
  100. data/example/output/document_structure.html +0 -493
  101. data/example/output/e_vim_syntax_highlighter.html +0 -111
  102. data/example/output/example_bibliography.html +0 -82
  103. data/example/output/example_colophon.html +0 -58
  104. data/example/output/example_glossary.html +0 -73
  105. data/example/output/example_index.html +0 -108
  106. data/example/output/f_attribute_options.html +0 -129
  107. data/example/output/filters.html +0 -179
  108. data/example/output/footnotes.html +0 -103
  109. data/example/output/g_diagnostics.html +0 -148
  110. data/example/output/generating_plain_text_files.html +0 -68
  111. data/example/output/getting_started.html +0 -87
  112. data/example/output/glossary.html +0 -95
  113. data/example/output/go01.html +0 -24
  114. data/example/output/h_backend_attributes.html +0 -308
  115. data/example/output/help_commands.html +0 -96
  116. data/example/output/holmes.asc +0 -12983
  117. data/example/output/image/octocat_professor.png +0 -0
  118. data/example/output/include/hello.c +0 -10
  119. data/example/output/index.html +0 -656
  120. data/example/output/indexes.html +0 -104
  121. data/example/output/intrinsic_attributes.html +0 -165
  122. data/example/output/ix01.html +0 -3
  123. data/example/output/lists.html +0 -666
  124. data/example/output/macros.html +0 -737
  125. data/example/output/manpage_documents.html +0 -124
  126. data/example/output/master.css +0 -281
  127. data/example/output/mathematical_formulas.html +0 -125
  128. data/example/output/page.html +0 -60
  129. data/example/output/paragraphs.html +0 -192
  130. data/example/output/pr01.html +0 -3
  131. data/example/output/source_code_highlighting.html +0 -59
  132. data/example/output/stylesheets/handbookish-quirks.css +0 -0
  133. data/example/output/stylesheets/handbookish.css +0 -233
  134. data/example/output/tables.html +0 -797
  135. data/example/output/text_formatting.html +0 -273
  136. data/example/output/the_adventure_of_the_beryl_coronet.html +0 -968
  137. data/example/output/the_adventure_of_the_blue_carbuncle.html +0 -825
  138. data/example/output/the_adventure_of_the_copper_beeches.html +0 -998
  139. data/example/output/the_adventure_of_the_engineer_s_thumb.html +0 -851
  140. data/example/output/the_adventure_of_the_noble_bachelor.html +0 -861
  141. data/example/output/the_adventure_of_the_speckled_band.html +0 -1015
  142. data/example/output/the_boscombe_valley_mystery.html +0 -974
  143. data/example/output/the_first_chapter.html +0 -110
  144. data/example/output/the_five_orange_pips.html +0 -776
  145. data/example/output/the_man_with_the_twisted_lip.html +0 -946
  146. data/example/output/the_red-headed_league.html +0 -950
  147. data/example/output/the_second_chapter.html +0 -95
  148. data/example/output/the_third_chapter.html +0 -58
  149. data/example/output/tips_and_tricks.html +0 -452
  150. data/example/output/title.html +0 -120
  151. data/example/output/titles.html +0 -126
@@ -1,737 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
- <html xmlns="http://www.w3.org/1999/xhtml">
3
- <head>
4
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
5
- <link rel="stylesheet" href="master.css" type="text/css" />
6
- <title>Macros</title>
7
- </head>
8
-
9
- <body>
10
- <div class="nav" id="navheader">
11
- <table width="100%">
12
- <tr><td width="33%" align="left">
13
-
14
- <a href="callouts.html">Prev</a><br/>
15
- Callouts
16
-
17
- </td><td width="33%" align="center">
18
-
19
- <a href="index.html">Home</a><br/>
20
- <strong>AsciiDoc User Guide</strong>
21
-
22
- </td><td width="33%" align="right">
23
-
24
- <a href="tables.html">Next</a><br/>
25
- Tables
26
-
27
- </td></tr>
28
- </table>
29
- </div>
30
-
31
- <hr/>
32
-
33
- <div class="content">
34
- <div class="section" lang="en" xml:lang="en">
35
- <div class="titlepage"><div><div><h2 class="title" style="clear: both">
36
- <a id="_macros"></a>Macros</h2></div></div></div>
37
- <p>Macros are a mechanism for substituting parametrized text into output
38
- documents.</p>
39
- <p>Macros have a <span class="emphasis"><em>name</em></span>, a single <span class="emphasis"><em>target</em></span> argument and an <span class="emphasis"><em>attribute
40
- list</em></span>. The usual syntax is <code class="literal">&lt;name&gt;:&lt;target&gt;[&lt;attrlist&gt;]</code> (for
41
- inline macros) and <code class="literal">&lt;name&gt;::&lt;target&gt;[&lt;attrlist&gt;]</code> (for block
42
- macros). Here are some examples:</p>
43
- <pre class="literallayout">http://www.docbook.org/[DocBook.org]
44
- include::chapt1.txt[tabsize=2]
45
- mailto:srackham@gmail.com[]</pre>
46
- <div class="itemizedlist">
47
- <p class="title"><b>Macro behavior</b></p>
48
- <ul type="disc">
49
- <li>
50
- <code class="literal">&lt;name&gt;</code> is the macro name. It can only contain letters, digits or
51
- dash characters and cannot start with a dash.
52
- </li>
53
- <li>
54
- The optional <code class="literal">&lt;target&gt;</code> cannot contain white space characters.
55
- </li>
56
- <li>
57
- <code class="literal">&lt;attrlist&gt;</code> is a <a class="link" href="attribute_lists.html" title="Attribute Lists">list of attributes</a> enclosed in square
58
- brackets.
59
- </li>
60
- <li>
61
- <code class="literal">]</code> characters inside attribute lists must be escaped with a
62
- backslash.
63
- </li>
64
- <li>
65
- Expansion of macro references can normally be escaped by prefixing a
66
- backslash character (see the AsciiDoc <span class="emphasis"><em>FAQ</em></span> for examples of
67
- exceptions to this rule).
68
- </li>
69
- <li>
70
- Attribute references in block macros are expanded.
71
- </li>
72
- <li>
73
- The substitutions performed prior to Inline macro macro expansion
74
- are determined by the inline context.
75
- </li>
76
- <li>
77
- Macros are processed in the order they appear in the configuration
78
- file(s).
79
- </li>
80
- <li>
81
- Calls to inline macros can be nested inside different inline macros
82
- (an inline macro call cannot contain a nested call to itself).
83
- </li>
84
- <li>
85
- In addition to <code class="literal">&lt;name&gt;</code>, <code class="literal">&lt;target&gt;</code> and <code class="literal">&lt;attrlist&gt;</code> the
86
- <code class="literal">&lt;passtext&gt;</code> and <code class="literal">&lt;subslist&gt;</code> named groups are available to
87
- <a class="link" href="macros.html#X77" title="Passthrough macros">passthrough macros</a>. A macro is a passthrough macro if the
88
- definition includes a <code class="literal">&lt;passtext&gt;</code> named group.
89
- </li>
90
- </ul>
91
- </div>
92
- <div class="section" lang="en" xml:lang="en">
93
- <div class="titlepage"><div><div><h3 class="title">
94
- <a id="_inline_macros"></a>Inline Macros</h3></div></div></div>
95
- <p>Inline Macros occur in an inline element context. Predefined Inline
96
- macros include <span class="emphasis"><em>URLs</em></span>, <span class="emphasis"><em>image</em></span> and <span class="emphasis"><em>link</em></span> macros.</p>
97
- <div class="section" lang="en" xml:lang="en">
98
- <div class="titlepage"><div><div><h4 class="title">
99
- <a id="_urls"></a>URLs</h4></div></div></div>
100
- <p><span class="emphasis"><em>http</em></span>, <span class="emphasis"><em>https</em></span>, <span class="emphasis"><em>ftp</em></span>, <span class="emphasis"><em>file</em></span>, <span class="emphasis"><em>mailto</em></span> and <span class="emphasis"><em>callto</em></span> URLs are
101
- rendered using predefined inline macros.</p>
102
- <div class="itemizedlist"><ul type="disc">
103
- <li>
104
- If you don’t need a custom link caption you can enter the <span class="emphasis"><em>http</em></span>,
105
- <span class="emphasis"><em>https</em></span>, <span class="emphasis"><em>ftp</em></span>, <span class="emphasis"><em>file</em></span> URLs and email addresses without any special
106
- macro syntax.
107
- </li>
108
- <li>
109
- If the <code class="literal">&lt;attrlist&gt;</code> is empty the URL is displayed.
110
- </li>
111
- </ul></div>
112
- <p>Here are some examples:</p>
113
- <pre class="literallayout">http://www.docbook.org/[DocBook.org]
114
- http://www.docbook.org/
115
- mailto:joe.bloggs@foobar.com[email Joe Bloggs]
116
- joe.bloggs@foobar.com</pre>
117
- <p>Which are rendered:</p>
118
- <p><a class="ulink" href="http://www.docbook.org/" target="_top">DocBook.org</a></p>
119
- <p><a class="ulink" href="http://www.docbook.org/" target="_top">http://www.docbook.org/</a></p>
120
- <p><a class="ulink" href="mailto:joe.bloggs@foobar.com" target="_top">email Joe Bloggs</a></p>
121
- <p><a class="ulink" href="mailto:joe.bloggs@foobar.com" target="_top">joe.bloggs@foobar.com</a></p>
122
- <p>If the <code class="literal">&lt;target&gt;</code> necessitates space characters use <code class="literal">%20</code>, for example
123
- <code class="literal">large%20image.png</code>.</p>
124
- </div>
125
- <div class="section" lang="en" xml:lang="en">
126
- <div class="titlepage"><div><div><h4 class="title">
127
- <a id="_internal_cross_references"></a>Internal Cross References</h4></div></div></div>
128
- <p>Two AsciiDoc inline macros are provided for creating hypertext links
129
- within an AsciiDoc document. You can use either the standard macro
130
- syntax or the (preferred) alternative.</p>
131
- <div class="section" lang="en" xml:lang="en">
132
- <div class="titlepage"><div><div><h5 class="title">
133
- <a id="X30"></a>anchor</h5></div></div></div>
134
- <p>Used to specify hypertext link targets:</p>
135
- <pre class="literallayout">[[&lt;id&gt;,&lt;xreflabel&gt;]]
136
- anchor:&lt;id&gt;[&lt;xreflabel&gt;]</pre>
137
- <p>The <code class="literal">&lt;id&gt;</code> is a unique string that conforms to the output markup’s
138
- anchor syntax. The optional <code class="literal">&lt;xreflabel&gt;</code> is the text to be displayed
139
- by captionless <span class="emphasis"><em>xref</em></span> macros that refer to this anchor. The optional
140
- <code class="literal">&lt;xreflabel&gt;</code> is only really useful when generating DocBook output.
141
- Example anchor:</p>
142
- <pre class="literallayout">[[X1]]</pre>
143
- <p>You may have noticed that the syntax of this inline element is the
144
- same as that of the <a class="link" href="blockid_element.html" title="BlockId Element">BlockId block element</a>, this is no
145
- coincidence since they are functionally equivalent.</p>
146
- </div>
147
- <div class="section" lang="en" xml:lang="en">
148
- <div class="titlepage"><div><div><h5 class="title">
149
- <a id="_xref"></a>xref</h5></div></div></div>
150
- <p>Creates a hypertext link to a document anchor.</p>
151
- <pre class="literallayout">&lt;&lt;&lt;id&gt;,&lt;caption&gt;&gt;&gt;
152
- xref:&lt;id&gt;[&lt;caption&gt;]</pre>
153
- <p>The <code class="literal">&lt;id&gt;</code> refers to an anchor ID. The optional <code class="literal">&lt;caption&gt;</code> is the
154
- link’s displayed text. Example:</p>
155
- <pre class="literallayout">&lt;&lt;X21,attribute lists&gt;&gt;</pre>
156
- <p>If <code class="literal">&lt;caption&gt;</code> is not specified then the displayed text is
157
- auto-generated:</p>
158
- <div class="itemizedlist"><ul type="disc">
159
- <li>
160
- The AsciiDoc <code class="literal">xhtml11</code> backend displays the <code class="literal">&lt;id&gt;</code> enclosed in
161
- square brackets.
162
- </li>
163
- <li>
164
- If DocBook is produced the DocBook toolchain is responsible for the
165
- displayed text which will normally be the referenced figure, table
166
- or section title number followed by the element’s title text.
167
- </li>
168
- </ul></div>
169
- <p>Here is an example:</p>
170
- <pre class="screen">[[tiger_image]]
171
- .Tyger tyger
172
- image::tiger.png[]
173
-
174
- This can be seen in &lt;&lt;tiger_image&gt;&gt;.</pre>
175
- </div>
176
- </div>
177
- <div class="section" lang="en" xml:lang="en">
178
- <div class="titlepage"><div><div><h4 class="title">
179
- <a id="_linking_to_local_documents"></a>Linking to Local Documents</h4></div></div></div>
180
- <p>Hypertext links to files on the local file system are specified using
181
- the <span class="emphasis"><em>link</em></span> inline macro.</p>
182
- <pre class="literallayout">link:&lt;target&gt;[&lt;caption&gt;]</pre>
183
- <p>The <span class="emphasis"><em>link</em></span> macro generates relative URLs. The link macro <code class="literal">&lt;target&gt;</code> is
184
- the target file name (relative to the file system location of the
185
- referring document). The optional <code class="literal">&lt;caption&gt;</code> is the link’s displayed
186
- text. If <code class="literal">&lt;caption&gt;</code> is not specified then <code class="literal">&lt;target&gt;</code> is displayed.
187
- Example:</p>
188
- <pre class="literallayout">link:downloads/foo.zip[download foo.zip]</pre>
189
- <p>You can use the <code class="literal">&lt;filename&gt;#&lt;id&gt;</code> syntax to refer to an anchor within
190
- a target document but this usually only makes sense when targeting
191
- HTML documents.</p>
192
- </div>
193
- <div class="section" lang="en" xml:lang="en">
194
- <div class="titlepage"><div><div><h4 class="title">
195
- <a id="X9"></a>Images</h4></div></div></div>
196
- <p>Inline images are inserted into the output document using the <span class="emphasis"><em>image</em></span>
197
- macro. The inline syntax is:</p>
198
- <pre class="literallayout">image:&lt;target&gt;[&lt;attributes&gt;]</pre>
199
- <p>The contents of the image file <code class="literal">&lt;target&gt;</code> is displayed. To display the
200
- image its file format must be supported by the target backend
201
- application. HTML and DocBook applications normally support PNG or JPG
202
- files.</p>
203
- <p><code class="literal">&lt;target&gt;</code> file name paths are relative to the location of the
204
- referring document.</p>
205
- <div class="itemizedlist">
206
- <a id="X55"></a><p class="title"><b>Image macro attributes</b></p>
207
- <ul type="disc">
208
- <li>
209
- <p>
210
- The optional <span class="emphasis"><em>alt</em></span> attribute is also the first positional attribute,
211
- it specifies alternative text which is displayed if the output
212
- application is unable to display the image file (see also
213
- <a class="ulink" href="http://htmlhelp.com/feature/art3.htm" target="_top">Use of ALT texts in IMGs</a>). For
214
- example:
215
- </p>
216
- <pre class="literallayout">image:images/logo.png[Company Logo]</pre>
217
- </li>
218
- <li>
219
- The optional <span class="emphasis"><em>title</em></span> attribute provides a title for the image. The
220
- <a class="link" href="macros.html#X49" title="Images">block image macro</a> renders the title alongside the image.
221
- The inline image macro displays the title as a popup “tooltip” in
222
- visual browsers (AsciiDoc HTML outputs only).
223
- </li>
224
- <li>
225
- <p>
226
- The optional <code class="literal">width</code> and <code class="literal">height</code> attributes scale the image size
227
- and can be used in any combination. The units are pixels. The
228
- following example scales the previous example to a height of 32
229
- pixels:
230
- </p>
231
- <pre class="literallayout">image:images/logo.png["Company Logo",height=32]</pre>
232
- </li>
233
- <li>
234
- <p>
235
- The optional <code class="literal">link</code> attribute is used to link the image to an
236
- external document. The following example links a screenshot
237
- thumbnail to a full size version:
238
- </p>
239
- <pre class="literallayout">image:screen-thumbnail.png[height=32,link="screen.png"]</pre>
240
- </li>
241
- <li>
242
- <p>
243
- The optional <code class="literal">scaledwidth</code> attribute is only used in DocBook block
244
- images (specifically for PDF documents). The following example
245
- scales the images to 75% of the available print width:
246
- </p>
247
- <pre class="literallayout">image::images/logo.png[scaledwidth="75%",alt="Company Logo"]</pre>
248
- </li>
249
- <li>
250
- The image <code class="literal">scale</code> attribute sets the DocBook <code class="literal">imagedata</code> element
251
- <code class="literal">scale</code> attribute.
252
- </li>
253
- <li>
254
- <p>
255
- The optional <code class="literal">align</code> attribute is used for horizontal image
256
- alignment. Allowed values are <code class="literal">center</code>, <code class="literal">left</code> and <code class="literal">right</code>. For
257
- example:
258
- </p>
259
- <pre class="literallayout">image::images/tiger.png["Tiger image",align="left"]</pre>
260
- </li>
261
- <li>
262
- The optional <code class="literal">float</code> attribute floats the image <code class="literal">left</code> or <code class="literal">right</code> on
263
- the page (works with HTML outputs only, has no effect on DocBook
264
- outputs). <code class="literal">float</code> and <code class="literal">align</code> attributes are mutually exclusive.
265
- Use the <code class="literal">unfloat::[]</code> block macro to stop floating.
266
- </li>
267
- </ul>
268
- </div>
269
- </div>
270
- <div class="section" lang="en" xml:lang="en">
271
- <div class="titlepage"><div><div><h4 class="title">
272
- <a id="_comment_lines"></a>Comment Lines</h4></div></div></div>
273
- <p>See <a class="link" href="macros.html#X25" title="Comment Lines">comment block macro</a>.</p>
274
- </div>
275
- </div>
276
- <div class="section" lang="en" xml:lang="en">
277
- <div class="titlepage"><div><div><h3 class="title">
278
- <a id="_block_macros"></a>Block Macros</h3></div></div></div>
279
- <p>A Block macro reference must be contained in a single line separated
280
- either side by a blank line or a block delimiter.</p>
281
- <p>Block macros behave just like Inline macros, with the following
282
- differences:</p>
283
- <div class="itemizedlist"><ul type="disc">
284
- <li>
285
- They occur in a block context.
286
- </li>
287
- <li>
288
- The default syntax is <code class="literal">&lt;name&gt;::&lt;target&gt;[&lt;attrlist&gt;]</code> (two
289
- colons, not one).
290
- </li>
291
- <li>
292
- Markup template section names end in <code class="literal">-blockmacro</code> instead of
293
- <code class="literal">-inlinemacro</code>.
294
- </li>
295
- </ul></div>
296
- <div class="section" lang="en" xml:lang="en">
297
- <div class="titlepage"><div><div><h4 class="title">
298
- <a id="_block_identifier"></a>Block Identifier</h4></div></div></div>
299
- <p>The Block Identifier macro sets the <code class="literal">id</code> attribute and has the same
300
- syntax as the <a class="link" href="macros.html#X30" title="anchor">anchor inline macro</a> since it performs
301
- essentially the same function — block templates use the <code class="literal">id</code>
302
- attribute as a block element ID. For example:</p>
303
- <pre class="literallayout">[[X30]]</pre>
304
- <p>This is equivalent to the <code class="literal">[id="X30"]</code> <a class="link" href="attributelist_element.html" title="AttributeList Element">AttributeList element</a>).</p>
305
- </div>
306
- <div class="section" lang="en" xml:lang="en">
307
- <div class="titlepage"><div><div><h4 class="title">
308
- <a id="X49"></a>Images</h4></div></div></div>
309
- <p>The <span class="emphasis"><em>image</em></span> block macro is used to display images in a block context.
310
- The syntax is:</p>
311
- <pre class="literallayout">image::&lt;target&gt;[&lt;attributes&gt;]</pre>
312
- <p>The block <code class="literal">image</code> macro has the same <a class="link" href="macros.html#X55" title="Image macro attributes">macro attributes</a> as it’s
313
- <a class="link" href="macros.html#X9" title="Images">inline image macro</a> counterpart.</p>
314
- <p>Block images can be titled by preceding the <span class="emphasis"><em>image</em></span> macro with a
315
- <span class="emphasis"><em>BlockTitle</em></span>. DocBook toolchains normally number titled block images
316
- and optionally list them in an automatically generated <span class="emphasis"><em>List of
317
- Figures</em></span> backmatter section.</p>
318
- <p>This example:</p>
319
- <pre class="literallayout">.Main circuit board
320
- image::images/layout.png[J14P main circuit board]</pre>
321
- <p>is equivalent to:</p>
322
- <pre class="literallayout">image::images/layout.png["J14P main circuit board",
323
- title="Main circuit board"]</pre>
324
- <p>A title prefix that can be inserted with the <code class="literal">caption</code> attribute
325
- (<code class="literal">xhtml11</code> and <code class="literal">html4</code> backends). For example:</p>
326
- <pre class="literallayout">.Main circuit board
327
- [caption="Figure 2: "]
328
- image::images/layout.png[J14P main circuit board]</pre>
329
- <div class="sidebar">
330
- <a id="X66"></a><p class="title"><b>Embedding images in XHTML documents</b></p>
331
- <p>If you define the <code class="literal">data-uri</code> attribute then images will be embedded in
332
- XHTML outputs using the
333
- <a class="ulink" href="http://en.wikipedia.org/wiki/Data:_URI_scheme" target="_top">data URI scheme</a>. You
334
- can use the <span class="emphasis"><em>data-uri</em></span> attribute with the <span class="emphasis"><em>xhtml11</em></span> backend to produce
335
- single-file XHTML documents with embedded images and CSS, for example:</p>
336
- <pre class="literallayout">$ asciidoc -a data-uri mydocument.txt</pre>
337
- <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
338
- <h3 class="title">Note</h3>
339
- <div class="itemizedlist"><ul type="disc">
340
- <li>
341
- All current popular browsers support data URIs, although versions
342
- of Internet Explorer prior to version 8 do not.
343
- </li>
344
- <li>
345
- Some browsers limit the size of data URIs.
346
- </li>
347
- </ul></div>
348
- </div>
349
- </div>
350
- </div>
351
- <div class="section" lang="en" xml:lang="en">
352
- <div class="titlepage"><div><div><h4 class="title">
353
- <a id="X25"></a>Comment Lines</h4></div></div></div>
354
- <p>Single lines starting with two forward slashes hard up against the
355
- left margin are treated as comments. Comment lines do not appear in
356
- the output unless the <span class="emphasis"><em>showcomments</em></span> attribute is defined. Comment
357
- lines have been implemented as both block and inline macros so a
358
- comment line can appear as a stand-alone block or within block elements
359
- that support inline macro expansion. Example comment line:</p>
360
- <pre class="literallayout">// This is a comment.</pre>
361
- <p>If the <span class="emphasis"><em>showcomments</em></span> attribute is defined comment lines are written
362
- to the output:</p>
363
- <div class="itemizedlist"><ul type="disc">
364
- <li>
365
- In DocBook the comment lines are enclosed by the <span class="emphasis"><em>remark</em></span> element
366
- (which may or may not be rendered by your toolchain).
367
- </li>
368
- <li>
369
- The <span class="emphasis"><em>showcomments</em></span> attribute does not expose <a class="link" href="delimited_blocks.html#X26" title="Comment Blocks">Comment Blocks</a>.
370
- Comment Blocks are never passed to the output.
371
- </li>
372
- </ul></div>
373
- </div>
374
- </div>
375
- <div class="section" lang="en" xml:lang="en">
376
- <div class="titlepage"><div><div><h3 class="title">
377
- <a id="_system_macros"></a>System Macros</h3></div></div></div>
378
- <p>System macros are block macros that perform a predefined task and are
379
- hardwired into the asciidoc(1) program.</p>
380
- <div class="itemizedlist"><ul type="disc">
381
- <li>
382
- You can escape system macros with a leading backslash character
383
- (as you can with other macros).
384
- </li>
385
- <li>
386
- The syntax and tasks performed by system macros is built into
387
- asciidoc(1) so they don’t appear in configuration files. You can
388
- however customize the syntax by adding entries to a configuration
389
- file <code class="literal">[macros]</code> section.
390
- </li>
391
- </ul></div>
392
- <div class="section" lang="en" xml:lang="en">
393
- <div class="titlepage"><div><div><h4 class="title">
394
- <a id="X63"></a>Include Macros</h4></div></div></div>
395
- <p>The <code class="literal">include</code> and <code class="literal">include1</code> system macros to include the contents of
396
- a named file into the source document.</p>
397
- <p>The <code class="literal">include</code> macro includes a file as if it were part of the parent
398
- document — tabs are expanded and system macros processed. The
399
- contents of <code class="literal">include1</code> files are not subject to tab expansion or
400
- system macro processing nor are attribute or lower priority
401
- substitutions performed. The <code class="literal">include1</code> macro’s intended use is to
402
- include verbatim embedded CSS or scripts into configuration file
403
- headers. Example:</p>
404
- <pre class="screen">include::chapter1.txt[tabsize=4]</pre>
405
- <div class="itemizedlist">
406
- <p class="title"><b>Include macro behavior</b></p>
407
- <ul type="disc">
408
- <li>
409
- If the included file name is specified with a relative path then the
410
- path is relative to the location of the referring document.
411
- </li>
412
- <li>
413
- Include macros can appear inside configuration files.
414
- </li>
415
- <li>
416
- Files included from within <span class="emphasis"><em>DelimitedBlocks</em></span> are read to completion
417
- to avoid false end-of-block underline termination.
418
- </li>
419
- <li>
420
- Attribute references are expanded inside the include <span class="emphasis"><em>target</em></span>; if an
421
- attribute is undefined then the included file is silently skipped.
422
- </li>
423
- <li>
424
- The <span class="emphasis"><em>tabsize</em></span> macro attribute sets the number of space characters to
425
- be used for tab expansion in the included file (not applicable to
426
- <code class="literal">include1</code> macro).
427
- </li>
428
- <li>
429
- The <span class="emphasis"><em>depth</em></span> macro attribute sets the maximum permitted number of
430
- subsequent nested includes (not applicable to <code class="literal">include1</code> macro which
431
- does not process nested includes). Setting <span class="emphasis"><em>depth</em></span> to <span class="emphasis"><em>1</em></span> disables
432
- nesting inside the included file. By default, nesting is limited to
433
- a depth of five.
434
- </li>
435
- <li>
436
- Internally the <code class="literal">include1</code> macro is translated to the <code class="literal">include1</code>
437
- system attribute which means it must be evaluated in a region where
438
- attribute substitution is enabled. To inhibit nested substitution in
439
- included files it is preferable to use the <code class="literal">include</code> macro and set
440
- the attribute <code class="literal">depth=1</code>.
441
- </li>
442
- </ul>
443
- </div>
444
- </div>
445
- <div class="section" lang="en" xml:lang="en">
446
- <div class="titlepage"><div><div><h4 class="title">
447
- <a id="_conditional_inclusion_macros"></a>Conditional Inclusion Macros</h4></div></div></div>
448
- <p>Lines of text in the source document can be selectively included or
449
- excluded from processing based on the existence (or not) of a document
450
- attribute.</p>
451
- <p>Document text between the <code class="literal">ifdef</code> and <code class="literal">endif</code> macros is included if a
452
- document attribute is defined:</p>
453
- <pre class="literallayout">ifdef::&lt;attribute&gt;[]
454
- :
455
- endif::&lt;attribute&gt;[]</pre>
456
- <p>Document text between the <code class="literal">ifndef</code> and <code class="literal">endif</code> macros is not included
457
- if a document attribute is defined:</p>
458
- <pre class="literallayout">ifndef::&lt;attribute&gt;[]
459
- :
460
- endif::&lt;attribute&gt;[]</pre>
461
- <p><code class="literal">&lt;attribute&gt;</code> is an attribute name which is optional in the trailing
462
- <code class="literal">endif</code> macro.</p>
463
- <p>If you only want to process a single line of text then the text can be
464
- put inside the square brackets and the <code class="literal">endif</code> macro omitted, for
465
- example:</p>
466
- <pre class="literallayout">ifdef::revnumber[Version number 42]</pre>
467
- <p>Is equivalent to:</p>
468
- <pre class="literallayout">ifdef::revnumber[]
469
- Version number 42
470
- endif::revnumber[]</pre>
471
- <p><span class="emphasis"><em>ifdef</em></span> and <span class="emphasis"><em>ifndef</em></span> macros also accept multiple attribute names:</p>
472
- <div class="itemizedlist"><ul type="disc">
473
- <li>
474
- Multiple <span class="emphasis"><em>,</em></span> separated attribute names evaluate to defined if if one
475
- or more of the attributes is defined, otherwise it’s value is
476
- undefined.
477
- </li>
478
- <li>
479
- Multiple <span class="emphasis"><em>+</em></span> separated attribute names evaluate to defined if if all
480
- of the attributes is defined, otherwise it’s value is undefined.
481
- </li>
482
- </ul></div>
483
- <p>Document text between the <code class="literal">ifeval</code> and <code class="literal">endif</code> macros is included if
484
- the Python expression inside the square brackets is true. Example:</p>
485
- <pre class="literallayout">ifeval::[{rs458}==2]]
486
- :
487
- endif::[]</pre>
488
- <div class="itemizedlist"><ul type="disc">
489
- <li>
490
- Document attribute references are expanded before the expression is
491
- evaluated.
492
- </li>
493
- <li>
494
- If an attribute reference is undefined then the expression is
495
- considered false.
496
- </li>
497
- </ul></div>
498
- <p>Take a look at the <code class="literal">*.conf</code> configuration files in the AsciiDoc
499
- distribution for examples of conditional inclusion macro usage.</p>
500
- </div>
501
- <div class="section" lang="en" xml:lang="en">
502
- <div class="titlepage"><div><div><h4 class="title">
503
- <a id="_executable_system_macros"></a>Executable system macros</h4></div></div></div>
504
- <p>The <span class="emphasis"><em>eval</em></span>, <span class="emphasis"><em>sys</em></span> and <span class="emphasis"><em>sys2</em></span> block macros exhibit the same behavior as
505
- their same named <a class="link" href="attribute_references.html#X24" title="System Attribute References">system attribute references</a>. The difference
506
- is that system macros occur in a block macro context whereas system
507
- attributes are confined to inline contexts where attribute
508
- substitution is enabled.</p>
509
- <p>The following example displays a long directory listing inside a
510
- literal block:</p>
511
- <pre class="literallayout">------------------
512
- sys::[ls -l *.txt]
513
- ------------------</pre>
514
- <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
515
- <h3 class="title">Note</h3>
516
- <p>There are no block macro versions of the <span class="emphasis"><em>eval3</em></span> and <span class="emphasis"><em>sys3</em></span>
517
- system attributes.</p>
518
- </div>
519
- </div>
520
- <div class="section" lang="en" xml:lang="en">
521
- <div class="titlepage"><div><div><h4 class="title">
522
- <a id="_template_system_macro"></a>Template System Macro</h4></div></div></div>
523
- <p>The <code class="literal">template</code> block macro allows the inclusion of one configuration
524
- file template section within another. The following example includes
525
- the <code class="literal">[admonitionblock]</code> section in the <code class="literal">[admonitionparagraph]</code>
526
- section:</p>
527
- <pre class="literallayout">[admonitionparagraph]
528
- template::[admonitionblock]</pre>
529
- <div class="itemizedlist">
530
- <p class="title"><b>Template macro behavior</b></p>
531
- <ul type="disc">
532
- <li>
533
- The <code class="literal">template::[]</code> macro is useful for factoring configuration file
534
- markup.
535
- </li>
536
- <li>
537
- <code class="literal">template::[]</code> macros cannot be nested.
538
- </li>
539
- <li>
540
- <code class="literal">template::[]</code> macro expansion is applied to all sections
541
- after all configuration files have been read.
542
- </li>
543
- </ul>
544
- </div>
545
- </div>
546
- </div>
547
- <div class="section" lang="en" xml:lang="en">
548
- <div class="titlepage"><div><div><h3 class="title">
549
- <a id="X77"></a>Passthrough macros</h3></div></div></div>
550
- <p>Passthrough macros are analogous to <a class="link" href="delimited_blocks.html#X76" title="Passthrough Blocks">passthrough blocks</a> and are
551
- used to pass text directly to the output. The substitution performed
552
- on the text is determined by the macro definition but can be overridden
553
- by the <code class="literal">&lt;subslist&gt;</code>. The usual syntax is
554
- <code class="literal">&lt;name&gt;:&lt;subslist&gt;[&lt;passtext&gt;]</code> (for inline macros) and
555
- <code class="literal">&lt;name&gt;::&lt;subslist&gt;[&lt;passtext&gt;]</code> (for block macros).</p>
556
- <div class="variablelist"><dl>
557
- <dt><span class="term">
558
- pass
559
- </span></dt>
560
- <dd>
561
- <p>
562
- Inline and block. Passes text unmodified (apart from explicitly
563
- specified substitutions). Examples:
564
- </p>
565
- <pre class="literallayout">pass:[&lt;q&gt;To be or not to be&lt;/q&gt;]
566
- pass:attributes,quotes[&lt;u&gt;the '{author}'&lt;/u&gt;]</pre>
567
- </dd>
568
- <dt><span class="term">
569
- asciimath, latexmath
570
- </span></dt>
571
- <dd>
572
- Inline and block. Passes text unmodified. Used for
573
- <a class="link" href="mathematical_formulas.html" title="Mathematical Formulas">mathematical formulas</a>.
574
- </dd>
575
- <dt><span class="term">
576
- +++
577
- </span></dt>
578
- <dd>
579
- <p>
580
- Inline and block. The triple-plus passthrough is functionally
581
- identical to the <span class="emphasis"><em>pass</em></span> macro but you don’t have to escape <code class="literal">]</code>
582
- characters and you can prefix with quoted attributes in the inline
583
- version. Example:
584
- </p>
585
- <pre class="literallayout">Red [red]+++`sum_(i=1)\^n i=(n(n+1))/2`$+++ AsciiMathML formula</pre>
586
- </dd>
587
- <dt><span class="term">
588
- $$
589
- </span></dt>
590
- <dd>
591
- <p>
592
- Inline and block. The double-dollar passthrough is functionally
593
- identical to the triple-plus passthrough with one exception: special
594
- characters are escaped. Example:
595
- </p>
596
- <pre class="literallayout">$$`[[a,b],[c,d]]((n),(k))`$$</pre>
597
- </dd>
598
- <dt><span class="term">
599
- <a id="X80"></a>`
600
- </span></dt>
601
- <dd>
602
- Text quoted with single backtick characters constitutes an <span class="emphasis"><em>inline
603
- literal</em></span> passthrough. The enclosed text is rendered in a monospaced
604
- font and is only subject to special character substitution. This
605
- makes sense since monospace text is usually intended to be rendered
606
- literally and often contains characters that would otherwise have to
607
- be escaped. If you need monospaced text containing inline
608
- substitutions use a <a class="link" href="text_formatting.html#X81">plus character instead of a backtick</a>.
609
- </dd>
610
- </dl></div>
611
- </div>
612
- <div class="section" lang="en" xml:lang="en">
613
- <div class="titlepage"><div><div><h3 class="title">
614
- <a id="_macro_definitions"></a>Macro Definitions</h3></div></div></div>
615
- <p>Each entry in the configuration <code class="literal">[macros]</code> section is a macro
616
- definition which can take one of the following forms:</p>
617
- <div class="variablelist"><dl>
618
- <dt><span class="term">
619
- <code class="literal">&lt;pattern&gt;=&lt;name&gt;[&lt;subslist]</code>
620
- </span></dt>
621
- <dd>
622
- Inline macro definition.
623
- </dd>
624
- <dt><span class="term">
625
- <code class="literal">&lt;pattern&gt;=#&lt;name&gt;[&lt;subslist]</code>
626
- </span></dt>
627
- <dd>
628
- Block macro definition.
629
- </dd>
630
- <dt><span class="term">
631
- <code class="literal">&lt;pattern&gt;=+&lt;name&gt;[&lt;subslist]</code>
632
- </span></dt>
633
- <dd>
634
- System macro definition.
635
- </dd>
636
- <dt><span class="term">
637
- <code class="literal">&lt;pattern&gt;</code>
638
- </span></dt>
639
- <dd>
640
- Delete the existing macro with this <code class="literal">&lt;pattern&gt;</code>.
641
- </dd>
642
- </dl></div>
643
- <p><code class="literal">&lt;pattern&gt;</code> is a Python regular expression and <code class="literal">&lt;name&gt;</code> is the name of
644
- a markup template. If <code class="literal">&lt;name&gt;</code> is omitted then it is the value of the
645
- regular expression match group named <span class="emphasis"><em>name</em></span>. The optional
646
- <code class="literal">[&lt;subslist]</code> is a comma-separated list of substitution names enclosed
647
- in <code class="literal">[]</code> brackets, it sets the default substitutions for passthrough
648
- text, if omitted then no passthrough substitutions are performed.</p>
649
- <p><b>Pattern named groups. </b>The following named groups can be used in macro <code class="literal">&lt;pattern&gt;</code> regular
650
- expressions and are available as markup template attributes:</p>
651
- <div class="variablelist"><dl>
652
- <dt><span class="term">
653
- name
654
- </span></dt>
655
- <dd>
656
- The macro name.
657
- </dd>
658
- <dt><span class="term">
659
- target
660
- </span></dt>
661
- <dd>
662
- The macro target.
663
- </dd>
664
- <dt><span class="term">
665
- attrlist
666
- </span></dt>
667
- <dd>
668
- The macro attribute list.
669
- </dd>
670
- <dt><span class="term">
671
- passtext
672
- </span></dt>
673
- <dd>
674
- Contents of this group are passed unmodified to the output subject
675
- only to <span class="emphasis"><em>subslist</em></span> substitutions.
676
- </dd>
677
- <dt><span class="term">
678
- subslist
679
- </span></dt>
680
- <dd>
681
- Processed as a comma-separated list of substitution names for
682
- <span class="emphasis"><em>passtext</em></span> substitution, overrides the the macro definition
683
- <span class="emphasis"><em>subslist</em></span>.
684
- </dd>
685
- </dl></div>
686
- <div class="itemizedlist">
687
- <p class="title"><b>Here’s what happens during macro substitution</b></p>
688
- <ul type="disc">
689
- <li>
690
- Each contextually relevant macro <span class="emphasis"><em>pattern</em></span> from the <code class="literal">[macros]</code>
691
- section is matched against the input source line.
692
- </li>
693
- <li>
694
- If a match is found the text to be substituted is loaded from a
695
- configuration markup template section named like
696
- <code class="literal">&lt;name&gt;-inlinemacro</code> or <code class="literal">&lt;name&gt;-blockmacro</code> (depending on the macro
697
- type).
698
- </li>
699
- <li>
700
- Global and macro attribute list attributes are substituted in the
701
- macro’s markup template.
702
- </li>
703
- <li>
704
- The substituted template replaces the macro reference in the output
705
- document.
706
- </li>
707
- </ul>
708
- </div>
709
- </div>
710
- </div>
711
-
712
- </div>
713
-
714
- <hr/>
715
-
716
- <div class="nav" id="navfooter">
717
- <table width="100%">
718
- <tr><td width="33%" align="left">
719
-
720
- <a href="callouts.html">Prev</a><br/>
721
- Callouts
722
-
723
- </td><td width="33%" align="center">
724
-
725
- <a href="index.html">Home</a><br/>
726
- AsciiDoc User Guide
727
-
728
- </td><td width="33%" align="right">
729
-
730
- <a href="tables.html">Next</a><br/>
731
- Tables
732
-
733
- </td></tr>
734
- </table>
735
- </div>
736
- </body>
737
- </html>