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,21 +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>Document Attributes</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="ar01s22.html" title="Configuration Files" /><link rel="next" href="ar01s24.html" title="Attribute Entries" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Document Attributes</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ar01s22.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ar01s24.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="_document_attributes"></a>Document Attributes</h2></div></div></div><p>A document attribute is comprised of a <span class="emphasis"><em>name</em></span> and a textual <span class="emphasis"><em>value</em></span>
4
- and is used for textual substitution in AsciiDoc documents and
5
- configuration files. An attribute reference (an attribute name
6
- enclosed in braces) is replaced by the corresponding attribute
7
- value. Attribute names are case insensitive and can only contain
8
- alphanumeric, dash and underscore characters.</p><p>There are four sources of document attributes (from highest to lowest
9
- precedence):</p><div class="itemizedlist"><ul type="disc"><li>
10
- Command-line attributes.
11
- </li><li>
12
- AttributeEntry, AttributeList, Macro and BlockId elements.
13
- </li><li>
14
- Configuration file <code class="literal">[attributes]</code> sections.
15
- </li><li>
16
- Intrinsic attributes.
17
- </li></ul></div><p>Within each of these divisions the last processed entry takes
18
- precedence.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>If an attribute is not defined then the line containing the
19
- attribute reference is dropped. This property is used extensively in
20
- AsciiDoc configuration files to facilitate conditional markup
21
- generation.</p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ar01s22.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ar01s24.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Configuration Files </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Attribute Entries</td></tr></table></div></body></html>
@@ -1,69 +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>Attribute Entries</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="ar01s23.html" title="Document Attributes" /><link rel="next" href="ar01s25.html" title="Attribute Lists" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Attribute Entries</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ar01s23.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ar01s25.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="X18"></a>Attribute Entries</h2></div></div></div><p>The <code class="literal">AttributeEntry</code> block element allows document attributes to be
4
- assigned within an AsciiDoc document. Attribute entries are added to
5
- the global document attributes dictionary. The attribute name/value
6
- syntax is a single line like:</p><pre class="literallayout">:&lt;name&gt;: &lt;value&gt;</pre><p>For example:</p><pre class="literallayout">:Author Initials: JB</pre><p>This will set an attribute reference <code class="literal">{authorinitials}</code> to the value
7
- <span class="emphasis"><em>JB</em></span> in the current document.</p><p>To delete (undefine) an attribute use the following syntax:</p><pre class="literallayout">:&lt;name&gt;!:</pre><div class="itemizedlist"><p class="title"><b>AttributeEntry behavior</b></p><ul type="disc"><li>
8
- The attribute entry line begins with colon — no white space allowed
9
- in left margin.
10
- </li><li>
11
- AsciiDoc converts the <code class="literal">&lt;name&gt;</code> to a legal attribute name (lower
12
- case, alphanumeric, dash and underscore characters only — all other
13
- characters deleted). This allows more human friendly text to be
14
- used.
15
- </li><li>
16
- Leading and trailing white space is stripped from the <code class="literal">&lt;value&gt;</code>.
17
- </li><li><p>
18
- Lines ending in a space followed by a plus character are continued
19
- to the next line, for example:
20
- </p><pre class="literallayout">:description: AsciiDoc is a text document format for writing notes, +
21
- documentation, articles, books, slideshows, web pages +
22
- and man pages.</pre></li><li>
23
- If the <code class="literal">&lt;value&gt;</code> is blank then the corresponding attribute value is
24
- set to an empty string.
25
- </li><li>
26
- Attribute references contained in the entry <code class="literal">&lt;value&gt;</code> will be
27
- expanded.
28
- </li><li>
29
- By default AttributeEntry values are substituted for
30
- <code class="literal">specialcharacters</code> and <code class="literal">attributes</code> (see above), if you want to
31
- change or disable AttributeEntry substitution use the <a class="link" href="ar01s18.html#X77" title="Passthrough macros"> inline macro</a> syntax.
32
- </li><li>
33
- Attribute entries in the document Header are available for header
34
- markup template substitution.
35
- </li><li>
36
- Attribute elements override configuration file and intrinsic
37
- attributes but do not override command-line attributes.
38
- </li></ul></div><p>Here are some more attribute entry examples:</p><pre class="screen">AsciiDoc User Manual
39
- ====================
40
- :author: Stuart Rackham
41
- :email: srackham@gmail.com
42
- :revdate: April 23, 2004
43
- :revnumber: 5.1.1</pre><p>Which creates these attributes:</p><pre class="literallayout">{author}, {firstname}, {lastname}, {authorinitials}, {email},
44
- {revdate}, {revnumber}</pre><p>The previous example is equivalent to this <a class="link" href="ar01s05.html#X95" title="Header">document header</a>:</p><pre class="screen">AsciiDoc User Manual
45
- ====================
46
- Stuart Rackham &lt;srackham@gmail.com&gt;
47
- 5.1.1, April 23, 2004</pre><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="_setting_configuration_entries"></a>Setting configuration entries</h3></div></div></div><p>A variant of the Attribute Entry syntax allows configuration file
48
- entries to be set from within an AsciiDoc document:</p><pre class="literallayout">:&lt;section_name&gt;.&lt;entry_name&gt;: &lt;entry_value&gt;</pre><p>Where <code class="literal">&lt;section_name&gt;</code> is the configuration section name,
49
- <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
50
- optional entry value. This example sets the default labeled list style
51
- to <span class="emphasis"><em>horizontal</em></span>:</p><pre class="literallayout">:listdef-labeled.style: horizontal</pre><p>It is exactly equivalent to a configuration file containing:</p><pre class="literallayout">[listdef-labeled]
52
- style=horizontal</pre><p>No substitution is performed on configuration file attribute entries
53
- and they cannot be undefined.</p><div class="sidebar"><a id="X62"></a><p class="title"><b>Attribute entries promote clarity and eliminate repetition</b></p><p>URLs and file names in AsciiDoc macros are often quite long — they
54
- break paragraph flow and readability suffers. The problem is
55
- compounded by redundancy if the same name is used repeatedly.
56
- Attribute entries can be used to make your documents easier to read
57
- and write, here are some examples:</p><pre class="literallayout">:1: http://freshmeat.net/projects/asciidoc/
58
- :homepage: http://methods.co.nz/asciidoc/[AsciiDoc home page]
59
- :new: image:./images/smallnew.png[]
60
- :footnote1: footnote:[A meaningless latin term]</pre><pre class="literallayout">Using previously defined attributes: See the {1}[Freshmeat summary]
61
- or the {homepage} for something new {new}. Lorem ispum {footnote1}.</pre><div class="itemizedlist"><p class="title"><b>Note</b></p><ul type="disc"><li>
62
- The attribute entry definition must precede it’s usage.
63
- </li><li>
64
- You are not limited to URLs or file names, entire macro calls or
65
- arbitrary lines of text can be abbreviated.
66
- </li><li>
67
- Shared attributes entries could be grouped into a separate file and
68
- <a class="link" href="ar01s18.html#X63" title="Include Macros">included</a> in multiple documents.
69
- </li></ul></div></div></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ar01s23.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ar01s25.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Document Attributes </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Attribute Lists</td></tr></table></div></body></html>
@@ -1,60 +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>Attribute Lists</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="ar01s24.html" title="Attribute Entries" /><link rel="next" href="ar01s26.html" title="Attribute References" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Attribute Lists</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ar01s24.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ar01s26.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="X21"></a>Attribute Lists</h2></div></div></div><div class="itemizedlist"><ul type="disc"><li>
4
- An attribute list is a comma separated list of attribute values.
5
- </li><li>
6
- The entire list is enclosed in square brackets.
7
- </li><li>
8
- Attribute lists are used to pass parameters to macros, blocks (using
9
- the <a class="link" href="ar01s11.html" title="AttributeList Element">AttributeList element</a>) and inline quotes.
10
- </li></ul></div><p>The list consists of zero or more positional attribute values followed
11
- by zero or more named attribute values. Here are three examples: a
12
- single unquoted positional attribute; three unquoted positional
13
- attribute values; one positional attribute followed by two named
14
- attributes; the unquoted attribute value in the final example contains
15
- comma (<code class="literal">&amp;#44;</code>) and double-quote (<code class="literal">&amp;#34;</code>) character entities:</p><pre class="literallayout">[Hello]
16
- [quote, Bertrand Russell, The World of Mathematics (1956)]
17
- ["22 times", backcolor="#0e0e0e", options="noborders,wide"]
18
- [A footnote&amp;#44; &amp;#34;with an image&amp;#34; image:smallnew.png[]]</pre><div class="itemizedlist"><p class="title"><b>Attribute list behavior</b></p><ul type="disc"><li>
19
- If one or more attribute values contains a comma the all string
20
- values must be quoted (enclosed in double quotation mark
21
- characters).
22
- </li><li>
23
- If the list contains any named or quoted attributes then all string
24
- attribute values must be quoted.
25
- </li><li>
26
- To include a double quotation mark (") character in a quoted
27
- attribute value the the quotation mark must be escaped with a
28
- backslash.
29
- </li><li>
30
- List attributes take precedence over existing attributes.
31
- </li><li>
32
- List attributes can only be referenced in configuration file markup
33
- templates and tags, they are not available elsewhere in the
34
- document.
35
- </li><li>
36
- Setting a named attribute to <code class="literal">None</code> undefines the attribute.
37
- </li><li>
38
- Positional attributes are referred to as <code class="literal">{1}</code>,<code class="literal">{2}</code>,<code class="literal">{3}</code>,…
39
- </li><li>
40
- Attribute <code class="literal">{0}</code> refers to the entire list (excluding the enclosing
41
- square brackets).
42
- </li><li>
43
- Named attribute names cannot contain dash characters.
44
- </li></ul></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="X75"></a>Options attribute</h3></div></div></div><p>If the attribute list contains an attribute named <code class="literal">options</code> it is
45
- processed as a comma separated list of option names:</p><div class="itemizedlist"><ul type="disc"><li>
46
- Each name generates an attribute named like <code class="literal">&lt;option&gt;-option</code> (where
47
- <code class="literal">&lt;option&gt;</code> is the option name) with an empty string value. For
48
- example <code class="literal">[options="opt1,opt2,opt3"]</code> is equivalent to setting the
49
- following three attributes
50
- <code class="literal">[opt1-option="",opt2-option="",opt2-option=""]</code>.
51
- </li><li>
52
- If you define a an option attribute globally (for example with an
53
- <a class="link" href="ar01s24.html" title="Attribute Entries">attribute entry</a>) then it will apply to all elements in the
54
- document.
55
- </li><li>
56
- AsciiDoc implements a number of predefined options which are listed
57
- in the <a class="link" href="apf.html" title="F. Attribute Options">Attribute Options appendix</a>.
58
- </li></ul></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="_macro_attribute_lists"></a>Macro Attribute lists</h3></div></div></div><p>Macros calls are suffixed with an attribute list. The list may be
59
- empty but it cannot be omitted. List entries are used to pass
60
- attribute values to macro markup templates.</p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ar01s24.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ar01s26.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Attribute Entries </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Attribute References</td></tr></table></div></body></html>
@@ -1,217 +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>Attribute References</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="ar01s25.html" title="Attribute Lists" /><link rel="next" href="ar01s27.html" title="Intrinsic Attributes" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Attribute References</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ar01s25.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ar01s27.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="_attribute_references"></a>Attribute References</h2></div></div></div><p>An attribute reference is an attribute name (possibly followed by an
4
- additional parameters) enclosed in curly braces. When an attribute
5
- reference is encountered it is evaluated and replaced by its
6
- corresponding text value. If the attribute is undefined the line
7
- containing the attribute is dropped.</p><p>There are three types of attribute reference: <span class="emphasis"><em>Simple</em></span>, <span class="emphasis"><em>Conditional</em></span>
8
- and <span class="emphasis"><em>System</em></span>.</p><div class="itemizedlist"><p class="title"><b>Attribute reference evaluation</b></p><ul type="disc"><li>
9
- You can suppress attribute reference expansion by placing a
10
- backslash character immediately in front of the opening brace
11
- character.
12
- </li><li>
13
- By default attribute references are not expanded in
14
- <span class="emphasis"><em>LiteralParagraphs</em></span>, <span class="emphasis"><em>ListingBlocks</em></span> or <span class="emphasis"><em>LiteralBlocks</em></span>.
15
- </li><li>
16
- Attribute substitution proceeds line by line in reverse line order.
17
- </li><li>
18
- Attribute reference evaluation is performed in the following order:
19
- <span class="emphasis"><em>Simple</em></span> then <span class="emphasis"><em>Conditional</em></span> and finally <span class="emphasis"><em>System</em></span>.
20
- </li></ul></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="_simple_attributes_references"></a>Simple Attributes References</h3></div></div></div><p>Simple attribute references take the form <code class="literal">{&lt;name&gt;}</code>. If the
21
- attribute name is defined its text value is substituted otherwise the
22
- line containing the reference is dropped from the output.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="_conditional_attribute_references"></a>Conditional Attribute References</h3></div></div></div><p>Additional parameters are used in conjunction with attribute names to
23
- calculate a substitution value. Conditional attribute references take
24
- the following forms:</p><div class="variablelist"><dl><dt><span class="term">
25
- <code class="literal">{&lt;names&gt;=&lt;value&gt;}</code>
26
- </span></dt><dd>
27
- <code class="literal">&lt;value&gt;</code> is substituted if the attribute <code class="literal">&lt;names&gt;</code> is
28
- undefined otherwise its value is substituted. <code class="literal">&lt;value&gt;</code> can
29
- contain simple attribute references.
30
- </dd><dt><span class="term">
31
- <code class="literal">{&lt;names&gt;?&lt;value&gt;}</code>
32
- </span></dt><dd>
33
- <code class="literal">&lt;value&gt;</code> is substituted if the attribute <code class="literal">&lt;names&gt;</code> is defined
34
- otherwise an empty string is substituted. <code class="literal">&lt;value&gt;</code> can
35
- contain simple attribute references.
36
- </dd><dt><span class="term">
37
- <code class="literal">{&lt;names&gt;!&lt;value&gt;}</code>
38
- </span></dt><dd>
39
- <code class="literal">&lt;value&gt;</code> is substituted if the attribute <code class="literal">&lt;names&gt;</code> is
40
- undefined otherwise an empty string is substituted. <code class="literal">&lt;value&gt;</code>
41
- can contain simple attribute references.
42
- </dd><dt><span class="term">
43
- <code class="literal">{&lt;names&gt;#&lt;value&gt;}</code>
44
- </span></dt><dd>
45
- <code class="literal">&lt;value&gt;</code> is substituted if the attribute <code class="literal">&lt;names&gt;</code> is defined
46
- otherwise the undefined attribute entry causes the containing
47
- line to be dropped. <code class="literal">&lt;value&gt;</code> can contain simple attribute
48
- references.
49
- </dd><dt><span class="term">
50
- <code class="literal">{&lt;names&gt;%&lt;value&gt;}</code>
51
- </span></dt><dd>
52
- <code class="literal">&lt;value&gt;</code> is substituted if the attribute <code class="literal">&lt;names&gt;</code> is not
53
- defined otherwise the containing line is dropped. <code class="literal">&lt;value&gt;</code>
54
- can contain simple attribute references.
55
- </dd><dt><span class="term">
56
- <code class="literal">{&lt;names&gt;@&lt;regexp&gt;:&lt;value1&gt;[:&lt;value2&gt;]}</code>
57
- </span></dt><dd>
58
- <code class="literal">&lt;value1&gt;</code> is substituted if the value of attribute <code class="literal">&lt;names&gt;</code>
59
- matches the regular expression <code class="literal">&lt;regexp&gt;</code> otherwise <code class="literal">&lt;value2&gt;</code>
60
- is substituted. If attribute <code class="literal">&lt;names&gt;</code> is not defined the
61
- containing line is dropped. If <code class="literal">&lt;value2&gt;</code> is omitted an empty
62
- string is assumed. The values and the regular expression can
63
- contain simple attribute references. To embed colons in the
64
- values or the regular expression escape them with backslashes.
65
- </dd><dt><span class="term">
66
- <code class="literal">{&lt;names&gt;$&lt;regexp&gt;:&lt;value1&gt;[:&lt;value2&gt;]}</code>
67
- </span></dt><dd><p>
68
- Same behavior as the previous ternary attribute except for
69
- the following cases:
70
- </p><div class="variablelist"><dl><dt><span class="term">
71
- <code class="literal">{&lt;names&gt;$&lt;regexp&gt;:&lt;value&gt;}</code>
72
- </span></dt><dd>
73
- Substitutes <code class="literal">&lt;value&gt;</code> if <code class="literal">&lt;names&gt;</code> matches <code class="literal">&lt;regexp&gt;</code>
74
- otherwise the result is undefined and the containing
75
- line is dropped.
76
- </dd><dt><span class="term">
77
- <code class="literal">{&lt;names&gt;$&lt;regexp&gt;::&lt;value&gt;}</code>
78
- </span></dt><dd>
79
- Substitutes <code class="literal">&lt;value&gt;</code> if <code class="literal">&lt;names&gt;</code> does not match
80
- <code class="literal">&lt;regexp&gt;</code> otherwise the result is undefined and the
81
- containing line is dropped.
82
- </dd></dl></div></dd></dl></div><p>The attribute <code class="literal">&lt;names&gt;</code> parameter normally consists of a single
83
- attribute name but it can be any one of the following:</p><div class="itemizedlist"><ul type="disc"><li>
84
- A single attribute name which evaluates to the attributes value.
85
- </li><li>
86
- Multiple <span class="emphasis"><em>,</em></span> separated attribute names which evaluates to an empty
87
- string if one or more of the attributes is defined, otherwise it’s
88
- value is undefined.
89
- </li><li>
90
- Multiple <span class="emphasis"><em>+</em></span> separated attribute names which evaluates to an empty
91
- string if all of the attributes are defined, otherwise it’s value is
92
- undefined.
93
- </li></ul></div><p>Conditional attributes with single attribute names are evaluated first
94
- so they can be used inside the multi-attribute conditional <code class="literal">&lt;value&gt;</code>.</p><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="_conditional_attribute_examples"></a>Conditional attribute examples</h4></div></div></div><p>Conditional attributes are mainly used in AsciiDoc configuration
95
- files — see the distribution <code class="literal">.conf</code> files for examples.</p><div class="variablelist"><dl><dt><span class="term">
96
- Attribute equality test
97
- </span></dt><dd><p>
98
- If <code class="literal">{backend}</code> is <code class="literal">docbook45</code> or <code class="literal">xhtml11</code> the example evaluates to
99
- “DocBook 4.5 or XHTML 1.1 backend” otherwise it evaluates to “some
100
- other backend”:
101
- </p><pre class="literallayout">{backend@docbook45|xhtml11:DocBook 4.5 or XHTML 1.1 backend:some other backend}</pre></dd><dt><span class="term">
102
- Attribute value map
103
- </span></dt><dd><p>
104
- This example maps the <code class="literal">frame</code> attribute values [<code class="literal">topbot</code>, <code class="literal">all</code>,
105
- <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>]:
106
- </p><pre class="literallayout">{frame@topbot:hsides}{frame@all:border}{frame@none:void}{frame@sides:vsides}</pre></dd></dl></div></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="X24"></a>System Attribute References</h3></div></div></div><p>System attribute references generate the attribute text value by
107
- executing a predefined action that is parametrized by one or more
108
- arguments. The syntax is <code class="literal">{&lt;action&gt;:&lt;arguments&gt;}</code>.</p><div class="variablelist"><dl><dt><span class="term">
109
- <code class="literal">{counter:&lt;attrname&gt;[:&lt;seed&gt;]}</code>
110
- </span></dt><dd><p>
111
- Increments the document attribute (if the attribute is
112
- undefined it is set to <code class="literal">1</code>). Returns the new attribute value.
113
- </p><div class="itemizedlist"><ul type="disc"><li>
114
- Counters generate global (document wide) attributes.
115
- </li><li>
116
- The optional <code class="literal">&lt;seed&gt;</code> specifies the counter’s initial value;
117
- it can be a number or a single letter; defaults to <span class="emphasis"><em>1</em></span>.
118
- </li><li>
119
- <code class="literal">&lt;seed&gt;</code> can contain simple and conditional attribute
120
- references.
121
- </li><li>
122
- The <span class="emphasis"><em>counter</em></span> system attribute will not be executed if the
123
- containing line is dropped by the prior evaluation of an
124
- undefined attribute.
125
- </li></ul></div></dd><dt><span class="term">
126
- <code class="literal">{counter2:&lt;attrname&gt;[:&lt;seed&gt;]}</code>
127
- </span></dt><dd>
128
- Same as <code class="literal">counter</code> except the it always returns a blank string.
129
- </dd><dt><span class="term">
130
- <code class="literal">{eval:&lt;expression&gt;}</code>
131
- </span></dt><dd><p>
132
- Substitutes the result of the Python <code class="literal">&lt;expression&gt;</code>.
133
- </p><div class="itemizedlist"><ul type="disc"><li>
134
- If <code class="literal">&lt;expression&gt;</code> evaluates to <code class="literal">None</code> or <code class="literal">False</code> the
135
- reference is deemed undefined and the line containing the
136
- reference is dropped from the output.
137
- </li><li>
138
- If the expression evaluates to <code class="literal">True</code> the attribute
139
- evaluates to an empty string.
140
- </li><li>
141
- <code class="literal">&lt;expression&gt;</code> can contain simple and conditional attribute
142
- references.
143
- </li><li>
144
- The <span class="emphasis"><em>eval</em></span> system attribute can be nested inside other
145
- system attributes.
146
- </li></ul></div></dd><dt><span class="term">
147
- <code class="literal">{eval3:&lt;command&gt;}</code>
148
- </span></dt><dd>
149
- Passthrough version of <code class="literal">{eval:&lt;expression&gt;}</code> — the generated
150
- output is written directly to the output without any further
151
- substitutions.
152
- </dd><dt><span class="term">
153
- <code class="literal">{include:&lt;filename&gt;}</code>
154
- </span></dt><dd><p>
155
- Substitutes contents of the file named <code class="literal">&lt;filename&gt;</code>.
156
- </p><div class="itemizedlist"><ul type="disc"><li>
157
- The included file is read at the time of attribute
158
- substitution.
159
- </li><li>
160
- If the file does not exist a warning is emitted and the line
161
- containing the reference is dropped from the output file.
162
- </li><li>
163
- Tabs are expanded based on the current <span class="emphasis"><em>tabsize</em></span> attribute
164
- value.
165
- </li></ul></div></dd><dt><span class="term">
166
- <code class="literal">{set:&lt;attrname&gt;[!][:&lt;value&gt;]}</code>
167
- </span></dt><dd><p>
168
- Sets or unsets document attribute. Normally only used in
169
- configuration file markup templates (use
170
- <a class="link" href="ar01s24.html" title="Attribute Entries">AttributeEntries</a> in AsciiDoc documents).
171
- </p><div class="itemizedlist"><ul type="disc"><li>
172
- If the attribute name is followed by an exclamation mark
173
- the attribute becomes undefined.
174
- </li><li>
175
- If <code class="literal">&lt;value&gt;</code> is omitted the attribute is set to a blank
176
- string.
177
- </li><li>
178
- <code class="literal">&lt;value&gt;</code> can contain simple and conditional attribute
179
- references.
180
- </li><li>
181
- Returns a blank string unless the attribute is undefined in
182
- which case the return value is undefined and the enclosing
183
- line will be dropped.
184
- </li></ul></div></dd><dt><span class="term">
185
- <code class="literal">{set2:&lt;attrname&gt;[!][:&lt;value&gt;]}</code>
186
- </span></dt><dd>
187
- Same as <code class="literal">set</code> except that the attribute scope is local to the
188
- template.
189
- </dd><dt><span class="term">
190
- <code class="literal">{sys:&lt;command&gt;}</code>
191
- </span></dt><dd>
192
- Substitutes the stdout generated by the execution of the shell
193
- <code class="literal">&lt;command&gt;</code>.
194
- </dd><dt><span class="term">
195
- <code class="literal">{sys2:&lt;command&gt;}</code>
196
- </span></dt><dd>
197
- Substitutes the stdout and stderr generated by the execution
198
- of the shell <code class="literal">&lt;command&gt;</code>.
199
- </dd><dt><span class="term">
200
- <code class="literal">{sys3:&lt;command&gt;}</code>
201
- </span></dt><dd>
202
- Passthrough version of <code class="literal">{sys:&lt;command&gt;}</code> — the generated
203
- output is written directly to the output without any further
204
- substitutions.
205
- </dd><dt><span class="term">
206
- <code class="literal">{template:&lt;template&gt;}</code>
207
- </span></dt><dd>
208
- Substitutes the contents of the configuration file section
209
- named <code class="literal">&lt;template&gt;</code>. Attribute references contained in the
210
- template are substituted.
211
- </dd></dl></div><div class="itemizedlist"><p class="title"><b>System reference behavior</b></p><ul type="disc"><li>
212
- System attribute arguments can contain non-system attribute
213
- references.
214
- </li><li>
215
- Closing brace characters inside system attribute arguments must be
216
- escaped with a backslash.
217
- </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="ar01s25.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ar01s27.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Attribute Lists </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Intrinsic Attributes</td></tr></table></div></body></html>
@@ -1,88 +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>Intrinsic Attributes</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="ar01s26.html" title="Attribute References" /><link rel="next" href="ar01s28.html" title="Block Element Definitions" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Intrinsic Attributes</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ar01s26.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ar01s28.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="X60"></a>Intrinsic Attributes</h2></div></div></div><p>Intrinsic attributes are simple attributes that are created
4
- automatically from: AsciiDoc document header parameters; asciidoc(1)
5
- command-line arguments; attributes defined in the default
6
- configuration files; the execution context. Here’s the list of
7
- predefined intrinsic attributes:</p><pre class="literallayout">{amp} ampersand (&amp;) character entity
8
- {asciidoc-dir} the asciidoc(1) application directory
9
- {asciidoc-file} the full path name of the asciidoc(1) script
10
- {asciidoc-version} the version of asciidoc(1)
11
- {author} author's full name
12
- {authored} empty string '' if {author} or {email} defined,
13
- {authorinitials} author initials (from document header)
14
- {backend-&lt;backend&gt;} empty string ''
15
- {&lt;backend&gt;-&lt;doctype&gt;} empty string ''
16
- {backend} document backend specified by `-b` option
17
- {backslash} backslash character
18
- {basebackend-&lt;base&gt;} empty string ''
19
- {basebackend} html or docbook
20
- {brvbar} broken vertical bar (|) character
21
- {revdate} document revision date (from document header)
22
- {docdate} document last modified date
23
- {doctime} document last modified time
24
- {docname} document file name without extension
25
- {docfile} document file name (note 5)
26
- {docdir} document input directory name (note 5)
27
- {doctitle} document title (from document header)
28
- {doctype-&lt;doctype&gt;} empty string ''
29
- {doctype} document type specified by `-d` option
30
- {email} author's email address (from document header)
31
- {empty} empty string ''
32
- {encoding} specifies input and output encoding
33
- {filetype-&lt;fileext&gt;} empty string ''
34
- {filetype} output file name file extension
35
- {firstname} author first name (from document header)
36
- {gt} greater than (&gt;) character entity
37
- {id} running block id generated by BlockId elements
38
- {indir} input file directory name (note 2,5)
39
- {infile} input file name (note 2,5)
40
- {lastname} author last name (from document header)
41
- {level} title level 1..4 (in section titles)
42
- {listindex} the list index (1..) of the most recent list item
43
- {localdate} the current date
44
- {localtime} the current time
45
- {lt} less than (&lt;) character entity
46
- {manname} manpage name (defined in NAME section)
47
- {manpurpose} manpage (defined in NAME section)
48
- {mantitle} document title minus the manpage volume number
49
- {manvolnum} manpage volume number (1..8) (from document header)
50
- {middlename} author middle name (from document header)
51
- {nbsp} non-breaking space character entity
52
- {notitle} do not display the document title
53
- {outdir} document output directory name (note 2)
54
- {outfile} output file name (note 2)
55
- {reftext} running block xreflabel generated by BlockId elements
56
- {revnumber} document revision number (from document header)
57
- {sectnum} formatted section number (in section titles)
58
- {showcomments} send comment lines to the output
59
- {title} section title (in titled elements)
60
- {two-colons} Two colon characters
61
- {two-semicolons} Two semicolon characters
62
- {user-dir} the ~/.asciidoc directory (if it exists)
63
- {verbose} defined as '' if --verbose command option specified
64
- {zwsp} Zero-width space character entity</pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><div class="orderedlist"><ol type="1"><li>
65
- Intrinsic attributes are global so avoid defining custom attributes
66
- with the same names.
67
- </li><li>
68
- <code class="literal">{outfile}</code>, <code class="literal">{outdir}</code>, <code class="literal">{infile}</code>, <code class="literal">{indir}</code> attributes are
69
- effectively read-only (you can set them but it won’t affect the
70
- input or output file paths).
71
- </li><li>
72
- See also the <a class="link" href="aph.html" title="H. Backend Attributes">Backend Attributes</a> section for attributes
73
- that relate to AsciiDoc XHTML file generation.
74
- </li><li>
75
- The entries that translate to blank strings are designed to be used
76
- for conditional text inclusion. You can also use the <code class="literal">ifdef</code>,
77
- <code class="literal">ifndef</code> and <code class="literal">endif</code> System macros for conditional inclusion.
78
- <sup>[<a id="id36128467" href="#ftn.id36128467" class="footnote">4</a>]</sup>
79
- </li><li>
80
- <code class="literal">{docfile}</code> and <code class="literal">{docdir}</code> refer to root document specified on
81
- the asciidoc(1) command-line; <code class="literal">{infile}</code> and <code class="literal">{indir}</code> refer to
82
- the current input file which may be the root document or an
83
- included file. When the input is being read from the standard
84
- input (<code class="literal">stdin</code>) these attributes are undefined.
85
- </li></ol></div></div><div class="footnotes"><br /><hr width="100" align="left" /><div class="footnote"><p><sup>[<a id="ftn.id36128467" href="#id36128467" class="simpara">4</a>] </sup>Conditional inclusion using <code class="literal">ifdef</code> and <code class="literal">ifndef</code> macros
86
- differs from attribute conditional inclusion in that the former
87
- occurs when the file is read while the latter occurs when the
88
- contents are written.</p></div></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ar01s26.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ar01s28.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Attribute References </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Block Element Definitions</td></tr></table></div></body></html>