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,22 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
- <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Footnotes</title><link rel="stylesheet" href="stylesheets/handbookish.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.1" /><link rel="home" href="index.html" title="AsciiDoc User Guide" /><link rel="up" href="index.html" title="AsciiDoc User Guide" /><link rel="prev" href="ar01s14.html" title="Lists" /><link rel="next" href="ar01s16.html" title="Indexes" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Footnotes</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ar01s14.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ar01s16.html">Next</a></td></tr></table><hr /></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="X92"></a>Footnotes</h2></div></div></div><p>The shipped AsciiDoc configuration includes three footnote inline
4
- macros:</p><div class="variablelist"><dl><dt><span class="term">
5
- <code class="literal">footnote:[&lt;text&gt;]</code>
6
- </span></dt><dd>
7
- Generates a footnote with text <code class="literal">&lt;text&gt;</code>.
8
- </dd><dt><span class="term">
9
- <code class="literal">footnoteref:[&lt;id&gt;,&lt;text&gt;]</code>
10
- </span></dt><dd>
11
- Generates a footnote with a reference ID <code class="literal">&lt;id&gt;</code> and text <code class="literal">&lt;text&gt;</code>.
12
- </dd><dt><span class="term">
13
- <code class="literal">footnoteref:[&lt;id&gt;]</code>
14
- </span></dt><dd>
15
- Generates a reference to the footnote with ID <code class="literal">&lt;id&gt;</code>.
16
- </dd></dl></div><p>The footnote text can span multiple lines.</p><p>The <span class="emphasis"><em>xhtml11</em></span> backend renders footnotes dynamically using JavaScript;
17
- <span class="emphasis"><em>html4</em></span> outputs do not use JavaScript and leave the footnotes inline;
18
- <span class="emphasis"><em>docbook</em></span> footnotes are processed by the downstream DocBook toolchain.</p><p>Example footnotes:</p><pre class="literallayout">A footnote footnote:[An example footnote.];
19
- a second footnote with a reference ID footnoteref:[note2,Second footnote.];
20
- finally a reference to the second footnote footnoteref:[note2].</pre><p>Renders:</p><p>A footnote <sup>[<a id="id36119067" href="#ftn.id36119067" class="footnote">2</a>]</sup>;
21
- a second footnote with a reference ID <sup>[<a id="note2" href="#ftn.note2" class="footnote">3</a>]</sup>;
22
- finally a reference to the second footnote <sup>[<a href="ar01s15.html#ftn.note2" class="footnoteref">3</a>]</sup>.</p><div class="footnotes"><br /><hr width="100" align="left" /><div class="footnote"><p><sup>[<a id="ftn.id36119067" href="#id36119067" class="simpara">2</a>] </sup>An example footnote.</p></div><div class="footnote"><p><sup>[<a id="ftn.note2" href="#note2" class="simpara">3</a>] </sup>Second footnote.</p></div></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ar01s14.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ar01s16.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Lists </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Indexes</td></tr></table></div></body></html>
@@ -1,27 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
- <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Indexes</title><link rel="stylesheet" href="stylesheets/handbookish.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.1" /><link rel="home" href="index.html" title="AsciiDoc User Guide" /><link rel="up" href="index.html" title="AsciiDoc User Guide" /><link rel="prev" href="ar01s15.html" title="Footnotes" /><link rel="next" href="ar01s17.html" title="Callouts" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Indexes</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ar01s15.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ar01s17.html">Next</a></td></tr></table><hr /></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_indexes"></a>Indexes</h2></div></div></div><p>The shipped AsciiDoc configuration includes the inline macros for
4
- generating DocBook index entries.</p><div class="variablelist"><dl><dt><span class="term">
5
- <code class="literal">indexterm:[&lt;primary&gt;,&lt;secondary&gt;,&lt;tertiary&gt;]</code>
6
- , </span><span class="term">
7
- <code class="literal">(((&lt;primary&gt;,&lt;secondary&gt;,&lt;tertiary&gt;)))</code>
8
- </span></dt><dd>
9
- This inline macro generates an index term (the <code class="literal">&lt;secondary&gt;</code> and
10
- <code class="literal">&lt;tertiary&gt;</code> positional attributes are optional). Example:
11
- <code class="literal">indexterm:[Tigers,Big cats]</code> (or, using the alternative syntax
12
- <code class="literal">(((Tigers,Big cats)))</code>. Index terms that have secondary and
13
- tertiary entries also generate separate index terms for the
14
- secondary and tertiary entries. The index terms appear in the
15
- index, not the primary text flow.
16
- </dd><dt><span class="term">
17
- <code class="literal">indexterm2:[&lt;primary&gt;]</code>
18
- , </span><span class="term">
19
- <code class="literal">((&lt;primary&gt;))</code>
20
- </span></dt><dd>
21
- This inline macro generates an index term that appears in both the
22
- index and the primary text flow. The <code class="literal">&lt;primary&gt;</code> should not be
23
- padded to the left or right with white space characters.
24
- </dd></dl></div><p>For working examples see the <code class="literal">article.txt</code> and <code class="literal">book.txt</code> documents in
25
- the AsciiDoc <code class="literal">./doc</code> distribution directory.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Index entries only really make sense if you are generating
26
- DocBook markup — DocBook conversion programs automatically generate
27
- an index at the point an <span class="emphasis"><em>Index</em></span> section appears in source document.</p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ar01s15.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ar01s17.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Footnotes </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Callouts</td></tr></table></div></body></html>
@@ -1,94 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
- <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Callouts</title><link rel="stylesheet" href="stylesheets/handbookish.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.1" /><link rel="home" href="index.html" title="AsciiDoc User Guide" /><link rel="up" href="index.html" title="AsciiDoc User Guide" /><link rel="prev" href="ar01s16.html" title="Indexes" /><link rel="next" href="ar01s18.html" title="Macros" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Callouts</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ar01s16.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ar01s18.html">Next</a></td></tr></table><hr /></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_callouts"></a>Callouts</h2></div></div></div><p>Callouts are a mechanism for annotating verbatim text (for example:
4
- source code, computer output and user input). Callout markers are
5
- placed inside the annotated text while the actual annotations are
6
- presented in a callout list after the annotated text. Here’s an
7
- example:</p><pre class="screen"> .MS-DOS directory listing
8
- -----------------------------------------------------
9
- 10/17/97 9:04 &lt;DIR&gt; bin
10
- 10/16/97 14:11 &lt;DIR&gt; DOS &lt;1&gt;
11
- 10/16/97 14:40 &lt;DIR&gt; Program Files
12
- 10/16/97 14:46 &lt;DIR&gt; TEMP
13
- 10/17/97 9:04 &lt;DIR&gt; tmp
14
- 10/16/97 14:37 &lt;DIR&gt; WINNT
15
- 10/16/97 14:25 119 AUTOEXEC.BAT &lt;2&gt;
16
- 2/13/94 6:21 54,619 COMMAND.COM &lt;2&gt;
17
- 10/16/97 14:25 115 CONFIG.SYS &lt;2&gt;
18
- 11/16/97 17:17 61,865,984 pagefile.sys
19
- 2/13/94 6:21 9,349 WINA20.386 &lt;3&gt;
20
- -----------------------------------------------------
21
-
22
- &lt;1&gt; This directory holds MS-DOS.
23
- &lt;2&gt; System startup code for DOS.
24
- &lt;3&gt; Some sort of Windows 3.1 hack.</pre><p>Which renders:</p><p><b>MS-DOS directory listing. </b>
25
- </p><pre class="screen">10/17/97 9:04 &lt;DIR&gt; bin
26
- 10/16/97 14:11 &lt;DIR&gt; DOS <a id="CO1-1"></a><img src="images/callouts/1.png" alt="1" border="0" />
27
- 10/16/97 14:40 &lt;DIR&gt; Program Files
28
- 10/16/97 14:46 &lt;DIR&gt; TEMP
29
- 10/17/97 9:04 &lt;DIR&gt; tmp
30
- 10/16/97 14:37 &lt;DIR&gt; WINNT
31
- 10/16/97 14:25 119 AUTOEXEC.BAT <a id="CO1-2"></a><img src="images/callouts/2.png" alt="2" border="0" />
32
- 2/13/94 6:21 54,619 COMMAND.COM <a id="CO1-3"></a><img src="images/callouts/3.png" alt="3" border="0" />
33
- 10/16/97 14:25 115 CONFIG.SYS <a id="CO1-4"></a><img src="images/callouts/4.png" alt="4" border="0" />
34
- 11/16/97 17:17 61,865,984 pagefile.sys
35
- 2/13/94 6:21 9,349 WINA20.386 <a id="CO1-5"></a><img src="images/callouts/5.png" alt="5" border="0" /></pre><p>
36
- </p><div class="calloutlist"><table border="0" summary="Callout list"><tr><td width="5%" valign="top" align="left"><p><a href="#CO1-1"><img src="images/callouts/1.png" alt="1" border="0" /></a> </p></td><td valign="top" align="left">
37
- This directory holds MS-DOS.
38
- </td></tr><tr><td width="5%" valign="top" align="left"><p><a href="#CO1-2"><img src="images/callouts/2.png" alt="2" border="0" /></a> <a href="#CO1-3"><img src="images/callouts/3.png" alt="3" border="0" /></a> <a href="#CO1-4"><img src="images/callouts/4.png" alt="4" border="0" /></a> </p></td><td valign="top" align="left">
39
- System startup code for DOS.
40
- </td></tr><tr><td width="5%" valign="top" align="left"><p><a href="#CO1-5"><img src="images/callouts/5.png" alt="5" border="0" /></a> </p></td><td valign="top" align="left">
41
- Some sort of Windows 3.1 hack.
42
- </td></tr></table></div><div class="itemizedlist"><p class="title"><b>Explanation</b></p><ul type="disc"><li>
43
- The callout marks are whole numbers enclosed in angle brackets —  they refer to the correspondingly numbered item in the following
44
- callout list.
45
- </li><li>
46
- By default callout marks are confined to <span class="emphasis"><em>LiteralParagraphs</em></span>,
47
- <span class="emphasis"><em>LiteralBlocks</em></span> and <span class="emphasis"><em>ListingBlocks</em></span> (although this is a
48
- configuration file option and can be changed).
49
- </li><li>
50
- Callout list item numbering is fairly relaxed — list items can
51
- start with <code class="literal">&lt;n&gt;</code>, <code class="literal">n&gt;</code> or <code class="literal">&gt;</code> where <code class="literal">n</code> is the optional list item
52
- number (in the latter case list items starting with a single <code class="literal">&gt;</code>
53
- character are implicitly numbered starting at one).
54
- </li><li>
55
- Callout lists should not be nested.
56
- </li><li>
57
- Callout lists start list items hard against the left margin.
58
- </li><li>
59
- If you want to present a number inside angle brackets you’ll need to
60
- escape it with a backslash to prevent it being interpreted as a
61
- callout mark.
62
- </li></ul></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Define the AsciiDoc <span class="emphasis"><em>icons</em></span> attribute (for example using the <code class="literal">-a
63
- icons</code> command-line option) to display callout icons.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="_implementation_notes"></a>Implementation Notes</h3></div></div></div><p>Callout marks are generated by the <span class="emphasis"><em>callout</em></span> inline macro while
64
- callout lists are generated using the <span class="emphasis"><em>callout</em></span> list definition. The
65
- <span class="emphasis"><em>callout</em></span> macro and <span class="emphasis"><em>callout</em></span> list are special in that they work
66
- together. The <span class="emphasis"><em>callout</em></span> inline macro is not enabled by the normal
67
- <span class="emphasis"><em>macros</em></span> substitutions option, instead it has its own <span class="emphasis"><em>callouts</em></span>
68
- substitution option.</p><p>The following attributes are available during inline callout macro
69
- substitution:</p><div class="variablelist"><dl><dt><span class="term">
70
- <code class="literal">{index}</code>
71
- </span></dt><dd>
72
- The callout list item index inside the angle brackets.
73
- </dd><dt><span class="term">
74
- <code class="literal">{coid}</code>
75
- </span></dt><dd>
76
- An identifier formatted like <code class="literal">CO&lt;listnumber&gt;-&lt;index&gt;</code> that
77
- uniquely identifies the callout mark. For example <code class="literal">CO2-4</code>
78
- identifies the fourth callout mark in the second set of callout
79
- marks.
80
- </dd></dl></div><p>The <code class="literal">{coids}</code> attribute can be used during callout list item
81
- substitution — it is a space delimited list of callout IDs that refer
82
- to the explanatory list item.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="_including_callouts_in_included_code"></a>Including callouts in included code</h3></div></div></div><p>You can annotate working code examples with callouts — just remember
83
- to put the callouts inside source code comments. This example displays
84
- the <code class="literal">test.py</code> source file (containing a single callout) using the
85
- <a class="link" href="ar01s29.html#X57" title="Source Code Highlighter Filter">Source Code Highlighter Filter</a>:</p><p><b>AsciiDoc source. </b>
86
- </p><pre class="screen"> [source,python]
87
- -------------------------------------------
88
- \include::test.py[]
89
- -------------------------------------------
90
-
91
- &lt;1&gt; Print statement.</pre><p>
92
- </p><p><b>Included <code class="literal">test.py</code> source. </b>
93
- </p><pre class="screen">print 'Hello World!' # &lt;1&gt;</pre><p>
94
- </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ar01s16.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ar01s18.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Indexes </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Macros</td></tr></table></div></body></html>
@@ -1,359 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
- <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Macros</title><link rel="stylesheet" href="stylesheets/handbookish.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.1" /><link rel="home" href="index.html" title="AsciiDoc User Guide" /><link rel="up" href="index.html" title="AsciiDoc User Guide" /><link rel="prev" href="ar01s17.html" title="Callouts" /><link rel="next" href="ar01s19.html" title="Tables" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Macros</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ar01s17.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ar01s19.html">Next</a></td></tr></table><hr /></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_macros"></a>Macros</h2></div></div></div><p>Macros are a mechanism for substituting parametrized text into output
4
- documents.</p><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
5
- list</em></span>. The usual syntax is <code class="literal">&lt;name&gt;:&lt;target&gt;[&lt;attrlist&gt;]</code> (for
6
- inline macros) and <code class="literal">&lt;name&gt;::&lt;target&gt;[&lt;attrlist&gt;]</code> (for block
7
- macros). Here are some examples:</p><pre class="literallayout">http://www.docbook.org/[DocBook.org]
8
- include::chapt1.txt[tabsize=2]
9
- mailto:srackham@gmail.com[]</pre><div class="itemizedlist"><p class="title"><b>Macro behavior</b></p><ul type="disc"><li>
10
- <code class="literal">&lt;name&gt;</code> is the macro name. It can only contain letters, digits or
11
- dash characters and cannot start with a dash.
12
- </li><li>
13
- The optional <code class="literal">&lt;target&gt;</code> cannot contain white space characters.
14
- </li><li>
15
- <code class="literal">&lt;attrlist&gt;</code> is a <a class="link" href="ar01s25.html" title="Attribute Lists">list of attributes</a> enclosed in square
16
- brackets.
17
- </li><li>
18
- <code class="literal">]</code> characters inside attribute lists must be escaped with a
19
- backslash.
20
- </li><li>
21
- Expansion of macro references can normally be escaped by prefixing a
22
- backslash character (see the AsciiDoc <span class="emphasis"><em>FAQ</em></span> for examples of
23
- exceptions to this rule).
24
- </li><li>
25
- Attribute references in block macros are expanded.
26
- </li><li>
27
- The substitutions performed prior to Inline macro macro expansion
28
- are determined by the inline context.
29
- </li><li>
30
- Macros are processed in the order they appear in the configuration
31
- file(s).
32
- </li><li>
33
- Calls to inline macros can be nested inside different inline macros
34
- (an inline macro call cannot contain a nested call to itself).
35
- </li><li>
36
- 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
37
- <code class="literal">&lt;passtext&gt;</code> and <code class="literal">&lt;subslist&gt;</code> named groups are available to
38
- <a class="link" href="ar01s18.html#X77" title="Passthrough macros">passthrough macros</a>. A macro is a passthrough macro if the
39
- definition includes a <code class="literal">&lt;passtext&gt;</code> named group.
40
- </li></ul></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="_inline_macros"></a>Inline Macros</h3></div></div></div><p>Inline Macros occur in an inline element context. Predefined Inline
41
- 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><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="_urls"></a>URLs</h4></div></div></div><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
42
- rendered using predefined inline macros.</p><div class="itemizedlist"><ul type="disc"><li>
43
- If you don’t need a custom link caption you can enter the <span class="emphasis"><em>http</em></span>,
44
- <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
45
- macro syntax.
46
- </li><li>
47
- If the <code class="literal">&lt;attrlist&gt;</code> is empty the URL is displayed.
48
- </li></ul></div><p>Here are some examples:</p><pre class="literallayout">http://www.docbook.org/[DocBook.org]
49
- http://www.docbook.org/
50
- mailto:joe.bloggs@foobar.com[email Joe Bloggs]
51
- joe.bloggs@foobar.com</pre><p>Which are rendered:</p><p><a class="ulink" href="http://www.docbook.org/" target="_top">DocBook.org</a></p><p><a class="ulink" href="http://www.docbook.org/" target="_top">http://www.docbook.org/</a></p><p><a class="ulink" href="mailto:joe.bloggs@foobar.com" target="_top">email Joe Bloggs</a></p><p><a class="ulink" href="mailto:joe.bloggs@foobar.com" target="_top">joe.bloggs@foobar.com</a></p><p>If the <code class="literal">&lt;target&gt;</code> necessitates space characters use <code class="literal">%20</code>, for example
52
- <code class="literal">large%20image.png</code>.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="_internal_cross_references"></a>Internal Cross References</h4></div></div></div><p>Two AsciiDoc inline macros are provided for creating hypertext links
53
- within an AsciiDoc document. You can use either the standard macro
54
- syntax or the (preferred) alternative.</p><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h5 class="title"><a id="X30"></a>anchor</h5></div></div></div><p>Used to specify hypertext link targets:</p><pre class="literallayout">[[&lt;id&gt;,&lt;xreflabel&gt;]]
55
- anchor:&lt;id&gt;[&lt;xreflabel&gt;]</pre><p>The <code class="literal">&lt;id&gt;</code> is a unique string that conforms to the output markup’s
56
- anchor syntax. The optional <code class="literal">&lt;xreflabel&gt;</code> is the text to be displayed
57
- by captionless <span class="emphasis"><em>xref</em></span> macros that refer to this anchor. The optional
58
- <code class="literal">&lt;xreflabel&gt;</code> is only really useful when generating DocBook output.
59
- Example anchor:</p><pre class="literallayout">[[X1]]</pre><p>You may have noticed that the syntax of this inline element is the
60
- same as that of the <a class="link" href="ar01s10.html" title="BlockId Element">BlockId block element</a>, this is no
61
- coincidence since they are functionally equivalent.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h5 class="title"><a id="_xref"></a>xref</h5></div></div></div><p>Creates a hypertext link to a document anchor.</p><pre class="literallayout">&lt;&lt;&lt;id&gt;,&lt;caption&gt;&gt;&gt;
62
- xref:&lt;id&gt;[&lt;caption&gt;]</pre><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
63
- link’s displayed text. Example:</p><pre class="literallayout">&lt;&lt;X21,attribute lists&gt;&gt;</pre><p>If <code class="literal">&lt;caption&gt;</code> is not specified then the displayed text is
64
- auto-generated:</p><div class="itemizedlist"><ul type="disc"><li>
65
- The AsciiDoc <code class="literal">xhtml11</code> backend displays the <code class="literal">&lt;id&gt;</code> enclosed in
66
- square brackets.
67
- </li><li>
68
- If DocBook is produced the DocBook toolchain is responsible for the
69
- displayed text which will normally be the referenced figure, table
70
- or section title number followed by the element’s title text.
71
- </li></ul></div><p>Here is an example:</p><pre class="screen">[[tiger_image]]
72
- .Tyger tyger
73
- image::tiger.png[]
74
-
75
- This can be seen in &lt;&lt;tiger_image&gt;&gt;.</pre></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="_linking_to_local_documents"></a>Linking to Local Documents</h4></div></div></div><p>Hypertext links to files on the local file system are specified using
76
- the <span class="emphasis"><em>link</em></span> inline macro.</p><pre class="literallayout">link:&lt;target&gt;[&lt;caption&gt;]</pre><p>The <span class="emphasis"><em>link</em></span> macro generates relative URLs. The link macro <code class="literal">&lt;target&gt;</code> is
77
- the target file name (relative to the file system location of the
78
- referring document). The optional <code class="literal">&lt;caption&gt;</code> is the link’s displayed
79
- text. If <code class="literal">&lt;caption&gt;</code> is not specified then <code class="literal">&lt;target&gt;</code> is displayed.
80
- Example:</p><pre class="literallayout">link:downloads/foo.zip[download foo.zip]</pre><p>You can use the <code class="literal">&lt;filename&gt;#&lt;id&gt;</code> syntax to refer to an anchor within
81
- a target document but this usually only makes sense when targeting
82
- HTML documents.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="X9"></a>Images</h4></div></div></div><p>Inline images are inserted into the output document using the <span class="emphasis"><em>image</em></span>
83
- macro. The inline syntax is:</p><pre class="literallayout">image:&lt;target&gt;[&lt;attributes&gt;]</pre><p>The contents of the image file <code class="literal">&lt;target&gt;</code> is displayed. To display the
84
- image its file format must be supported by the target backend
85
- application. HTML and DocBook applications normally support PNG or JPG
86
- files.</p><p><code class="literal">&lt;target&gt;</code> file name paths are relative to the location of the
87
- referring document.</p><div class="itemizedlist"><a id="X55"></a><p class="title"><b>Image macro attributes</b></p><ul type="disc"><li><p>
88
- The optional <span class="emphasis"><em>alt</em></span> attribute is also the first positional attribute,
89
- it specifies alternative text which is displayed if the output
90
- application is unable to display the image file (see also
91
- <a class="ulink" href="http://htmlhelp.com/feature/art3.htm" target="_top">Use of ALT texts in IMGs</a>). For
92
- example:
93
- </p><pre class="literallayout">image:images/logo.png[Company Logo]</pre></li><li>
94
- The optional <span class="emphasis"><em>title</em></span> attribute provides a title for the image. The
95
- <a class="link" href="ar01s18.html#X49" title="Images">block image macro</a> renders the title alongside the image.
96
- The inline image macro displays the title as a popup “tooltip” in
97
- visual browsers (AsciiDoc HTML outputs only).
98
- </li><li><p>
99
- The optional <code class="literal">width</code> and <code class="literal">height</code> attributes scale the image size
100
- and can be used in any combination. The units are pixels. The
101
- following example scales the previous example to a height of 32
102
- pixels:
103
- </p><pre class="literallayout">image:images/logo.png["Company Logo",height=32]</pre></li><li><p>
104
- The optional <code class="literal">link</code> attribute is used to link the image to an
105
- external document. The following example links a screenshot
106
- thumbnail to a full size version:
107
- </p><pre class="literallayout">image:screen-thumbnail.png[height=32,link="screen.png"]</pre></li><li><p>
108
- The optional <code class="literal">scaledwidth</code> attribute is only used in DocBook block
109
- images (specifically for PDF documents). The following example
110
- scales the images to 75% of the available print width:
111
- </p><pre class="literallayout">image::images/logo.png[scaledwidth="75%",alt="Company Logo"]</pre></li><li>
112
- The image <code class="literal">scale</code> attribute sets the DocBook <code class="literal">imagedata</code> element
113
- <code class="literal">scale</code> attribute.
114
- </li><li><p>
115
- The optional <code class="literal">align</code> attribute is used for horizontal image
116
- alignment. Allowed values are <code class="literal">center</code>, <code class="literal">left</code> and <code class="literal">right</code>. For
117
- example:
118
- </p><pre class="literallayout">image::images/tiger.png["Tiger image",align="left"]</pre></li><li>
119
- The optional <code class="literal">float</code> attribute floats the image <code class="literal">left</code> or <code class="literal">right</code> on
120
- the page (works with HTML outputs only, has no effect on DocBook
121
- outputs). <code class="literal">float</code> and <code class="literal">align</code> attributes are mutually exclusive.
122
- Use the <code class="literal">unfloat::[]</code> block macro to stop floating.
123
- </li></ul></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="_comment_lines"></a>Comment Lines</h4></div></div></div><p>See <a class="link" href="ar01s18.html#X25" title="Comment Lines">comment block macro</a>.</p></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="_block_macros"></a>Block Macros</h3></div></div></div><p>A Block macro reference must be contained in a single line separated
124
- either side by a blank line or a block delimiter.</p><p>Block macros behave just like Inline macros, with the following
125
- differences:</p><div class="itemizedlist"><ul type="disc"><li>
126
- They occur in a block context.
127
- </li><li>
128
- The default syntax is <code class="literal">&lt;name&gt;::&lt;target&gt;[&lt;attrlist&gt;]</code> (two
129
- colons, not one).
130
- </li><li>
131
- Markup template section names end in <code class="literal">-blockmacro</code> instead of
132
- <code class="literal">-inlinemacro</code>.
133
- </li></ul></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="_block_identifier"></a>Block Identifier</h4></div></div></div><p>The Block Identifier macro sets the <code class="literal">id</code> attribute and has the same
134
- syntax as the <a class="link" href="ar01s18.html#X30" title="anchor">anchor inline macro</a> since it performs
135
- essentially the same function — block templates use the <code class="literal">id</code>
136
- attribute as a block element ID. For example:</p><pre class="literallayout">[[X30]]</pre><p>This is equivalent to the <code class="literal">[id="X30"]</code> <a class="link" href="ar01s11.html" title="AttributeList Element">AttributeList element</a>).</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="X49"></a>Images</h4></div></div></div><p>The <span class="emphasis"><em>image</em></span> block macro is used to display images in a block context.
137
- The syntax is:</p><pre class="literallayout">image::&lt;target&gt;[&lt;attributes&gt;]</pre><p>The block <code class="literal">image</code> macro has the same <a class="link" href="ar01s18.html#X55" title="Image macro attributes">macro attributes</a> as it’s
138
- <a class="link" href="ar01s18.html#X9" title="Images">inline image macro</a> counterpart.</p><p>Block images can be titled by preceding the <span class="emphasis"><em>image</em></span> macro with a
139
- <span class="emphasis"><em>BlockTitle</em></span>. DocBook toolchains normally number titled block images
140
- and optionally list them in an automatically generated <span class="emphasis"><em>List of
141
- Figures</em></span> backmatter section.</p><p>This example:</p><pre class="literallayout">.Main circuit board
142
- image::images/layout.png[J14P main circuit board]</pre><p>is equivalent to:</p><pre class="literallayout">image::images/layout.png["J14P main circuit board",
143
- title="Main circuit board"]</pre><p>A title prefix that can be inserted with the <code class="literal">caption</code> attribute
144
- (<code class="literal">xhtml11</code> and <code class="literal">html4</code> backends). For example:</p><pre class="literallayout">.Main circuit board
145
- [caption="Figure 2: "]
146
- image::images/layout.png[J14P main circuit board]</pre><div class="sidebar"><a id="X66"></a><p class="title"><b>Embedding images in XHTML documents</b></p><p>If you define the <code class="literal">data-uri</code> attribute then images will be embedded in
147
- XHTML outputs using the
148
- <a class="ulink" href="http://en.wikipedia.org/wiki/Data:_URI_scheme" target="_top">data URI scheme</a>. You
149
- can use the <span class="emphasis"><em>data-uri</em></span> attribute with the <span class="emphasis"><em>xhtml11</em></span> backend to produce
150
- single-file XHTML documents with embedded images and CSS, for example:</p><pre class="literallayout">$ asciidoc -a data-uri mydocument.txt</pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><div class="itemizedlist"><ul type="disc"><li>
151
- All current popular browsers support data URIs, although versions
152
- of Internet Explorer prior to version 8 do not.
153
- </li><li>
154
- Some browsers limit the size of data URIs.
155
- </li></ul></div></div></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="X25"></a>Comment Lines</h4></div></div></div><p>Single lines starting with two forward slashes hard up against the
156
- left margin are treated as comments. Comment lines do not appear in
157
- the output unless the <span class="emphasis"><em>showcomments</em></span> attribute is defined. Comment
158
- lines have been implemented as both block and inline macros so a
159
- comment line can appear as a stand-alone block or within block elements
160
- that support inline macro expansion. Example comment line:</p><pre class="literallayout">// This is a comment.</pre><p>If the <span class="emphasis"><em>showcomments</em></span> attribute is defined comment lines are written
161
- to the output:</p><div class="itemizedlist"><ul type="disc"><li>
162
- In DocBook the comment lines are enclosed by the <span class="emphasis"><em>remark</em></span> element
163
- (which may or may not be rendered by your toolchain).
164
- </li><li>
165
- The <span class="emphasis"><em>showcomments</em></span> attribute does not expose <a class="link" href="ar01s13.html#X26" title="Comment Blocks">Comment Blocks</a>.
166
- Comment Blocks are never passed to the output.
167
- </li></ul></div></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="_system_macros"></a>System Macros</h3></div></div></div><p>System macros are block macros that perform a predefined task and are
168
- hardwired into the asciidoc(1) program.</p><div class="itemizedlist"><ul type="disc"><li>
169
- You can escape system macros with a leading backslash character
170
- (as you can with other macros).
171
- </li><li>
172
- The syntax and tasks performed by system macros is built into
173
- asciidoc(1) so they don’t appear in configuration files. You can
174
- however customize the syntax by adding entries to a configuration
175
- file <code class="literal">[macros]</code> section.
176
- </li></ul></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="X63"></a>Include Macros</h4></div></div></div><p>The <code class="literal">include</code> and <code class="literal">include1</code> system macros to include the contents of
177
- a named file into the source document.</p><p>The <code class="literal">include</code> macro includes a file as if it were part of the parent
178
- document — tabs are expanded and system macros processed. The
179
- contents of <code class="literal">include1</code> files are not subject to tab expansion or
180
- system macro processing nor are attribute or lower priority
181
- substitutions performed. The <code class="literal">include1</code> macro’s intended use is to
182
- include verbatim embedded CSS or scripts into configuration file
183
- headers. Example:</p><pre class="screen">include::chapter1.txt[tabsize=4]</pre><div class="itemizedlist"><p class="title"><b>Include macro behavior</b></p><ul type="disc"><li>
184
- If the included file name is specified with a relative path then the
185
- path is relative to the location of the referring document.
186
- </li><li>
187
- Include macros can appear inside configuration files.
188
- </li><li>
189
- Files included from within <span class="emphasis"><em>DelimitedBlocks</em></span> are read to completion
190
- to avoid false end-of-block underline termination.
191
- </li><li>
192
- Attribute references are expanded inside the include <span class="emphasis"><em>target</em></span>; if an
193
- attribute is undefined then the included file is silently skipped.
194
- </li><li>
195
- The <span class="emphasis"><em>tabsize</em></span> macro attribute sets the number of space characters to
196
- be used for tab expansion in the included file (not applicable to
197
- <code class="literal">include1</code> macro).
198
- </li><li>
199
- The <span class="emphasis"><em>depth</em></span> macro attribute sets the maximum permitted number of
200
- subsequent nested includes (not applicable to <code class="literal">include1</code> macro which
201
- does not process nested includes). Setting <span class="emphasis"><em>depth</em></span> to <span class="emphasis"><em>1</em></span> disables
202
- nesting inside the included file. By default, nesting is limited to
203
- a depth of five.
204
- </li><li>
205
- Internally the <code class="literal">include1</code> macro is translated to the <code class="literal">include1</code>
206
- system attribute which means it must be evaluated in a region where
207
- attribute substitution is enabled. To inhibit nested substitution in
208
- included files it is preferable to use the <code class="literal">include</code> macro and set
209
- the attribute <code class="literal">depth=1</code>.
210
- </li></ul></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="_conditional_inclusion_macros"></a>Conditional Inclusion Macros</h4></div></div></div><p>Lines of text in the source document can be selectively included or
211
- excluded from processing based on the existence (or not) of a document
212
- attribute.</p><p>Document text between the <code class="literal">ifdef</code> and <code class="literal">endif</code> macros is included if a
213
- document attribute is defined:</p><pre class="literallayout">ifdef::&lt;attribute&gt;[]
214
- :
215
- endif::&lt;attribute&gt;[]</pre><p>Document text between the <code class="literal">ifndef</code> and <code class="literal">endif</code> macros is not included
216
- if a document attribute is defined:</p><pre class="literallayout">ifndef::&lt;attribute&gt;[]
217
- :
218
- endif::&lt;attribute&gt;[]</pre><p><code class="literal">&lt;attribute&gt;</code> is an attribute name which is optional in the trailing
219
- <code class="literal">endif</code> macro.</p><p>If you only want to process a single line of text then the text can be
220
- put inside the square brackets and the <code class="literal">endif</code> macro omitted, for
221
- example:</p><pre class="literallayout">ifdef::revnumber[Version number 42]</pre><p>Is equivalent to:</p><pre class="literallayout">ifdef::revnumber[]
222
- Version number 42
223
- endif::revnumber[]</pre><p><span class="emphasis"><em>ifdef</em></span> and <span class="emphasis"><em>ifndef</em></span> macros also accept multiple attribute names:</p><div class="itemizedlist"><ul type="disc"><li>
224
- Multiple <span class="emphasis"><em>,</em></span> separated attribute names evaluate to defined if if one
225
- or more of the attributes is defined, otherwise it’s value is
226
- undefined.
227
- </li><li>
228
- Multiple <span class="emphasis"><em>+</em></span> separated attribute names evaluate to defined if if all
229
- of the attributes is defined, otherwise it’s value is undefined.
230
- </li></ul></div><p>Document text between the <code class="literal">ifeval</code> and <code class="literal">endif</code> macros is included if
231
- the Python expression inside the square brackets is true. Example:</p><pre class="literallayout">ifeval::[{rs458}==2]]
232
- :
233
- endif::[]</pre><div class="itemizedlist"><ul type="disc"><li>
234
- Document attribute references are expanded before the expression is
235
- evaluated.
236
- </li><li>
237
- If an attribute reference is undefined then the expression is
238
- considered false.
239
- </li></ul></div><p>Take a look at the <code class="literal">*.conf</code> configuration files in the AsciiDoc
240
- distribution for examples of conditional inclusion macro usage.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="_executable_system_macros"></a>Executable system macros</h4></div></div></div><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
241
- their same named <a class="link" href="ar01s26.html#X24" title="System Attribute References">system attribute references</a>. The difference
242
- is that system macros occur in a block macro context whereas system
243
- attributes are confined to inline contexts where attribute
244
- substitution is enabled.</p><p>The following example displays a long directory listing inside a
245
- literal block:</p><pre class="literallayout">------------------
246
- sys::[ls -l *.txt]
247
- ------------------</pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>There are no block macro versions of the <span class="emphasis"><em>eval3</em></span> and <span class="emphasis"><em>sys3</em></span>
248
- system attributes.</p></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="_template_system_macro"></a>Template System Macro</h4></div></div></div><p>The <code class="literal">template</code> block macro allows the inclusion of one configuration
249
- file template section within another. The following example includes
250
- the <code class="literal">[admonitionblock]</code> section in the <code class="literal">[admonitionparagraph]</code>
251
- section:</p><pre class="literallayout">[admonitionparagraph]
252
- template::[admonitionblock]</pre><div class="itemizedlist"><p class="title"><b>Template macro behavior</b></p><ul type="disc"><li>
253
- The <code class="literal">template::[]</code> macro is useful for factoring configuration file
254
- markup.
255
- </li><li>
256
- <code class="literal">template::[]</code> macros cannot be nested.
257
- </li><li>
258
- <code class="literal">template::[]</code> macro expansion is applied to all sections
259
- after all configuration files have been read.
260
- </li></ul></div></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="X77"></a>Passthrough macros</h3></div></div></div><p>Passthrough macros are analogous to <a class="link" href="ar01s13.html#X76" title="Passthrough Blocks">passthrough blocks</a> and are
261
- used to pass text directly to the output. The substitution performed
262
- on the text is determined by the macro definition but can be overridden
263
- by the <code class="literal">&lt;subslist&gt;</code>. The usual syntax is
264
- <code class="literal">&lt;name&gt;:&lt;subslist&gt;[&lt;passtext&gt;]</code> (for inline macros) and
265
- <code class="literal">&lt;name&gt;::&lt;subslist&gt;[&lt;passtext&gt;]</code> (for block macros).</p><div class="variablelist"><dl><dt><span class="term">
266
- pass
267
- </span></dt><dd><p>
268
- Inline and block. Passes text unmodified (apart from explicitly
269
- specified substitutions). Examples:
270
- </p><pre class="literallayout">pass:[&lt;q&gt;To be or not to be&lt;/q&gt;]
271
- pass:attributes,quotes[&lt;u&gt;the '{author}'&lt;/u&gt;]</pre></dd><dt><span class="term">
272
- asciimath, latexmath
273
- </span></dt><dd>
274
- Inline and block. Passes text unmodified. Used for
275
- <a class="link" href="ar01s21.html" title="Mathematical Formulas">mathematical formulas</a>.
276
- </dd><dt><span class="term">
277
- +++
278
- </span></dt><dd><p>
279
- Inline and block. The triple-plus passthrough is functionally
280
- identical to the <span class="emphasis"><em>pass</em></span> macro but you don’t have to escape <code class="literal">]</code>
281
- characters and you can prefix with quoted attributes in the inline
282
- version. Example:
283
- </p><pre class="literallayout">Red [red]+++`sum_(i=1)\^n i=(n(n+1))/2`$+++ AsciiMathML formula</pre></dd><dt><span class="term">
284
- $$
285
- </span></dt><dd><p>
286
- Inline and block. The double-dollar passthrough is functionally
287
- identical to the triple-plus passthrough with one exception: special
288
- characters are escaped. Example:
289
- </p><pre class="literallayout">$$`[[a,b],[c,d]]((n),(k))`$$</pre></dd><dt><span class="term">
290
- <a id="X80"></a>`
291
- </span></dt><dd>
292
- Text quoted with single backtick characters constitutes an <span class="emphasis"><em>inline
293
- literal</em></span> passthrough. The enclosed text is rendered in a monospaced
294
- font and is only subject to special character substitution. This
295
- makes sense since monospace text is usually intended to be rendered
296
- literally and often contains characters that would otherwise have to
297
- be escaped. If you need monospaced text containing inline
298
- substitutions use a <a class="link" href="ar01s07.html#X81">plus character instead of a backtick</a>.
299
- </dd></dl></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="_macro_definitions"></a>Macro Definitions</h3></div></div></div><p>Each entry in the configuration <code class="literal">[macros]</code> section is a macro
300
- definition which can take one of the following forms:</p><div class="variablelist"><dl><dt><span class="term">
301
- <code class="literal">&lt;pattern&gt;=&lt;name&gt;[&lt;subslist]</code>
302
- </span></dt><dd>
303
- Inline macro definition.
304
- </dd><dt><span class="term">
305
- <code class="literal">&lt;pattern&gt;=#&lt;name&gt;[&lt;subslist]</code>
306
- </span></dt><dd>
307
- Block macro definition.
308
- </dd><dt><span class="term">
309
- <code class="literal">&lt;pattern&gt;=+&lt;name&gt;[&lt;subslist]</code>
310
- </span></dt><dd>
311
- System macro definition.
312
- </dd><dt><span class="term">
313
- <code class="literal">&lt;pattern&gt;</code>
314
- </span></dt><dd>
315
- Delete the existing macro with this <code class="literal">&lt;pattern&gt;</code>.
316
- </dd></dl></div><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
317
- a markup template. If <code class="literal">&lt;name&gt;</code> is omitted then it is the value of the
318
- regular expression match group named <span class="emphasis"><em>name</em></span>. The optional
319
- <code class="literal">[&lt;subslist]</code> is a comma-separated list of substitution names enclosed
320
- in <code class="literal">[]</code> brackets, it sets the default substitutions for passthrough
321
- text, if omitted then no passthrough substitutions are performed.</p><p><b>Pattern named groups. </b>The following named groups can be used in macro <code class="literal">&lt;pattern&gt;</code> regular
322
- expressions and are available as markup template attributes:</p><div class="variablelist"><dl><dt><span class="term">
323
- name
324
- </span></dt><dd>
325
- The macro name.
326
- </dd><dt><span class="term">
327
- target
328
- </span></dt><dd>
329
- The macro target.
330
- </dd><dt><span class="term">
331
- attrlist
332
- </span></dt><dd>
333
- The macro attribute list.
334
- </dd><dt><span class="term">
335
- passtext
336
- </span></dt><dd>
337
- Contents of this group are passed unmodified to the output subject
338
- only to <span class="emphasis"><em>subslist</em></span> substitutions.
339
- </dd><dt><span class="term">
340
- subslist
341
- </span></dt><dd>
342
- Processed as a comma-separated list of substitution names for
343
- <span class="emphasis"><em>passtext</em></span> substitution, overrides the the macro definition
344
- <span class="emphasis"><em>subslist</em></span>.
345
- </dd></dl></div><div class="itemizedlist"><p class="title"><b>Here’s what happens during macro substitution</b></p><ul type="disc"><li>
346
- Each contextually relevant macro <span class="emphasis"><em>pattern</em></span> from the <code class="literal">[macros]</code>
347
- section is matched against the input source line.
348
- </li><li>
349
- If a match is found the text to be substituted is loaded from a
350
- configuration markup template section named like
351
- <code class="literal">&lt;name&gt;-inlinemacro</code> or <code class="literal">&lt;name&gt;-blockmacro</code> (depending on the macro
352
- type).
353
- </li><li>
354
- Global and macro attribute list attributes are substituted in the
355
- macro’s markup template.
356
- </li><li>
357
- The substituted template replaces the macro reference in the output
358
- document.
359
- </li></ul></div></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ar01s17.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ar01s19.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Callouts </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Tables</td></tr></table></div></body></html>