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,185 +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>Attribute Entries</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="document_attributes.html">Prev</a><br/>
15
- Document Attributes
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="attribute_lists.html">Next</a><br/>
25
- Attribute Lists
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="X18"></a>Attribute Entries</h2></div></div></div>
37
- <p>The <code class="literal">AttributeEntry</code> block element allows document attributes to be
38
- assigned within an AsciiDoc document. Attribute entries are added to
39
- the global document attributes dictionary. The attribute name/value
40
- syntax is a single line like:</p>
41
- <pre class="literallayout">:&lt;name&gt;: &lt;value&gt;</pre>
42
- <p>For example:</p>
43
- <pre class="literallayout">:Author Initials: JB</pre>
44
- <p>This will set an attribute reference <code class="literal">{authorinitials}</code> to the value
45
- <span class="emphasis"><em>JB</em></span> in the current document.</p>
46
- <p>To delete (undefine) an attribute use the following syntax:</p>
47
- <pre class="literallayout">:&lt;name&gt;!:</pre>
48
- <div class="itemizedlist">
49
- <p class="title"><b>AttributeEntry behavior</b></p>
50
- <ul type="disc">
51
- <li>
52
- The attribute entry line begins with colon — no white space allowed
53
- in left margin.
54
- </li>
55
- <li>
56
- AsciiDoc converts the <code class="literal">&lt;name&gt;</code> to a legal attribute name (lower
57
- case, alphanumeric, dash and underscore characters only — all other
58
- characters deleted). This allows more human friendly text to be
59
- used.
60
- </li>
61
- <li>
62
- Leading and trailing white space is stripped from the <code class="literal">&lt;value&gt;</code>.
63
- </li>
64
- <li>
65
- <p>
66
- Lines ending in a space followed by a plus character are continued
67
- to the next line, for example:
68
- </p>
69
- <pre class="literallayout">:description: AsciiDoc is a text document format for writing notes, +
70
- documentation, articles, books, slideshows, web pages +
71
- and man pages.</pre>
72
- </li>
73
- <li>
74
- If the <code class="literal">&lt;value&gt;</code> is blank then the corresponding attribute value is
75
- set to an empty string.
76
- </li>
77
- <li>
78
- Attribute references contained in the entry <code class="literal">&lt;value&gt;</code> will be
79
- expanded.
80
- </li>
81
- <li>
82
- By default AttributeEntry values are substituted for
83
- <code class="literal">specialcharacters</code> and <code class="literal">attributes</code> (see above), if you want to
84
- change or disable AttributeEntry substitution use the <a class="link" href="macros.html#X77" title="Passthrough macros"> inline macro</a> syntax.
85
- </li>
86
- <li>
87
- Attribute entries in the document Header are available for header
88
- markup template substitution.
89
- </li>
90
- <li>
91
- Attribute elements override configuration file and intrinsic
92
- attributes but do not override command-line attributes.
93
- </li>
94
- </ul>
95
- </div>
96
- <p>Here are some more attribute entry examples:</p>
97
- <pre class="screen">AsciiDoc User Manual
98
- ====================
99
- :author: Stuart Rackham
100
- :email: srackham@gmail.com
101
- :revdate: April 23, 2004
102
- :revnumber: 5.1.1</pre>
103
- <p>Which creates these attributes:</p>
104
- <pre class="literallayout">{author}, {firstname}, {lastname}, {authorinitials}, {email},
105
- {revdate}, {revnumber}</pre>
106
- <p>The previous example is equivalent to this <a class="link" href="document_structure.html#X95" title="Header">document header</a>:</p>
107
- <pre class="screen">AsciiDoc User Manual
108
- ====================
109
- Stuart Rackham &lt;srackham@gmail.com&gt;
110
- 5.1.1, April 23, 2004</pre>
111
- <div class="section" lang="en" xml:lang="en">
112
- <div class="titlepage"><div><div><h3 class="title">
113
- <a id="_setting_configuration_entries"></a>Setting configuration entries</h3></div></div></div>
114
- <p>A variant of the Attribute Entry syntax allows configuration file
115
- entries to be set from within an AsciiDoc document:</p>
116
- <pre class="literallayout">:&lt;section_name&gt;.&lt;entry_name&gt;: &lt;entry_value&gt;</pre>
117
- <p>Where <code class="literal">&lt;section_name&gt;</code> is the configuration section name,
118
- <code class="literal">&lt;entry_name&gt;</code> is the name of the entry and <code class="literal">&lt;entry_value&gt;</code> is the
119
- optional entry value. This example sets the default labeled list style
120
- to <span class="emphasis"><em>horizontal</em></span>:</p>
121
- <pre class="literallayout">:listdef-labeled.style: horizontal</pre>
122
- <p>It is exactly equivalent to a configuration file containing:</p>
123
- <pre class="literallayout">[listdef-labeled]
124
- style=horizontal</pre>
125
- <p>No substitution is performed on configuration file attribute entries
126
- and they cannot be undefined.</p>
127
- <div class="sidebar">
128
- <a id="X62"></a><p class="title"><b>Attribute entries promote clarity and eliminate repetition</b></p>
129
- <p>URLs and file names in AsciiDoc macros are often quite long — they
130
- break paragraph flow and readability suffers. The problem is
131
- compounded by redundancy if the same name is used repeatedly.
132
- Attribute entries can be used to make your documents easier to read
133
- and write, here are some examples:</p>
134
- <pre class="literallayout">:1: http://freshmeat.net/projects/asciidoc/
135
- :homepage: http://methods.co.nz/asciidoc/[AsciiDoc home page]
136
- :new: image:./images/smallnew.png[]
137
- :footnote1: footnote:[A meaningless latin term]</pre>
138
- <pre class="literallayout">Using previously defined attributes: See the {1}[Freshmeat summary]
139
- or the {homepage} for something new {new}. Lorem ispum {footnote1}.</pre>
140
- <div class="itemizedlist">
141
- <p class="title"><b>Note</b></p>
142
- <ul type="disc">
143
- <li>
144
- The attribute entry definition must precede it’s usage.
145
- </li>
146
- <li>
147
- You are not limited to URLs or file names, entire macro calls or
148
- arbitrary lines of text can be abbreviated.
149
- </li>
150
- <li>
151
- Shared attributes entries could be grouped into a separate file and
152
- <a class="link" href="macros.html#X63" title="Include Macros">included</a> in multiple documents.
153
- </li>
154
- </ul>
155
- </div>
156
- </div>
157
- </div>
158
- </div>
159
-
160
- </div>
161
-
162
- <hr/>
163
-
164
- <div class="nav" id="navfooter">
165
- <table width="100%">
166
- <tr><td width="33%" align="left">
167
-
168
- <a href="document_attributes.html">Prev</a><br/>
169
- Document Attributes
170
-
171
- </td><td width="33%" align="center">
172
-
173
- <a href="index.html">Home</a><br/>
174
- AsciiDoc User Guide
175
-
176
- </td><td width="33%" align="right">
177
-
178
- <a href="attribute_lists.html">Next</a><br/>
179
- Attribute Lists
180
-
181
- </td></tr>
182
- </table>
183
- </div>
184
- </body>
185
- </html>
@@ -1,157 +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>Attribute Lists</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="attribute_entries.html">Prev</a><br/>
15
- Attribute Entries
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="attribute_references.html">Next</a><br/>
25
- Attribute References
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="X21"></a>Attribute Lists</h2></div></div></div>
37
- <div class="itemizedlist"><ul type="disc">
38
- <li>
39
- An attribute list is a comma separated list of attribute values.
40
- </li>
41
- <li>
42
- The entire list is enclosed in square brackets.
43
- </li>
44
- <li>
45
- Attribute lists are used to pass parameters to macros, blocks (using
46
- the <a class="link" href="attributelist_element.html" title="AttributeList Element">AttributeList element</a>) and inline quotes.
47
- </li>
48
- </ul></div>
49
- <p>The list consists of zero or more positional attribute values followed
50
- by zero or more named attribute values. Here are three examples: a
51
- single unquoted positional attribute; three unquoted positional
52
- attribute values; one positional attribute followed by two named
53
- attributes; the unquoted attribute value in the final example contains
54
- comma (<code class="literal">&amp;#44;</code>) and double-quote (<code class="literal">&amp;#34;</code>) character entities:</p>
55
- <pre class="literallayout">[Hello]
56
- [quote, Bertrand Russell, The World of Mathematics (1956)]
57
- ["22 times", backcolor="#0e0e0e", options="noborders,wide"]
58
- [A footnote&amp;#44; &amp;#34;with an image&amp;#34; image:smallnew.png[]]</pre>
59
- <div class="itemizedlist">
60
- <p class="title"><b>Attribute list behavior</b></p>
61
- <ul type="disc">
62
- <li>
63
- If one or more attribute values contains a comma the all string
64
- values must be quoted (enclosed in double quotation mark
65
- characters).
66
- </li>
67
- <li>
68
- If the list contains any named or quoted attributes then all string
69
- attribute values must be quoted.
70
- </li>
71
- <li>
72
- To include a double quotation mark (") character in a quoted
73
- attribute value the the quotation mark must be escaped with a
74
- backslash.
75
- </li>
76
- <li>
77
- List attributes take precedence over existing attributes.
78
- </li>
79
- <li>
80
- List attributes can only be referenced in configuration file markup
81
- templates and tags, they are not available elsewhere in the
82
- document.
83
- </li>
84
- <li>
85
- Setting a named attribute to <code class="literal">None</code> undefines the attribute.
86
- </li>
87
- <li>
88
- Positional attributes are referred to as <code class="literal">{1}</code>,<code class="literal">{2}</code>,<code class="literal">{3}</code>,…
89
- </li>
90
- <li>
91
- Attribute <code class="literal">{0}</code> refers to the entire list (excluding the enclosing
92
- square brackets).
93
- </li>
94
- <li>
95
- Named attribute names cannot contain dash characters.
96
- </li>
97
- </ul>
98
- </div>
99
- <div class="section" lang="en" xml:lang="en">
100
- <div class="titlepage"><div><div><h3 class="title">
101
- <a id="X75"></a>Options attribute</h3></div></div></div>
102
- <p>If the attribute list contains an attribute named <code class="literal">options</code> it is
103
- processed as a comma separated list of option names:</p>
104
- <div class="itemizedlist"><ul type="disc">
105
- <li>
106
- Each name generates an attribute named like <code class="literal">&lt;option&gt;-option</code> (where
107
- <code class="literal">&lt;option&gt;</code> is the option name) with an empty string value. For
108
- example <code class="literal">[options="opt1,opt2,opt3"]</code> is equivalent to setting the
109
- following three attributes
110
- <code class="literal">[opt1-option="",opt2-option="",opt2-option=""]</code>.
111
- </li>
112
- <li>
113
- If you define a an option attribute globally (for example with an
114
- <a class="link" href="attribute_entries.html" title="Attribute Entries">attribute entry</a>) then it will apply to all elements in the
115
- document.
116
- </li>
117
- <li>
118
- AsciiDoc implements a number of predefined options which are listed
119
- in the <a class="link" href="f_attribute_options.html" title="F. Attribute Options">Attribute Options appendix</a>.
120
- </li>
121
- </ul></div>
122
- </div>
123
- <div class="section" lang="en" xml:lang="en">
124
- <div class="titlepage"><div><div><h3 class="title">
125
- <a id="_macro_attribute_lists"></a>Macro Attribute lists</h3></div></div></div>
126
- <p>Macros calls are suffixed with an attribute list. The list may be
127
- empty but it cannot be omitted. List entries are used to pass
128
- attribute values to macro markup templates.</p>
129
- </div>
130
- </div>
131
-
132
- </div>
133
-
134
- <hr/>
135
-
136
- <div class="nav" id="navfooter">
137
- <table width="100%">
138
- <tr><td width="33%" align="left">
139
-
140
- <a href="attribute_entries.html">Prev</a><br/>
141
- Attribute Entries
142
-
143
- </td><td width="33%" align="center">
144
-
145
- <a href="index.html">Home</a><br/>
146
- AsciiDoc User Guide
147
-
148
- </td><td width="33%" align="right">
149
-
150
- <a href="attribute_references.html">Next</a><br/>
151
- Attribute References
152
-
153
- </td></tr>
154
- </table>
155
- </div>
156
- </body>
157
- </html>
@@ -1,414 +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>Attribute References</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="attribute_lists.html">Prev</a><br/>
15
- Attribute Lists
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="intrinsic_attributes.html">Next</a><br/>
25
- Intrinsic Attributes
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="_attribute_references"></a>Attribute References</h2></div></div></div>
37
- <p>An attribute reference is an attribute name (possibly followed by an
38
- additional parameters) enclosed in curly braces. When an attribute
39
- reference is encountered it is evaluated and replaced by its
40
- corresponding text value. If the attribute is undefined the line
41
- containing the attribute is dropped.</p>
42
- <p>There are three types of attribute reference: <span class="emphasis"><em>Simple</em></span>, <span class="emphasis"><em>Conditional</em></span>
43
- and <span class="emphasis"><em>System</em></span>.</p>
44
- <div class="itemizedlist">
45
- <p class="title"><b>Attribute reference evaluation</b></p>
46
- <ul type="disc">
47
- <li>
48
- You can suppress attribute reference expansion by placing a
49
- backslash character immediately in front of the opening brace
50
- character.
51
- </li>
52
- <li>
53
- By default attribute references are not expanded in
54
- <span class="emphasis"><em>LiteralParagraphs</em></span>, <span class="emphasis"><em>ListingBlocks</em></span> or <span class="emphasis"><em>LiteralBlocks</em></span>.
55
- </li>
56
- <li>
57
- Attribute substitution proceeds line by line in reverse line order.
58
- </li>
59
- <li>
60
- Attribute reference evaluation is performed in the following order:
61
- <span class="emphasis"><em>Simple</em></span> then <span class="emphasis"><em>Conditional</em></span> and finally <span class="emphasis"><em>System</em></span>.
62
- </li>
63
- </ul>
64
- </div>
65
- <div class="section" lang="en" xml:lang="en">
66
- <div class="titlepage"><div><div><h3 class="title">
67
- <a id="_simple_attributes_references"></a>Simple Attributes References</h3></div></div></div>
68
- <p>Simple attribute references take the form <code class="literal">{&lt;name&gt;}</code>. If the
69
- attribute name is defined its text value is substituted otherwise the
70
- line containing the reference is dropped from the output.</p>
71
- </div>
72
- <div class="section" lang="en" xml:lang="en">
73
- <div class="titlepage"><div><div><h3 class="title">
74
- <a id="_conditional_attribute_references"></a>Conditional Attribute References</h3></div></div></div>
75
- <p>Additional parameters are used in conjunction with attribute names to
76
- calculate a substitution value. Conditional attribute references take
77
- the following forms:</p>
78
- <div class="variablelist"><dl>
79
- <dt><span class="term">
80
- <code class="literal">{&lt;names&gt;=&lt;value&gt;}</code>
81
- </span></dt>
82
- <dd>
83
- <code class="literal">&lt;value&gt;</code> is substituted if the attribute <code class="literal">&lt;names&gt;</code> is
84
- undefined otherwise its value is substituted. <code class="literal">&lt;value&gt;</code> can
85
- contain simple attribute references.
86
- </dd>
87
- <dt><span class="term">
88
- <code class="literal">{&lt;names&gt;?&lt;value&gt;}</code>
89
- </span></dt>
90
- <dd>
91
- <code class="literal">&lt;value&gt;</code> is substituted if the attribute <code class="literal">&lt;names&gt;</code> is defined
92
- otherwise an empty string is substituted. <code class="literal">&lt;value&gt;</code> can
93
- contain simple attribute references.
94
- </dd>
95
- <dt><span class="term">
96
- <code class="literal">{&lt;names&gt;!&lt;value&gt;}</code>
97
- </span></dt>
98
- <dd>
99
- <code class="literal">&lt;value&gt;</code> is substituted if the attribute <code class="literal">&lt;names&gt;</code> is
100
- undefined otherwise an empty string is substituted. <code class="literal">&lt;value&gt;</code>
101
- can contain simple attribute references.
102
- </dd>
103
- <dt><span class="term">
104
- <code class="literal">{&lt;names&gt;#&lt;value&gt;}</code>
105
- </span></dt>
106
- <dd>
107
- <code class="literal">&lt;value&gt;</code> is substituted if the attribute <code class="literal">&lt;names&gt;</code> is defined
108
- otherwise the undefined attribute entry causes the containing
109
- line to be dropped. <code class="literal">&lt;value&gt;</code> can contain simple attribute
110
- references.
111
- </dd>
112
- <dt><span class="term">
113
- <code class="literal">{&lt;names&gt;%&lt;value&gt;}</code>
114
- </span></dt>
115
- <dd>
116
- <code class="literal">&lt;value&gt;</code> is substituted if the attribute <code class="literal">&lt;names&gt;</code> is not
117
- defined otherwise the containing line is dropped. <code class="literal">&lt;value&gt;</code>
118
- can contain simple attribute references.
119
- </dd>
120
- <dt><span class="term">
121
- <code class="literal">{&lt;names&gt;@&lt;regexp&gt;:&lt;value1&gt;[:&lt;value2&gt;]}</code>
122
- </span></dt>
123
- <dd>
124
- <code class="literal">&lt;value1&gt;</code> is substituted if the value of attribute <code class="literal">&lt;names&gt;</code>
125
- matches the regular expression <code class="literal">&lt;regexp&gt;</code> otherwise <code class="literal">&lt;value2&gt;</code>
126
- is substituted. If attribute <code class="literal">&lt;names&gt;</code> is not defined the
127
- containing line is dropped. If <code class="literal">&lt;value2&gt;</code> is omitted an empty
128
- string is assumed. The values and the regular expression can
129
- contain simple attribute references. To embed colons in the
130
- values or the regular expression escape them with backslashes.
131
- </dd>
132
- <dt><span class="term">
133
- <code class="literal">{&lt;names&gt;$&lt;regexp&gt;:&lt;value1&gt;[:&lt;value2&gt;]}</code>
134
- </span></dt>
135
- <dd>
136
- <p>
137
- Same behavior as the previous ternary attribute except for
138
- the following cases:
139
- </p>
140
- <div class="variablelist"><dl>
141
- <dt><span class="term">
142
- <code class="literal">{&lt;names&gt;$&lt;regexp&gt;:&lt;value&gt;}</code>
143
- </span></dt>
144
- <dd>
145
- Substitutes <code class="literal">&lt;value&gt;</code> if <code class="literal">&lt;names&gt;</code> matches <code class="literal">&lt;regexp&gt;</code>
146
- otherwise the result is undefined and the containing
147
- line is dropped.
148
- </dd>
149
- <dt><span class="term">
150
- <code class="literal">{&lt;names&gt;$&lt;regexp&gt;::&lt;value&gt;}</code>
151
- </span></dt>
152
- <dd>
153
- Substitutes <code class="literal">&lt;value&gt;</code> if <code class="literal">&lt;names&gt;</code> does not match
154
- <code class="literal">&lt;regexp&gt;</code> otherwise the result is undefined and the
155
- containing line is dropped.
156
- </dd>
157
- </dl></div>
158
- </dd>
159
- </dl></div>
160
- <p>The attribute <code class="literal">&lt;names&gt;</code> parameter normally consists of a single
161
- attribute name but it can be any one of the following:</p>
162
- <div class="itemizedlist"><ul type="disc">
163
- <li>
164
- A single attribute name which evaluates to the attributes value.
165
- </li>
166
- <li>
167
- Multiple <span class="emphasis"><em>,</em></span> separated attribute names which evaluates to an empty
168
- string if one or more of the attributes is defined, otherwise it’s
169
- value is undefined.
170
- </li>
171
- <li>
172
- Multiple <span class="emphasis"><em>+</em></span> separated attribute names which evaluates to an empty
173
- string if all of the attributes are defined, otherwise it’s value is
174
- undefined.
175
- </li>
176
- </ul></div>
177
- <p>Conditional attributes with single attribute names are evaluated first
178
- so they can be used inside the multi-attribute conditional <code class="literal">&lt;value&gt;</code>.</p>
179
- <div class="section" lang="en" xml:lang="en">
180
- <div class="titlepage"><div><div><h4 class="title">
181
- <a id="_conditional_attribute_examples"></a>Conditional attribute examples</h4></div></div></div>
182
- <p>Conditional attributes are mainly used in AsciiDoc configuration
183
- files — see the distribution <code class="literal">.conf</code> files for examples.</p>
184
- <div class="variablelist"><dl>
185
- <dt><span class="term">
186
- Attribute equality test
187
- </span></dt>
188
- <dd>
189
- <p>
190
- If <code class="literal">{backend}</code> is <code class="literal">docbook45</code> or <code class="literal">xhtml11</code> the example evaluates to
191
- “DocBook 4.5 or XHTML 1.1 backend” otherwise it evaluates to “some
192
- other backend”:
193
- </p>
194
- <pre class="literallayout">{backend@docbook45|xhtml11:DocBook 4.5 or XHTML 1.1 backend:some other backend}</pre>
195
- </dd>
196
- <dt><span class="term">
197
- Attribute value map
198
- </span></dt>
199
- <dd>
200
- <p>
201
- This example maps the <code class="literal">frame</code> attribute values [<code class="literal">topbot</code>, <code class="literal">all</code>,
202
- <code class="literal">none</code>, <code class="literal">sides</code>] to [<code class="literal">hsides</code>, <code class="literal">border</code>, <code class="literal">void</code>, <code class="literal">vsides</code>]:
203
- </p>
204
- <pre class="literallayout">{frame@topbot:hsides}{frame@all:border}{frame@none:void}{frame@sides:vsides}</pre>
205
- </dd>
206
- </dl></div>
207
- </div>
208
- </div>
209
- <div class="section" lang="en" xml:lang="en">
210
- <div class="titlepage"><div><div><h3 class="title">
211
- <a id="X24"></a>System Attribute References</h3></div></div></div>
212
- <p>System attribute references generate the attribute text value by
213
- executing a predefined action that is parametrized by one or more
214
- arguments. The syntax is <code class="literal">{&lt;action&gt;:&lt;arguments&gt;}</code>.</p>
215
- <div class="variablelist"><dl>
216
- <dt><span class="term">
217
- <code class="literal">{counter:&lt;attrname&gt;[:&lt;seed&gt;]}</code>
218
- </span></dt>
219
- <dd>
220
- <p>
221
- Increments the document attribute (if the attribute is
222
- undefined it is set to <code class="literal">1</code>). Returns the new attribute value.
223
- </p>
224
- <div class="itemizedlist"><ul type="disc">
225
- <li>
226
- Counters generate global (document wide) attributes.
227
- </li>
228
- <li>
229
- The optional <code class="literal">&lt;seed&gt;</code> specifies the counter’s initial value;
230
- it can be a number or a single letter; defaults to <span class="emphasis"><em>1</em></span>.
231
- </li>
232
- <li>
233
- <code class="literal">&lt;seed&gt;</code> can contain simple and conditional attribute
234
- references.
235
- </li>
236
- <li>
237
- The <span class="emphasis"><em>counter</em></span> system attribute will not be executed if the
238
- containing line is dropped by the prior evaluation of an
239
- undefined attribute.
240
- </li>
241
- </ul></div>
242
- </dd>
243
- <dt><span class="term">
244
- <code class="literal">{counter2:&lt;attrname&gt;[:&lt;seed&gt;]}</code>
245
- </span></dt>
246
- <dd>
247
- Same as <code class="literal">counter</code> except the it always returns a blank string.
248
- </dd>
249
- <dt><span class="term">
250
- <code class="literal">{eval:&lt;expression&gt;}</code>
251
- </span></dt>
252
- <dd>
253
- <p>
254
- Substitutes the result of the Python <code class="literal">&lt;expression&gt;</code>.
255
- </p>
256
- <div class="itemizedlist"><ul type="disc">
257
- <li>
258
- If <code class="literal">&lt;expression&gt;</code> evaluates to <code class="literal">None</code> or <code class="literal">False</code> the
259
- reference is deemed undefined and the line containing the
260
- reference is dropped from the output.
261
- </li>
262
- <li>
263
- If the expression evaluates to <code class="literal">True</code> the attribute
264
- evaluates to an empty string.
265
- </li>
266
- <li>
267
- <code class="literal">&lt;expression&gt;</code> can contain simple and conditional attribute
268
- references.
269
- </li>
270
- <li>
271
- The <span class="emphasis"><em>eval</em></span> system attribute can be nested inside other
272
- system attributes.
273
- </li>
274
- </ul></div>
275
- </dd>
276
- <dt><span class="term">
277
- <code class="literal">{eval3:&lt;command&gt;}</code>
278
- </span></dt>
279
- <dd>
280
- Passthrough version of <code class="literal">{eval:&lt;expression&gt;}</code> — the generated
281
- output is written directly to the output without any further
282
- substitutions.
283
- </dd>
284
- <dt><span class="term">
285
- <code class="literal">{include:&lt;filename&gt;}</code>
286
- </span></dt>
287
- <dd>
288
- <p>
289
- Substitutes contents of the file named <code class="literal">&lt;filename&gt;</code>.
290
- </p>
291
- <div class="itemizedlist"><ul type="disc">
292
- <li>
293
- The included file is read at the time of attribute
294
- substitution.
295
- </li>
296
- <li>
297
- If the file does not exist a warning is emitted and the line
298
- containing the reference is dropped from the output file.
299
- </li>
300
- <li>
301
- Tabs are expanded based on the current <span class="emphasis"><em>tabsize</em></span> attribute
302
- value.
303
- </li>
304
- </ul></div>
305
- </dd>
306
- <dt><span class="term">
307
- <code class="literal">{set:&lt;attrname&gt;[!][:&lt;value&gt;]}</code>
308
- </span></dt>
309
- <dd>
310
- <p>
311
- Sets or unsets document attribute. Normally only used in
312
- configuration file markup templates (use
313
- <a class="link" href="attribute_entries.html" title="Attribute Entries">AttributeEntries</a> in AsciiDoc documents).
314
- </p>
315
- <div class="itemizedlist"><ul type="disc">
316
- <li>
317
- If the attribute name is followed by an exclamation mark
318
- the attribute becomes undefined.
319
- </li>
320
- <li>
321
- If <code class="literal">&lt;value&gt;</code> is omitted the attribute is set to a blank
322
- string.
323
- </li>
324
- <li>
325
- <code class="literal">&lt;value&gt;</code> can contain simple and conditional attribute
326
- references.
327
- </li>
328
- <li>
329
- Returns a blank string unless the attribute is undefined in
330
- which case the return value is undefined and the enclosing
331
- line will be dropped.
332
- </li>
333
- </ul></div>
334
- </dd>
335
- <dt><span class="term">
336
- <code class="literal">{set2:&lt;attrname&gt;[!][:&lt;value&gt;]}</code>
337
- </span></dt>
338
- <dd>
339
- Same as <code class="literal">set</code> except that the attribute scope is local to the
340
- template.
341
- </dd>
342
- <dt><span class="term">
343
- <code class="literal">{sys:&lt;command&gt;}</code>
344
- </span></dt>
345
- <dd>
346
- Substitutes the stdout generated by the execution of the shell
347
- <code class="literal">&lt;command&gt;</code>.
348
- </dd>
349
- <dt><span class="term">
350
- <code class="literal">{sys2:&lt;command&gt;}</code>
351
- </span></dt>
352
- <dd>
353
- Substitutes the stdout and stderr generated by the execution
354
- of the shell <code class="literal">&lt;command&gt;</code>.
355
- </dd>
356
- <dt><span class="term">
357
- <code class="literal">{sys3:&lt;command&gt;}</code>
358
- </span></dt>
359
- <dd>
360
- Passthrough version of <code class="literal">{sys:&lt;command&gt;}</code> — the generated
361
- output is written directly to the output without any further
362
- substitutions.
363
- </dd>
364
- <dt><span class="term">
365
- <code class="literal">{template:&lt;template&gt;}</code>
366
- </span></dt>
367
- <dd>
368
- Substitutes the contents of the configuration file section
369
- named <code class="literal">&lt;template&gt;</code>. Attribute references contained in the
370
- template are substituted.
371
- </dd>
372
- </dl></div>
373
- <div class="itemizedlist">
374
- <p class="title"><b>System reference behavior</b></p>
375
- <ul type="disc">
376
- <li>
377
- System attribute arguments can contain non-system attribute
378
- references.
379
- </li>
380
- <li>
381
- Closing brace characters inside system attribute arguments must be
382
- escaped with a backslash.
383
- </li>
384
- </ul>
385
- </div>
386
- </div>
387
- </div>
388
-
389
- </div>
390
-
391
- <hr/>
392
-
393
- <div class="nav" id="navfooter">
394
- <table width="100%">
395
- <tr><td width="33%" align="left">
396
-
397
- <a href="attribute_lists.html">Prev</a><br/>
398
- Attribute Lists
399
-
400
- </td><td width="33%" align="center">
401
-
402
- <a href="index.html">Home</a><br/>
403
- AsciiDoc User Guide
404
-
405
- </td><td width="33%" align="right">
406
-
407
- <a href="intrinsic_attributes.html">Next</a><br/>
408
- Intrinsic Attributes
409
-
410
- </td></tr>
411
- </table>
412
- </div>
413
- </body>
414
- </html>