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,95 +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>The second chapter</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="the_first_chapter.html">Prev</a><br/>
15
- The first chapter
16
-
17
- </td><td width="33%" align="center">
18
-
19
- <a href="index.html">Home</a><br/>
20
- <strong>Book Title</strong>
21
-
22
- </td><td width="33%" align="right">
23
-
24
- <a href="source_code_highlighting.html">Next</a><br/>
25
- Source Code Highlighting
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="_the_second_chapter"></a>The second chapter</h2></div></div></div>
37
- <p>Ut suspendisse nulla. Auctor felis facilisis. Rutrum vivamus nec
38
- lectus porttitor dui dapibus eu ridiculus tempor sodales et. Sit a
39
- cras. Id tellus cubilia erat.</p>
40
- <p>Quisque nullam et. Blandit dui tempor. Posuere in elit diam egestas
41
- sem vivamus vel ac.</p>
42
- <div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
43
- <h3 class="title">Tip</h3>
44
- <p>Tip.</p>
45
- </div>
46
- <div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
47
- <h3 class="title">Important</h3>
48
- <p>This is important.</p>
49
- </div>
50
- <div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
51
- <h3 class="title">Warning</h3>
52
- <p>This is a warning.</p>
53
- </div>
54
- <div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;">
55
- <h3 class="title">Caution</h3>
56
- <p>Tread lightly.</p>
57
- </div>
58
- <pre class="programlisting">#include &lt;stdio.h&gt;
59
-
60
- main()
61
- {
62
- char hex[] = "599955586da1c3ad514f3e65f1081d2012ec862d";
63
- git_oid oid;
64
-
65
- git_oid_mkstr(&amp;oid, hex);
66
- printf("Raw 20 bytes: [%s]\n", (&amp;oid)-&gt;id);
67
- }</pre>
68
- </div>
69
-
70
- </div>
71
-
72
- <hr/>
73
-
74
- <div class="nav" id="navfooter">
75
- <table width="100%">
76
- <tr><td width="33%" align="left">
77
-
78
- <a href="the_first_chapter.html">Prev</a><br/>
79
- The first chapter
80
-
81
- </td><td width="33%" align="center">
82
-
83
- <a href="index.html">Home</a><br/>
84
- Book Title
85
-
86
- </td><td width="33%" align="right">
87
-
88
- <a href="source_code_highlighting.html">Next</a><br/>
89
- Source Code Highlighting
90
-
91
- </td></tr>
92
- </table>
93
- </div>
94
- </body>
95
- </html>
@@ -1,58 +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="stylesheets/handbookish.css" type="text/css" />
6
- <title>Page The Third Chapter</title>
7
- </head>
8
-
9
- <body>
10
- <table width="100%">
11
- <tr><td width="33%" align="left">
12
-
13
- <a href="the_second_chapter.html">Prev</a><br/>
14
- The Second Chapter
15
-
16
- </td><td width="33%" align="center">
17
-
18
- <a href="index.html">Home</a><br/>
19
-
20
- </td><td width="33%" align="right">
21
-
22
- <a href="a_example_appendix.html">Next</a><br/>
23
- A. Example Appendix
24
-
25
- </td></tr>
26
- </table>
27
-
28
- <hr/>
29
-
30
- <div class="section" lang="en" xml:lang="en">
31
- <div class="titlepage"><div><div><h2 class="title" style="clear: both">
32
- <a id="_the_third_chapter"></a>The Third Chapter</h2></div></div></div>
33
- <p>Book chapters are at level 1 and can contain sub-sections.</p>
34
- </div>
35
-
36
-
37
- <hr/>
38
-
39
- <table width="100%">
40
- <tr><td width="33%" align="left">
41
-
42
- <a href="the_second_chapter.html">Prev</a><br/>
43
- The Second Chapter
44
-
45
- </td><td width="33%" align="center">
46
-
47
- <a href="index.html">Home</a><br/>
48
-
49
- </td><td width="33%" align="right">
50
-
51
- <a href="a_example_appendix.html">Next</a><br/>
52
- A. Example Appendix
53
-
54
- </td></tr>
55
- </table>
56
-
57
- </body>
58
- </html>
@@ -1,452 +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>Tips and Tricks</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="help_commands.html">Prev</a><br/>
15
- Help Commands
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="glossary.html">Next</a><br/>
25
- Glossary
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="_tips_and_tricks"></a>Tips and Tricks</h2></div></div></div>
37
- <div class="section" lang="en" xml:lang="en">
38
- <div class="titlepage"><div><div><h3 class="title">
39
- <a id="_know_your_editor"></a>Know Your Editor</h3></div></div></div>
40
- <p>Writing AsciiDoc documents will be a whole lot more pleasant if you
41
- know your favorite text editor. Learn how to indent and reformat text
42
- blocks, paragraphs, lists and sentences. <a class="link" href="tips_and_tricks.html#X20" title="Vim Commands for Formatting AsciiDoc">Tips for <span class="emphasis"><em>vim</em></span> users</a>
43
- follow.</p>
44
- </div>
45
- <div class="section" lang="en" xml:lang="en">
46
- <div class="titlepage"><div><div><h3 class="title">
47
- <a id="X20"></a>Vim Commands for Formatting AsciiDoc</h3></div></div></div>
48
- <div class="section" lang="en" xml:lang="en">
49
- <div class="titlepage"><div><div><h4 class="title">
50
- <a id="_text_wrap_paragraphs"></a>Text Wrap Paragraphs</h4></div></div></div>
51
- <p>Use the vim <code class="literal">:gq</code> command to reformat paragraphs. Setting the
52
- <span class="emphasis"><em>textwidth</em></span> sets the right text wrap margin; for example:</p>
53
- <pre class="literallayout">:set textwidth=70</pre>
54
- <p>To reformat a paragraph:</p>
55
- <div class="orderedlist"><ol type="1">
56
- <li>
57
- Position the cursor at the start of the paragraph.
58
- </li>
59
- <li>
60
- Type <code class="literal">gq}</code>.
61
- </li>
62
- </ol></div>
63
- <p>Execute <code class="literal">:help gq</code> command to read about the vim gq command.</p>
64
- <div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
65
- <h3 class="title">Tip</h3>
66
- <div class="itemizedlist"><ul type="disc">
67
- <li>
68
- Assign the <code class="literal">gq}</code> command to the Q key with the <code class="literal">nnoremap Q gq}</code>
69
- command or put it in your <code class="literal">~/.vimrc</code> file to so it’s always
70
- available (see the <a class="link" href="tips_and_tricks.html#X61" title="Example ~/.vimrc File">Example <code class="literal">~/.vimrc</code> file</a>).
71
- </li>
72
- <li>
73
- Put <code class="literal">set</code> commands in your <code class="literal">~/.vimrc</code> file so you don’t have to
74
- enter them manually.
75
- </li>
76
- <li>
77
- The Vim website (<a class="ulink" href="http://www.vim.org" target="_top">http://www.vim.org</a>) has a wealth of resources,
78
- including scripts for automated spell checking and ASCII Art
79
- drawing.
80
- </li>
81
- </ul></div>
82
- </div>
83
- </div>
84
- <div class="section" lang="en" xml:lang="en">
85
- <div class="titlepage"><div><div><h4 class="title">
86
- <a id="_format_lists"></a>Format Lists</h4></div></div></div>
87
- <p>The <code class="literal">gq</code> command can also be used to format bulleted, numbered and
88
- callout lists. First you need to set the <code class="literal">comments</code>, <code class="literal">formatoptions</code>
89
- and <code class="literal">formatlistpat</code> (see the <a class="link" href="tips_and_tricks.html#X61" title="Example ~/.vimrc File">Example <code class="literal">~/.vimrc</code> file</a>).</p>
90
- <p>Now you can format simple lists that use dash, asterisk, period and
91
- plus bullets along with numbered ordered lists:</p>
92
- <div class="orderedlist"><ol type="1">
93
- <li>
94
- Position the cursor at the start of the list.
95
- </li>
96
- <li>
97
- Type <code class="literal">gq}</code>.
98
- </li>
99
- </ol></div>
100
- </div>
101
- <div class="section" lang="en" xml:lang="en">
102
- <div class="titlepage"><div><div><h4 class="title">
103
- <a id="_indent_paragraphs"></a>Indent Paragraphs</h4></div></div></div>
104
- <p>Indent whole paragraphs by indenting the fist line with the desired
105
- indent and then executing the <code class="literal">gq}</code> command.</p>
106
- </div>
107
- <div class="section" lang="en" xml:lang="en">
108
- <div class="titlepage"><div><div><h4 class="title">
109
- <a id="X61"></a>Example <code class="literal">~/.vimrc</code> File</h4></div></div></div>
110
- <pre class="screen">" Use bold bright fonts.
111
- set background=dark
112
-
113
- " Show tabs and trailing characters.
114
- set listchars=tab:»·,trail:·
115
- set list
116
-
117
- " Don't highlight searched text.
118
- highlight clear Search
119
-
120
- " Don't move to matched text while search pattern is being entered.
121
- set noincsearch
122
-
123
- " Reformat paragraphs and list.
124
- nnoremap R gq}
125
-
126
- " Delete trailing white space and Dos-returns and to expand tabs to spaces.
127
- nnoremap S :set et&lt;CR&gt;:retab!&lt;CR&gt;:%s/[\r \t]\+$//&lt;CR&gt;
128
-
129
- autocmd BufRead,BufNewFile *.txt,README,TODO,CHANGELOG,NOTES
130
- \ setlocal autoindent expandtab tabstop=8 softtabstop=2 shiftwidth=2 filetype=asciidoc
131
- \ textwidth=70 wrap formatoptions=tcqn
132
- \ formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\\|^\\s*&lt;\\d\\+&gt;\\s\\+\\\\|^\\s*[a-zA-Z.]\\.\\s\\+\\\\|^\\s*[ivxIVX]\\+\\.\\s\\+
133
- \ comments=s1:/*,ex:*/,://,b:#,:%,:XCOMM,fb:-,fb:*,fb:+,fb:.,fb:&gt;</pre>
134
- </div>
135
- </div>
136
- <div class="section" lang="en" xml:lang="en">
137
- <div class="titlepage"><div><div><h3 class="title">
138
- <a id="_troubleshooting"></a>Troubleshooting</h3></div></div></div>
139
- <p>AsciiDoc diagnostic features are detailed in the <a class="link" href="g_diagnostics.html" title="G. Diagnostics">Diagnostics appendix</a>.</p>
140
- </div>
141
- <div class="section" lang="en" xml:lang="en">
142
- <div class="titlepage"><div><div><h3 class="title">
143
- <a id="_gotchas"></a>Gotchas</h3></div></div></div>
144
- <div class="variablelist"><dl>
145
- <dt><span class="term">
146
- Incorrect character encoding
147
- </span></dt>
148
- <dd>
149
- If you get an error message like <code class="literal">'UTF-8' codec can't decode ...</code>
150
- then you source file contains invalid UTF-8 characters — set the
151
- AsciiDoc <a class="link" href="h_backend_attributes.html#X54">encoding attribute</a> for the correct character set
152
- (typically ISO-8859-1 (Latin-1) for European languages).
153
- </dd>
154
- <dt><span class="term">
155
- Invalid output
156
- </span></dt>
157
- <dd>
158
- <p>
159
- AsciiDoc attempts to validate the input AsciiDoc source but makes
160
- no attempt to validate the output markup, it leaves that to
161
- external tools such as <code class="literal">xmllint(1)</code> (integrated into <code class="literal">a2x(1)</code>).
162
- Backend validation cannot be hardcoded into AsciiDoc because
163
- backends are dynamically configured. The following example
164
- generates valid HTML but invalid DocBook (the DocBook <code class="literal">literal</code>
165
- element cannot contain an <code class="literal">emphasis</code> element):
166
- </p>
167
- <pre class="literallayout">+monospaced text with an _emphasized_ word+</pre>
168
- </dd>
169
- <dt><span class="term">
170
- Misinterpreted text formatting
171
- </span></dt>
172
- <dd>
173
- <p>
174
- You can suppress markup expansion by placing a backslash character
175
- immediately in front of the element. The following example
176
- suppresses inline monospaced formatting:
177
- </p>
178
- <pre class="literallayout">\+1 for C++.</pre>
179
- </dd>
180
- <dt><span class="term">
181
- Overlapping text formatting
182
- </span></dt>
183
- <dd>
184
- <p>
185
- Overlapping text formatting will generate illegal overlapping
186
- markup tags which will result in downstream XML parsing errors.
187
- Here’s an example:
188
- </p>
189
- <pre class="literallayout">Some *strong markup _that overlaps* emphasized markup_.</pre>
190
- </dd>
191
- <dt><span class="term">
192
- Ambiguous underlines
193
- </span></dt>
194
- <dd>
195
- A DelimitedBlock can immediately follow a paragraph without an
196
- intervening blank line, but be careful, a single line paragraph
197
- underline may be misinterpreted as a section title underline
198
- resulting in a “closing block delimiter expected” error.
199
- </dd>
200
- <dt><span class="term">
201
- Ambiguous ordered list items
202
- </span></dt>
203
- <dd>
204
- <p>
205
- Lines beginning with numbers at the end of sentences will be
206
- interpreted as ordered list items. The following example
207
- (incorrectly) begins a new list with item number 1999:
208
- </p>
209
- <pre class="literallayout">He was last sighted in
210
- 1999. Since then things have moved on.</pre>
211
- <p>The <span class="emphasis"><em>list item out of sequence</em></span> warning makes it unlikely that this
212
- problem will go unnoticed.</p>
213
- </dd>
214
- <dt><span class="term">
215
- Special characters in attribute values
216
- </span></dt>
217
- <dd>
218
- <p>
219
- Special character substitution precedes attribute substitution so
220
- if attribute values contain special characters you may, depending
221
- on the substitution context, need to escape the special characters
222
- yourself. For example:
223
- </p>
224
- <pre class="literallayout">$ asciidoc -a 'orgname=Bill &amp;amp; Ben Inc.' mydoc.txt</pre>
225
- </dd>
226
- <dt><span class="term">
227
- Attribute lists
228
- </span></dt>
229
- <dd>
230
- <p>
231
- If any named attribute entries are present then all string
232
- attribute values must be quoted. For example:
233
- </p>
234
- <pre class="literallayout">["Desktop screenshot",width=32]</pre>
235
- </dd>
236
- </dl></div>
237
- </div>
238
- <div class="section" lang="en" xml:lang="en">
239
- <div class="titlepage"><div><div><h3 class="title">
240
- <a id="X90"></a>Combining separate documents</h3></div></div></div>
241
- <p>You have a number of stand-alone AsciiDoc documents that you want to
242
- process as a single document. Simply processing them with a series of
243
- <code class="literal">include</code> macros won’t work because the documents contain (level 0)
244
- document titles. The solution is to create a top level wrapper
245
- document and use the <code class="literal">leveloffset</code> attribute to push them all down one
246
- level. For example:</p>
247
- <pre class="screen">Combined Document Title
248
- _______________________
249
-
250
- :leveloffset: 1
251
-
252
- include::document1.txt[]
253
-
254
- include::document2.txt[]
255
-
256
- include::document3.txt[]</pre>
257
- <p>The document titles in the included documents will now be processed as
258
- level 1 section titles, level 1 sections as level 2 sections and so
259
- on.</p>
260
- <div class="itemizedlist"><ul type="disc">
261
- <li>
262
- Put a blank line between the <code class="literal">include</code> macro lines to ensure the
263
- title of the included document is not seen as part of the last
264
- paragraph of the previous document.
265
- </li>
266
- <li>
267
- You won’t want non-title document header lines (for example, Author
268
- and Revision lines) in the included files — conditionally exclude
269
- them if they are necessary for stand-alone processing.
270
- </li>
271
- </ul></div>
272
- </div>
273
- <div class="section" lang="en" xml:lang="en">
274
- <div class="titlepage"><div><div><h3 class="title">
275
- <a id="_processing_document_sections_separately"></a>Processing document sections separately</h3></div></div></div>
276
- <p>You have divided your AsciiDoc document into separate files (one per
277
- top level section) which are combined and processed with the following
278
- top level document:</p>
279
- <pre class="screen">Combined Document Title
280
- =======================
281
- Joe Bloggs
282
- v1.0, 12-Aug-03
283
-
284
- include::section1.txt[]
285
-
286
- include::section2.txt[]
287
-
288
- include::section3.txt[]</pre>
289
- <p>You also want to process the section files as separate documents.
290
- This is easy because asciidoc(1) will quite happily process
291
- <code class="literal">section1.txt</code>, <code class="literal">section2.txt</code> and <code class="literal">section3.txt</code> separately — the
292
- resulting output documents contain the section but have no document
293
- title.</p>
294
- </div>
295
- <div class="section" lang="en" xml:lang="en">
296
- <div class="titlepage"><div><div><h3 class="title">
297
- <a id="_processing_document_snippets"></a>Processing document snippets</h3></div></div></div>
298
- <p>Use the <code class="literal">-s</code> (<code class="literal">--no-header-footer</code>) command-line option to suppress
299
- header and footer output, this is useful if the processed output is to
300
- be included in another file. For example:</p>
301
- <pre class="literallayout">$ asciidoc -sb docbook section1.txt</pre>
302
- <p>asciidoc(1) can be used as a filter, so you can pipe chunks of text
303
- through it. For example:</p>
304
- <pre class="literallayout">$ echo 'Hello *World!*' | asciidoc -s -
305
- &lt;div class="paragraph"&gt;&lt;p&gt;Hello &lt;strong&gt;World!&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;</pre>
306
- </div>
307
- <div class="section" lang="en" xml:lang="en">
308
- <div class="titlepage"><div><div><h3 class="title">
309
- <a id="_badges_in_html_page_footers"></a>Badges in HTML page footers</h3></div></div></div>
310
- <p>See the <code class="literal">[footer]</code> section in the AsciiDoc distribution <code class="literal">xhtml11.conf</code>
311
- configuration file.</p>
312
- </div>
313
- <div class="section" lang="en" xml:lang="en">
314
- <div class="titlepage"><div><div><h3 class="title">
315
- <a id="_pretty_printing_asciidoc_output"></a>Pretty printing AsciiDoc output</h3></div></div></div>
316
- <p>If the indentation and layout of the asciidoc(1) output is not to your
317
- liking you can:</p>
318
- <div class="orderedlist"><ol type="1">
319
- <li>
320
- Change the indentation and layout of configuration file markup
321
- template sections. The <code class="literal">{empty}</code> attribute is useful for outputting
322
- trailing blank lines in markup templates.
323
- </li>
324
- <li>
325
- <p>
326
- Use Dave Raggett’s <a class="ulink" href="http://tidy.sourceforge.net/" target="_top">HTML Tidy</a> program
327
- to tidy asciidoc(1) output. Example:
328
- </p>
329
- <pre class="literallayout">$ asciidoc -b docbook -o - mydoc.txt | tidy -indent -xml &gt;mydoc.xml</pre>
330
- </li>
331
- <li>
332
- <p>
333
- Use the <code class="literal">xmllint(1)</code> format option. Example:
334
- </p>
335
- <pre class="literallayout">$ xmllint --format mydoc.xml</pre>
336
- </li>
337
- </ol></div>
338
- </div>
339
- <div class="section" lang="en" xml:lang="en">
340
- <div class="titlepage"><div><div><h3 class="title">
341
- <a id="_supporting_minor_docbook_dtd_variations"></a>Supporting minor DocBook DTD variations</h3></div></div></div>
342
- <p>The conditional inclusion of DocBook SGML markup at the end of the
343
- distribution <code class="literal">docbook45.conf</code> file illustrates how to support minor
344
- DTD variations. The included sections override corresponding entries
345
- from preceding sections.</p>
346
- </div>
347
- <div class="section" lang="en" xml:lang="en">
348
- <div class="titlepage"><div><div><h3 class="title">
349
- <a id="_creating_stand_alone_html_documents"></a>Creating stand-alone HTML documents</h3></div></div></div>
350
- <p>If you’ve ever tried to send someone an HTML document that includes
351
- stylesheets and images you’ll know that it’s not as straight-forward
352
- as exchanging a single file. AsciiDoc has options to create
353
- stand-alone documents containing embedded images, stylesheets and
354
- scripts. The following AsciiDoc command creates a single file
355
- containing <a class="link" href="macros.html#X66" title="Embedding images in XHTML documents">embedded images</a>, CSS stylesheets, and JavaScript
356
- (for table of contents and footnotes):</p>
357
- <pre class="literallayout">$ asciidoc -a data-uri -a icons -a toc -a max-width=55em article.txt</pre>
358
- <p>You can view the HTML file here: <a class="ulink" href="http://www.methods.co.nz/asciidoc/article-standalone.html" target="_top">http://www.methods.co.nz/asciidoc/article-standalone.html</a></p>
359
- </div>
360
- <div class="section" lang="en" xml:lang="en">
361
- <div class="titlepage"><div><div><h3 class="title">
362
- <a id="_shipping_stand_alone_asciidoc_source"></a>Shipping stand-alone AsciiDoc source</h3></div></div></div>
363
- <p>Reproducing presentation documents from someone else’s source has one
364
- major problem: unless your configuration files are the same as the
365
- creator’s you won’t get the same output.</p>
366
- <p>The solution is to create a single backend specific configuration file
367
- using the asciidoc(1) <code class="literal">-c</code> (<code class="literal">--dump-conf</code>) command-line option. You
368
- then ship this file along with the AsciiDoc source document plus the
369
- <code class="literal">asciidoc.py</code> script. The only end user requirement is that they have
370
- Python installed (and that they consider you a trusted source). This
371
- example creates a composite HTML configuration file for <code class="literal">mydoc.txt</code>:</p>
372
- <pre class="literallayout">$ asciidoc -cb xhtml11 mydoc.txt &gt; mydoc-xhtml11.conf</pre>
373
- <p>Ship <code class="literal">mydoc.txt</code>, <code class="literal">mydoc-html.conf</code>, and <code class="literal">asciidoc.py</code>. With
374
- these three files (and a Python interpreter) the recipient can
375
- regenerate the HMTL output:</p>
376
- <pre class="literallayout">$ ./asciidoc.py -eb xhtml11 mydoc.txt</pre>
377
- <p>The <code class="literal">-e</code> (<code class="literal">--no-conf</code>) option excludes the use of implicit
378
- configuration files, ensuring that only entries from the
379
- <code class="literal">mydoc-html.conf</code> configuration are used.</p>
380
- </div>
381
- <div class="section" lang="en" xml:lang="en">
382
- <div class="titlepage"><div><div><h3 class="title">
383
- <a id="_inserting_blank_space"></a>Inserting blank space</h3></div></div></div>
384
- <p>Adjust your style sheets to add the correct separation between block
385
- elements. Inserting blank paragraphs containing a single non-breaking
386
- space character <code class="literal">{nbsp}</code> works but is an ad hoc solution compared
387
- to using style sheets.</p>
388
- </div>
389
- <div class="section" lang="en" xml:lang="en">
390
- <div class="titlepage"><div><div><h3 class="title">
391
- <a id="_closing_open_sections"></a>Closing open sections</h3></div></div></div>
392
- <p>You can close off section tags up to level <code class="literal">N</code> by calling the
393
- <code class="literal">eval::[Section.setlevel(N)]</code> system macro. This is useful if you
394
- want to include a section composed of raw markup. The following
395
- example includes a DocBook glossary division at the top section level
396
- (level 0):</p>
397
- <pre class="screen">ifdef::basebackend-docbook[]
398
-
399
- eval::[Section.setlevel(0)]
400
-
401
- +++++++++++++++++++++++++++++++
402
- &lt;glossary&gt;
403
- &lt;title&gt;Glossary&lt;/title&gt;
404
- &lt;glossdiv&gt;
405
- ...
406
- &lt;/glossdiv&gt;
407
- &lt;/glossary&gt;
408
- +++++++++++++++++++++++++++++++
409
- endif::basebackend-docbook[]</pre>
410
- </div>
411
- <div class="section" lang="en" xml:lang="en">
412
- <div class="titlepage"><div><div><h3 class="title">
413
- <a id="_validating_output_files"></a>Validating output files</h3></div></div></div>
414
- <p>Use <code class="literal">xmllint(1)</code> to check the AsciiDoc generated markup is both well
415
- formed and valid. Here are some examples:</p>
416
- <pre class="literallayout">$ xmllint --nonet --noout --valid docbook-file.xml
417
- $ xmllint --nonet --noout --valid xhtml11-file.html
418
- $ xmllint --nonet --noout --valid --html html4-file.html</pre>
419
- <p>The <code class="literal">--valid</code> option checks the file is valid against the document
420
- type’s DTD, if the DTD is not installed in your system’s catalog then
421
- it will be fetched from its Internet location. If you omit the
422
- <code class="literal">--valid</code> option the document will only be checked that it is well
423
- formed.</p>
424
- </div>
425
- </div>
426
-
427
- </div>
428
-
429
- <hr/>
430
-
431
- <div class="nav" id="navfooter">
432
- <table width="100%">
433
- <tr><td width="33%" align="left">
434
-
435
- <a href="help_commands.html">Prev</a><br/>
436
- Help Commands
437
-
438
- </td><td width="33%" align="center">
439
-
440
- <a href="index.html">Home</a><br/>
441
- AsciiDoc User Guide
442
-
443
- </td><td width="33%" align="right">
444
-
445
- <a href="glossary.html">Next</a><br/>
446
- Glossary
447
-
448
- </td></tr>
449
- </table>
450
- </div>
451
- </body>
452
- </html>