erbook 4.0.0 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. data/README +3 -3
  2. data/Rakefile +6 -3
  3. data/bin/erbook +285 -251
  4. data/doc/README +2 -2
  5. data/doc/api/classes/ERBook.html +2 -2
  6. data/doc/api/classes/RDoc/AnyMethod.html +20 -20
  7. data/doc/api/classes/RDoc/AnyMethod.src/M000003.html +18 -0
  8. data/doc/api/classes/RDoc/AnyMethod.src/M000004.html +23 -0
  9. data/doc/api/classes/RDoc/AnyMethod.src/M000005.html +4 -4
  10. data/doc/api/classes/RDoc/AnyMethod.src/M000006.html +7 -8
  11. data/doc/api/classes/RDoc/TopLevel.html +30 -30
  12. data/doc/api/classes/RDoc/{AnyMethod.src → TopLevel.src}/M000007.html +4 -4
  13. data/doc/api/classes/RDoc/TopLevel.src/{M000014.html → M000008.html} +4 -4
  14. data/doc/api/classes/RDoc/TopLevel.src/M000009.html +4 -4
  15. data/doc/api/classes/RDoc/TopLevel.src/M000010.html +15 -4
  16. data/doc/api/classes/RDoc/TopLevel.src/M000011.html +11 -4
  17. data/doc/api/classes/RDoc/TopLevel.src/M000012.html +4 -15
  18. data/doc/api/classes/String.html +17 -82
  19. data/doc/api/classes/String.src/M000001.html +4 -4
  20. data/doc/api/classes/String.src/M000002.html +3 -6
  21. data/doc/api/created.rid +1 -1
  22. data/doc/api/files/lib/erbook/rdoc_rb.html +1 -1
  23. data/doc/api/files/lib/erbook/{html_rb.html → to_xhtml_rb.html} +7 -7
  24. data/doc/api/files/lib/erbook_rb.html +1 -1
  25. data/doc/api/fr_file_index.html +1 -1
  26. data/doc/api/fr_method_index.html +12 -14
  27. data/doc/api/index.html +1 -1
  28. data/doc/index.xhtml +2277 -0
  29. data/doc/manual.erb +198 -155
  30. data/fmt/xhtml.icons/index.yaml +20 -0
  31. data/fmt/xhtml.icons/mediawiki-1.13.2/COPYING +340 -0
  32. data/fmt/xhtml.icons/mediawiki-1.13.2/README +103 -0
  33. data/fmt/xhtml.icons/mediawiki-1.13.2/skins/simple/external.png +0 -0
  34. data/fmt/xhtml.icons/tango-icon-theme-0.8.1/48x48/README +2 -0
  35. data/fmt/{html.icons/note.png → xhtml.icons/tango-icon-theme-0.8.1/48x48/apps/accessories-text-editor.png} +0 -0
  36. data/fmt/{html.icons/quote.png → xhtml.icons/tango-icon-theme-0.8.1/48x48/apps/internet-group-chat.png} +0 -0
  37. data/fmt/{html.icons/important.png → xhtml.icons/tango-icon-theme-0.8.1/48x48/emblems/emblem-important.png} +0 -0
  38. data/fmt/{html.icons/warning.png → xhtml.icons/tango-icon-theme-0.8.1/48x48/status/dialog-error.png} +0 -0
  39. data/fmt/{html.icons/tip.png → xhtml.icons/tango-icon-theme-0.8.1/48x48/status/dialog-information.png} +0 -0
  40. data/fmt/{html.icons/caution.png → xhtml.icons/tango-icon-theme-0.8.1/48x48/status/dialog-warning.png} +0 -0
  41. data/fmt/{html.icons/LICENSE → xhtml.icons/tango-icon-theme-0.8.1/COPYING} +0 -0
  42. data/fmt/xhtml.icons/tango-icon-theme-0.8.1/README +12 -0
  43. data/fmt/{html.yaml → xhtml.yaml} +305 -247
  44. data/lib/erbook.rb +2 -2
  45. data/lib/erbook/{html.rb → to_xhtml.rb} +18 -24
  46. metadata +42 -21
  47. data/doc/api/classes/RDoc/AnyMethod.src/M000008.html +0 -22
  48. data/doc/api/classes/RDoc/TopLevel.src/M000013.html +0 -25
  49. data/doc/api/classes/String.src/M000003.html +0 -20
  50. data/doc/api/classes/String.src/M000004.html +0 -26
  51. data/doc/index.html +0 -2663
  52. data/fmt/html.icons/README +0 -31
data/doc/manual.erb CHANGED
@@ -1,4 +1,17 @@
1
1
  <%
2
+ ##
3
+ # Welcome to the source of the erbook user manual.
4
+ #
5
+ # The nodes in this file are hierarchically indented. As a result, you must
6
+ # process this file using the "--unindent" option to obtain proper output:
7
+ #
8
+ # erbook --unindent xhtml manual.erb > manual.xhtml
9
+ #
10
+ # Notice the '.xhtml' file extension in the output file name. Without that,
11
+ # most web browsers will not display the embedded graphics in the output file.
12
+ #
13
+ ##
14
+
2
15
  # local variables for this document
3
16
  pkg_url = File.join(ERBook::WEBSITE, 'pkg')
4
17
  src_url = File.join(ERBook::WEBSITE, 'src')
@@ -6,28 +19,25 @@
6
19
  dev_url = File.join(ERBook::WEBSITE, 'dev')
7
20
  log_url = File.join(ERBook::WEBSITE, 'log')
8
21
 
9
- # parameters for the HTML format
22
+ # parameters for the XHTML format
10
23
  $title = "#{ERBook::DISPLAY} user manual"
11
24
  $authors = { 'Suraj N. Kurapati' => 'http://snk.tuxfamily.org' }
12
25
  $feeds = { ann_url => :rss }
13
- $logo = '![erbook logo](erbook.png)'.to_html
26
+ $logo = '![erbook logo](erbook.png)'.to_xhtml
14
27
 
15
28
  def introduction
16
- %{erbook is an extensible document processor that emits #{ xref 'html', "HTML (web page)" }, #{ xref 'latex', "LaTeX (PDF)" }, #{ xref "man", "man (UNIX manual page)" }, #{ xref 'text', 'plain text' }, and #{ xref "HelloWorld", "any document format you can imagine" } from [eRuby templates](http://en.wikipedia.org/wiki/ERuby) that allow scripting and dynamic content generation.}
29
+ %{erbook is an extensible document processor that emits #{ xref 'xhtml', "XHTML (web page)" }, #{ xref 'latex', "LaTeX (PDF)" }, #{ xref "man", "man (UNIX manual page)" }, #{ xref 'text', 'plain text' }, and #{ xref "HelloWorld", "any document format you can imagine" } from [eRuby templates](http://en.wikipedia.org/wiki/ERuby) that allow scripting and dynamic content generation.}
17
30
  end
18
31
  %>
19
32
 
20
33
  <% abstract do %>
21
- <%= introduction %>
22
-
23
- <%= xref 'Introduction', '&rarr; Continue reading...' %>
24
- {: style="text-align: center; font-size: larger" }
34
+ <%= introduction %> <span style="float: right; font-size: larger"><%= xref 'Introduction', 'Read more...' %></span>
25
35
 
26
36
  <% paragraph "Resources" do %>
27
- * [Releases](<%= log_url %>) - release notes and project news. [![RSS feed](feed-icon-28x28.png)](<%= ann_url %>)
28
- * [Downloads](<%= pkg_url %>) - obtain the newest release package.
29
- * [Reference](api/index.html) - API documentation for source code.
30
- * [Source code](<%= src_url %>) - obtain via [Git](http://git.or.cz) or browse online. [![RSS feed](feed-icon-28x28.png)](<%= dev_url %>)
37
+ * [Release notes](<%= log_url %>) --- news of project releases. [![RSS feed](feed-icon-28x28.png)](<%= ann_url %>)
38
+ * [Downloads](<%= pkg_url %>) --- obtain the newest release package.
39
+ * [Source code](<%= src_url %>) --- obtain via [Git](http://git.or.cz) or browse online. [![RSS feed](feed-icon-28x28.png)](<%= dev_url %>)
40
+ * [API reference](api/index.html) --- documentation for source code.
31
41
 
32
42
  To get help or provide feedback, simply <%= xref "License", "contact the author" %>.
33
43
  <% end %>
@@ -38,16 +48,11 @@
38
48
 
39
49
  <% note "See the source of this manual" do %>
40
50
  Did you know that this manual was generated by erbook? Here is [the source document](manual.erb) to prove it!
41
-
42
- You may notice that the source document is hierarchically indented. As a result, it must be processed with the <tt>--unindent</tt> option to produce proper output:
43
-
44
- erbook --unindent html manual.erb
45
-
46
51
  <% end %>
47
52
 
48
53
  <% section "Relevance" do %>
49
54
  Unlike document processors such as [DocBook](http://www.docbook.org), [Deplate](http://deplate.sourceforge.net), and [SiSU](http://www.jus.uio.no/sisu/SiSU/), erbook is:
50
- * *tiny* because its core contains less than 200 source lines of code
55
+ * *tiny* because its core contains less than 210 source lines of code
51
56
  * *extensible* because it lets you define <%= xref "HelloWorld", "your own custom document format" %>
52
57
 
53
58
  Unlike the documents of raw text processors such as [AsciiDoc](http://www.methods.co.nz/asciidoc/), [txt2tags](http://txt2tags.sourceforge.net), and [Grutatxt](http://www.triptico.com/software/grutatxt.html), erbook documents are *scriptable* eRuby templates, which means that you can inject arbitrary Ruby code into your documents for **dynamic content generation**.
@@ -124,15 +129,16 @@
124
129
  <% section "Requirements" do %>
125
130
  Your system needs the following software to run erbook.
126
131
 
127
- | Software | Notes |
128
- |----------|-------|
129
- | [Ruby](http://ruby-lang.org) | Version 1.8.x is required. |
130
- | [Maruku](http://maruku.rubyforge.org) | Required by the <%= xref 'html', "default HTML format" %>. |
131
- | [CodeRay](http://coderay.rubychan.de) | Required by the <%= xref 'html', "default HTML format" %>. |
132
+ | Software | Description | Notes |
133
+ | -------- | ----------- | ----- |
134
+ | [Ruby](http://ruby-lang.org) | Ruby language interpreter | Version 1.8.x is required. |
135
+ | [Maruku](http://maruku.rubyforge.org) | Markdown processor | Required by the <%= xref 'xhtml', "default XHTML format" %>. |
136
+ | [CodeRay](http://coderay.rubychan.de) | Syntax highlighter | Required by the <%= xref 'xhtml', "default XHTML format" %>. |
137
+ | [Trollop](http://trollop.rubyforge.org) | Command-line option parser | Required by the *erbook* executable. |
132
138
 
133
139
  If your system has [RubyGems](http://rubygems.org), then you can install Maruku and CodeRay by running the following command:
134
140
 
135
- gem install maruku coderay
141
+ gem install trollop maruku coderay
136
142
 
137
143
  <% end %>
138
144
 
@@ -151,7 +157,7 @@
151
157
  ruby bin/erbook -v
152
158
 
153
159
  If the installation was successful, then you will see output like this:
154
- <pre><%=h `ruby bin/erbook -v` %></pre>
160
+ <pre><%= verbatim `ruby bin/erbook -v` %></pre>
155
161
 
156
162
  Otherwise, you can <%= xref "License", "contact the author" %> for help.
157
163
  <% end %>
@@ -177,7 +183,7 @@
177
183
 
178
184
  * <tt>erbook/</tt>
179
185
 
180
- * <tt>html.rb</tt> --- provides methods (see <%= xref "Text to HTML conversion" %>) for the <%= xref 'html' %> format.
186
+ * <tt>to_xhtml.rb</tt> --- provides methods (see <%= xref "Text to XHTML conversion" %>) for the <%= xref 'xhtml' %> format.
181
187
 
182
188
  * <tt>rdoc.rb</tt> --- provides RDoc parse trees to Ruby code.
183
189
 
@@ -233,47 +239,63 @@
233
239
 
234
240
  <%%= node_type node_argument1, node_argument2, ... %>
235
241
 
236
- Technically, nodes are Ruby method invocations composed of the following:
242
+ Alternatively, you may omit the leading "<" and trailing "%>" characters from an eRuby directive if the directive spans an _entire_ line. So, the above examples become:
243
+
244
+ %% node_type node_argument1, node_argument2, ... do |node_object|
245
+ node_content
246
+ %% end
247
+
248
+ And:
249
+
250
+ %% node_type node_argument1, node_argument2, ... do
251
+ node_content
252
+ %% end
253
+
254
+ And:
255
+
256
+ %%= node_type node_argument1, node_argument2, ...
237
257
 
238
- | Component | Description |
239
- |-----------|-------------|
240
- | `node_type` | name of the method being invoked |
241
- | `node_argument1, node_argument2, ...` | arguments for the method invocation |
242
- | `node_content` | a block argument being passed to the method invocation |
243
- | `node_object` | a `Node` object (see <%= xref "Node.class" %>) representing this method invocation |
258
+ Technically, nodes are Ruby method invocations composed of the following:
259
+
260
+ | Component | Description |
261
+ | --------- | ----------- |
262
+ | `node_type` | name of the method being invoked |
263
+ | `node_argument1, node_argument2, ...` | arguments for the method invocation |
264
+ | `node_content` | a block argument being passed to the method invocation |
265
+ | `node_object` | a `ERBook::Node` object (see <%= xref "Node.class" %>) representing this method invocation |
244
266
 
245
267
  A <%= xref 'SpecFile', 'format specification file' %> defines what types of nodes an input document may use.
246
268
 
247
- <% section "The `Node` class", "Node.class" do %>
248
- When erbook builds a document tree from the nodes in an input document, it stores information about these nodes into `Node` objects. A `Node` object has the following properties (methods):
249
-
250
- | Property | Type | Description |
251
- |----------|---------------|-------------|
252
- | type | `String` | Name of the type of this node. |
253
- | args | `Array` | Arguments passed to this node. |
254
- | content | `String` | The block of text passed to this node. |
255
- | output | `String` | Result of the node output template for the content of this node. |
256
- | digest | `String` | A unique identifier for the content of this node. |
257
- | trace | `Array` | A stack trace describing the location of this node in the input document. |
258
- | index | `String` | A LaTeX-style section number for this node. This property is only present if the **index** parameter is enabled in the definition of this type of node. |
259
- | number | `Integer` | An order-of-occurrence number for this node. This property is only present if the **number** parameter is enabled in the definition of this type of node. |
260
- | depth | `Integer` | Distance from the root of the document tree to this node. |
261
- | parent | `Node` | The `Node` object which contains this node. The value of this property will be `nil` if this node is a root of the document tree. |
262
- | children | `Array` of `Node` | List of child nodes from the document tree. |
263
-
264
- Furthermore, the `Node` class is derived from [Ruby's `OpenStruct` class](http://www.ruby-doc.org/stdlib/libdoc/ostruct/rdoc/classes/OpenStruct.html), so you can define new properties for `Node` objects dynamically.
269
+ <% section "The `ERBook::Node` class", "Node.class" do %>
270
+ When erbook builds a document tree from the nodes in an input document, it stores information about these nodes into `ERBook::Node` objects. A `ERBook::Node` object has the following properties (methods):
271
+
272
+ | Property | Type | Description |
273
+ | -------- | ---- | ----------- |
274
+ | type | `String` | Name of the type of this node. |
275
+ | args | `Array` | Arguments passed to this node. |
276
+ | content | `String` | The block of text passed to this node. |
277
+ | output | `String` | Result of the node output template for the content of this node. |
278
+ | digest | `String` | A unique identifier for the content of this node. |
279
+ | trace | `Array` | A stack trace describing the location of this node in the input document. |
280
+ | index | `String` | A LaTeX-style section number for this node. This property is only present if the **index** parameter is enabled in the definition of this type of node. |
281
+ | number | `Integer` | An order-of-occurrence number for this node. This property is only present if the **number** parameter is enabled in the definition of this type of node. |
282
+ | depth | `Integer` | Distance from the root of the document tree to this node. |
283
+ | parent | `ERBook::Node` | The `ERBook::Node` object which contains this node. The value of this property will be `nil` if this node is a root of the document tree. |
284
+ | children | `Array` of `ERBook::Node` | List of child nodes from the document tree. |
285
+
286
+ Furthermore, the `ERBook::Node` class is derived from [Ruby's `OpenStruct` class](http://www.ruby-doc.org/stdlib/libdoc/ostruct/rdoc/classes/OpenStruct.html), so you can define new properties for `ERBook::Node` objects dynamically.
265
287
  <% end %>
266
288
  <% end %>
267
289
 
268
290
  <% section "Format specification file", 'SpecFile' do %>
269
291
  A format specification file is a plain-text file marked up in [YAML syntax](http://yaml4r.sourceforge.net/cookbook/). Through the following parameters, it defines (1) what types of nodes an input document may contain, (2) how the content of those nodes is transformed into output, and (3) how the processed document is transformed into the output document.
270
292
 
271
- | Parameter | Type | Description |
272
- |-------------|--------|---------------|
273
- | desc | `String` | A short description of the output format. |
274
- | code | `String` | Ruby code that will be loaded before the input document is processed. This source code will be evaluated inside the main erbook executable, so any file-system or path-dependent portions of this source code should take appropriate precautions. |
275
- | nodes | Hash | A listing of <%= xref "SpecFile.nodes", "node definitions" %>. |
276
- | output | `String` | An eRuby template for the final output document. See <%= xref "SpecFile.output" %>. |
293
+ | Parameter | Type | Description |
294
+ | --------- | ---- | ----------- |
295
+ | desc | `String` | A short description of the output format. |
296
+ | code | `String` | Ruby code that will be loaded before the input document is processed. This source code will be evaluated inside the main erbook executable, so any file-system or path-dependent portions of this source code should take appropriate precautions. |
297
+ | nodes | Hash | A listing of <%= xref "SpecFile.nodes", "node definitions" %>. |
298
+ | output | `String` | An eRuby template for the final output document. See <%= xref "SpecFile.output" %>. |
277
299
 
278
300
  <%
279
301
  # XXX: "declare" this local variable here (in the parent
@@ -285,12 +307,12 @@
285
307
  <% section "Node definition", "SpecFile.nodes" do %>
286
308
  A node definition is a mapping from a name (the "node type") to the following set of parameters:
287
309
 
288
- | Parameter | Type | Description |
289
- |-----------|-------|-------------|
290
- | index | Boolean | Assign a LaTeX-style section number to this node? |
291
- | number | Boolean | Assign an order-of-occurrence number to this node? |
292
- | silent | Boolean | Suppress the output of this node? |
293
- | output | `String` | An eRuby template for the content of this node. See <%= xref "SpecFile.nodes.output" %>. |
310
+ | Parameter | Type | Description |
311
+ | --------- | ---- | ----------- |
312
+ | index | Boolean | Assign a LaTeX-style section number to this node? |
313
+ | number | Boolean | Assign an order-of-occurrence number to this node? |
314
+ | silent | Boolean | Suppress the output of this node? |
315
+ | output | `String` | An eRuby template for the content of this node. See <%= xref "SpecFile.nodes.output" %>. |
294
316
 
295
317
  You may define additional parameters in a node definition if you want.
296
318
 
@@ -299,20 +321,20 @@
299
321
 
300
322
  The following variables are available for use in this template:
301
323
 
302
- | Variable | Type | Description |
303
- |----------|---------------|-------------|
304
- | `@node` | `Node` | the node for which this template is being evaluated |
324
+ | Variable | Type | Description |
325
+ | -------- | ---- | ----------- |
326
+ | `@node` | `ERBook::Node` | The node for which this template is being evaluated. |
305
327
  <%= common_template_vars = %{
306
- | `@roots` | `Array` of `Node` | All root nodes in the document tree. |
307
- | `@nodes` | `Array` of `Node` | All nodes in the document tree. |
308
- | `@types` | `Hash` | Mapping from node type (`String`) to array of `Node` objects having that type. |
309
- | `@spec` | `Hash` | Data from the format specification file. |
328
+ | `@roots` | `Array` of `ERBook::Node` | All root nodes in the document tree. |
329
+ | `@nodes` | `Array` of `ERBook::Node` | All nodes in the document tree. |
330
+ | `@types` | `Hash` | Mapping from node type (`String`) to array of `ERBook::Node` objects having that type. |
331
+ | `@spec` | `Hash` | Data from the format specification file. |
310
332
 
311
333
  erbook also provides the following mappings inside the `@spec` variable:
312
334
 
313
- | Expression | Type | Description |
314
- |--------------|------|-------------|
315
- | `@spec[:name]` | `String` | Short-hand name of the current format. |
335
+ | Expression | Type | Description |
336
+ | ---------- | ---- | ----------- |
337
+ | `@spec[:name]` | `String` | Short-hand name of the current format. |
316
338
  | `@spec[:file]` | `String` | Path of the current format specification file. |
317
339
  }.lstrip.gsub(/^ +/, '')
318
340
  %>
@@ -324,9 +346,9 @@
324
346
 
325
347
  The following variables are available for use in this template:
326
348
 
327
- | Variable | Type | Description |
328
- |-|-|-|
329
- | `@content` | `String` | Content of the processed document. |
349
+ | Variable | Type | Description |
350
+ | -------- | ---- | ----------- |
351
+ | `@content` | `String` | Content of the processed document. |
330
352
  <%= common_template_vars %>
331
353
  <% end %>
332
354
 
@@ -350,11 +372,11 @@
350
372
  4. Examine the <tt>HelloWorld.output</tt> file to your satisfaction!
351
373
 
352
374
  <% example "HelloWorld format specification file", "HelloWorld.spec" do %>
353
- <code lang="rhtml"><%=h File.read('doc/HelloWorld.spec') %></code>
375
+ <code lang="rhtml"><%= verbatim File.read('doc/HelloWorld.spec') %></code>
354
376
  <% end %>
355
377
 
356
378
  <% example "Input document for HelloWorld format", "HelloWorld.input" do %>
357
- <code lang="rhtml"><%=h File.read('doc/HelloWorld.input') %></code>
379
+ <code lang="rhtml"><%= verbatim File.read('doc/HelloWorld.input') %></code>
358
380
  <% end %>
359
381
 
360
382
  <% example "Output of HelloWorld format", "HelloWorld.output" do %>
@@ -368,17 +390,31 @@
368
390
  <% section "Command-line invocation" do %>
369
391
  <%=
370
392
  `ruby bin/erbook -h`.
371
- gsub(/^ {4}(\S+(?:, \S+)?) {4,}(.*)$/, "\\1\n: \\2\n"). # option listing
372
- gsub(/-\w\b|--\w{2,}/, '<tt>\&</tt>'). # option names
373
- gsub(/^\S+?: */, "<b>\\&</b>\n"). # section headings
374
- sub(/^erbook \[.*/, '<pre>\&</pre>')
393
+ gsub(/^ +(.*?):(.*)$/, "\\1\n: \\2\n"). # option listing
394
+ gsub(/-\w\b|--\w{2,}/, '<tt>\&</tt>'). # option names
395
+ gsub(/^\S+?: */, "<b>\\&</b>\n"). # section headings
396
+ gsub(/^ *(erbook \[.*)/, '<pre>\1</pre>') # usage syntax
375
397
  %>
376
398
 
377
399
  <% paragraph "Command-line arguments" do %>
378
- As the <tt>{Format|SpecFile}</tt> token in the usage syntax above denotes, erbook requires its first command-line argument to be either (1) the name of a predefined format or (2) the path to a <%= xref 'SpecFile', 'format specification file' %>.
400
+ The first command-line argument to erbook is either the name of a predefined format (FormatName) or the path to a <%= xref 'SpecFile', 'format specification file' %> (FormatFile).
379
401
 
380
402
  Predefined formats are simply short-hand names of format specification files located in the <tt>fmt/</tt> subdirectory of the erbook installation directory (see <%= xref "Manifest" %>).
381
403
  <% end %>
404
+
405
+ <% paragraph "Saving the output to a file" do %>
406
+ Simply redirect the standard ouput stream (STDOUT) to a file like this:
407
+
408
+ erbook > YOUR_PATH_HERE
409
+
410
+ In the above example, **YOUR\_PATH\_HERE** is the path of the file in which the output should be saved.
411
+
412
+ <% important "Save XHTML output as <tt>.xhtml</tt>" do %>
413
+ When you use the XHTML format, ensure that the file extension of your saved output document is either <tt>.xhtml</tt> or <tt>.xml</tt>. Alternatively, ensure that your saved output document is served to web browsers under the <tt>application/xhtml+xml</tt> mime type.
414
+
415
+ Otherwise, most web browsers _will not display_ the icons and graphics embedded in the saved XHTML output document because they will treat it as HTML instead of as XML. See this [QuirksMode.org bug report](http://www.quirksmode.org/bugreports/archives/2005/02/custom_dtds_int_1.html) for details.
416
+ <% end %>
417
+ <% end %>
382
418
  <% end %>
383
419
 
384
420
  <% section "Including external documents", "include" do %>
@@ -403,35 +439,35 @@
403
439
 
404
440
  These formats are meant to serve as working examples. If you require more functionality from one of these formats, simply make a copy of the corresponding format specification file and edit the copy to suit your needs. If you would like to contribute or discuss your enhancements to these default formats, you can <%= xref "License", "contact the author" %>.
405
441
 
406
- <% chapter "HTML", 'html' do %>
407
- This format generates a _monolithic_ HTML document that allows users to easily search for a particular topic using nothing more than their web browser's built-in text search mechanism. This facilitates offline reading, where an Internet search engine is not available.
442
+ <% chapter "XHTML (web page)", 'xhtml' do %>
443
+ This format generates a _monolithic_ XHTML document that allows users to easily search for a particular topic using nothing more than their web browser's built-in text search mechanism. This facilitates offline reading, where an Internet search engine is not available.
408
444
 
409
- In the HTML document, you will notice that the numbers of chapters, sections, figures, admonitions, etc. are hyperlinks that take you back to the corresponding place in the table of contents. These links make it easy to navigate the HTML document, especially for users of text-only web browsers.
445
+ In the XHTML document, you will notice that the numbers of chapters, sections, figures, admonitions, etc. are hyperlinks that take you back to the corresponding place in the table of contents. These links make it easy to navigate the XHTML document, especially for users of text-only web browsers.
410
446
 
411
- Furthermore, the HTML document comes equipped with a stylesheet that makes it suitable for printing. In particular, users of the [Mozilla](http://mozilla.org) and [Opera](http://www.opera.com/) family of web browsers will be pleasantly surprised to notice that all hyperlinks have been expanded to include their target URL next to the link text. So try using the "print preview" function of a graphical web browser to see how the HTML document will appear when printed.
447
+ Furthermore, the XHTML document comes equipped with a stylesheet that makes it suitable for printing. In particular, users of the [Mozilla](http://mozilla.org) and [Opera](http://www.opera.com/) family of web browsers will be pleasantly surprised to notice that all hyperlinks have been expanded to include their target URL next to the link text. So try using the "print preview" function of a graphical web browser to see how the XHTML document will appear when printed.
412
448
 
413
- <% section "Text to HTML conversion" do %>
414
- Inside the <tt>fmt/</tt> subdirectory of the erbook installation directory (see <%= xref "Manifest" %>), you will see a <tt>html.rb</tt> file. This file defines methods that transform text in an input document into HTML:
449
+ <% section "Text to XHTML conversion" do %>
450
+ The <tt>lib/erbook/to_xhtml.rb</tt> file inside erbook's installation directory (see <%= xref "Manifest" %>) defines the following methods:
415
451
 
416
- * `String#to_html` - Transforms this string into HTML while ensuring that the result contains one or more block-level elements at the root.
452
+ * `String#to_xhtml` - Transforms this string into XHTML while ensuring that the result contains one or more block-level elements at the root.
417
453
 
418
- * `String.to_inline_html` - Transforms this string into an *inline* HTML string (one that does not contain any block-level HTML elements at the root).
454
+ * `String.to_inline_xhtml` - Transforms this string into an *inline* XHTML string (one that does not contain any block-level XHTML elements at the root).
419
455
 
420
- The default implementation of the `String#to_html` method employs the [Markdown](http://daringfireball.net/projects/markdown/) markup system. If you do not like Markdown or wish to use a different markup system for text in your documents, then simply edit the <tt>html.rb</tt> file and adjust the source code of the default `String#to_html` and `String.to_inline_html` methods accordingly.
456
+ The default implementation of the `String#to_xhtml` method employs the [Markdown](http://daringfireball.net/projects/markdown/) markup system. If you do not like Markdown or wish to use a different markup system for text in your documents, then simply edit the <tt>to_xhtml.rb</tt> file and adjust the source code of the default `String#to_xhtml` and `String.to_inline_xhtml` methods accordingly.
421
457
 
422
- For example, if you replace the entire <tt>html.rb</tt> file with the following code, then the output of all nodes will appear within red boxes in the final output document.
458
+ For example, if you replace the entire <tt>to_xhtml.rb</tt> file with the following code, then the output of all nodes will appear within red boxes in the final output document.
423
459
 
424
460
  <code>
425
461
  class String
426
- # Transforms this string into HTML while ensuring that the
462
+ # Transforms this string into XHTML while ensuring that the
427
463
  # result contains one or more block-level elements at the root.
428
- def to_html
464
+ def to_xhtml
429
465
  '<p style="border: thin solid red">' + self + '</p>'
430
466
  end
431
467
 
432
- # Transforms this string into an *inline* HTML string (one that
433
- # does not contain any block-level HTML elements at the root).
434
- def to_inline_html
468
+ # Transforms this string into an *inline* XHTML string (one that
469
+ # does not contain any block-level XHTML elements at the root).
470
+ def to_inline_xhtml
435
471
  self
436
472
  end
437
473
  end
@@ -476,15 +512,15 @@
476
512
 
477
513
  For example, here is some source code _without_ the `lang` attribute:
478
514
 
479
- <code><%=h sampleCode %></code>
515
+ <code><%= verbatim sampleCode %></code>
480
516
 
481
517
  And here is the same source code with a `lang="c"` attribute:
482
518
 
483
- <code lang="c"><%=h sampleCode %></code>
519
+ <code lang="c"><%= verbatim sampleCode %></code>
484
520
 
485
521
  And here is the same source code with a `lang="html"` attribute:
486
522
 
487
- <code lang="html"><%=h sampleCode %></code>
523
+ <code lang="html"><%= verbatim sampleCode %></code>
488
524
  <% end %>
489
525
  <% end %>
490
526
 
@@ -497,25 +533,24 @@
497
533
  <% end %>
498
534
 
499
535
  <% section "Protecting verbatim text" do %>
500
- Sometimes you just need to protect some text from being mangled by the text-to-HTML conversion process . In such cases, you can wrap the text you want to proctect within **&lt;noformat&gt;** and **&lt;/noformat&gt;** tags.
536
+ Sometimes you just need to protect some text from being mangled by the text-to-XHTML conversion process . In such cases, you can wrap the text you want to proctect within **&lt;noformat&gt;** and **&lt;/noformat&gt;** tags.
501
537
  <% end %>
502
538
  <% end %>
503
539
 
504
540
  <% section "Parameters" do %>
505
- The HTML format accepts the following document parameters.
506
-
507
- | Parameter | Type | Default value | Description |
508
- |-|-|-|-|
509
- | `$title` | `String` | `"$title"` | Title of the document. |
510
- | `$authors` | `Hash` | `{"$authors" => nil}` | A mapping of author name to author URL. You can obfuscate e-mail addresses using the provided `String#to_html_entities` method like this: `{ "Y. Matsumoto" => "mailto:matz@ruby.invalid".to_html_entities }` |
511
- | `$date` | `String` | `Time.now.strftime("%d %B %Y")` | Date when the document was written. |
512
- | `$logo` | `String` | `nil` | Arbitrary content that goes above the document title in the default header. |
513
- | `$feeds` | `Hash` | `nil` | A mapping of feed URL to feed format. Here is an example: <code>$feeds = { "my_rss_feed.xml" => "rss", "my_atom_feed.xml" => "atom" }</code>|
514
- | `$use_icons` | Boolean | `true` | Use [Tango icons](http://tango.freedesktop.org/Tango_Icon_Library) in admonitions (see <%= xref "Admonition nodes" %>)? |
541
+ The XHTML format accepts the following document parameters.
542
+
543
+ | Parameter | Type | Default value | Description |
544
+ | --------- | ---- | ------------- | ----------- |
545
+ | `$title` | `String` | `"$title"` | Title of the document. |
546
+ | `$authors` | `Hash` | `{"$authors" => nil}` | A mapping of author name to author URL. You can obfuscate e-mail addresses using the provided `String#to_xml_entities` method like this: `{ "Y. Matsumoto" => "mailto:matz@ruby.invalid".to_xml_entities }` |
547
+ | `$date` | `String` | `Time.now.strftime("%d %B %Y")` | Date when the document was written. |
548
+ | `$logo` | `String` | `nil` | Arbitrary content that goes above the document title in the default header. |
549
+ | `$feeds` | `Hash` | `nil` | A mapping of feed URL to feed format. Here is an example: <code>$feeds = { "my_rss_feed.xml" => "rss", "my_atom_feed.xml" => "atom" }</code> |
515
550
  <% end %>
516
551
 
517
552
  <% section "Methods" do %>
518
- The HTML format provides the following methods. In the method declarations shown below,
553
+ The XHTML format provides the following methods. In the method declarations shown below,
519
554
  * a pound sign (#) indicates that the method is an *instance method*, meaning that it can only be invoked on instances of a class, not on the classes themselves.
520
555
  * a double colon sign (::) indicates that the method is a *class method*, meaning that it can only be invoked on a class.
521
556
 
@@ -524,7 +559,7 @@
524
559
  require 'erbook/rdoc'
525
560
 
526
561
  RDoc::TopLevel.parse @spec['code']
527
- RDoc::TopLevel.parse_file 'lib/erbook/html.rb'
562
+ RDoc::TopLevel.parse_file 'lib/erbook/to_xhtml.rb'
528
563
  RDoc::TopLevel.all_methods.each do |m|
529
564
  section "`#{m.decl}`" do
530
565
  m.comment_html
@@ -533,36 +568,36 @@
533
568
  %>
534
569
  <% end %>
535
570
 
536
- <% chapter "Nodes", "html.nodes" do %>
537
- Unless otherwise noted, all nodes defined by the HTML format accept two arguments, in this order:
571
+ <% chapter "Nodes", "xhtml.nodes" do %>
572
+ Unless otherwise noted, all nodes defined by the XHTML format accept two arguments, in this order:
538
573
  1. a required *title* for the node
539
574
  2. an optional *unique identifier* for the node
540
575
 
541
- The second argument is used by the cross-referencing nodes (see <%= xref "html.nodes.xref" %> and <%= xref "html.nodes.cite" %>), which allow you to refer to another node in the document by its unique identifier.
576
+ The second argument is used by the cross-referencing nodes (see <%= xref "xhtml.nodes.xref" %> and <%= xref "xhtml.nodes.cite" %>), which allow you to refer to another node in the document by its unique identifier.
542
577
 
543
- Furthermore, <%= xref "SpecFile.nodes", "node definitions" %> in the HTML format have two additional parameters:
578
+ Furthermore, <%= xref "SpecFile.nodes", "node definitions" %> in the XHTML format have two additional parameters:
544
579
 
545
- | Parameter | Type | Description |
546
- |-|-|-|
547
- | toc | Boolean | Include this node in the **Table of Contents** (TOC)? |
548
- | lof | Boolean | Include this node in the **List of Figures** (LOF)? |
580
+ | Parameter | Type | Description |
581
+ | --------- | ---- | ----------- |
582
+ | toc | Boolean | Include this node in the **Table of Contents** (TOC)? |
583
+ | lof | Boolean | Include this node in the **List of Figures** (LOF)? |
549
584
 
550
585
  <% section "Structural nodes" do %>
551
586
  The nodes described in this section form the overall structure of the output document.
552
587
 
553
- <% section "header", "html.nodes.header" do %>
588
+ <% section "header", "xhtml.nodes.header" do %>
554
589
  This node overrides the logo, title, list of authors, and date when the document was written, all of which are shown at the top of the document.
555
590
  <% end %>
556
591
 
557
- <% section "footer", "html.nodes.footer" do %>
592
+ <% section "footer", "xhtml.nodes.footer" do %>
558
593
  This node overrides (1) the date when this document was generated and (2) the hyperlink to the erbook website, shown at the bottom of the document. The hyperlink is there as a way of saying thanks for erbook, the _wonderful_ little utility you have grown so fond of! ;-)
559
594
  <% end %>
560
595
 
561
- <% section "abstract", "html.nodes.abstract" do %>
596
+ <% section "abstract", "xhtml.nodes.abstract" do %>
562
597
  A summary of the entire document. This is what most readers will _skim_ through, if you are lucky. Alas, nobody reads entire documents these days! :-(
563
598
  <% end %>
564
599
 
565
- <% section "xref", "html.nodes.xref" do %>
600
+ <% section "xref", "xhtml.nodes.xref" do %>
566
601
  A cross-reference; a hyperlink that takes you to any node in the document.
567
602
 
568
603
  The first argument of this node is either the unique identifier or the user-defined title of the node you wish to cross-reference. If no nodes in the document have the given identifier or user-defined title, then an error will be raised.
@@ -586,7 +621,7 @@
586
621
  <% section "Organizational nodes" do %>
587
622
  The nodes described in this section are meant to help organize the document's content logically. Based on how deeply these nodes are nested in the document, their heading will be larger (shallow depth) or smaller (deep depth).
588
623
 
589
- <% section "part", "html.nodes.part" do %>
624
+ <% section "part", "xhtml.nodes.part" do %>
590
625
  A collection of chapters.
591
626
 
592
627
  <% part "An example" do %>
@@ -594,7 +629,7 @@
594
629
  <% end %>
595
630
  <% end %>
596
631
 
597
- <% section "chapter", "html.nodes.chapter" do %>
632
+ <% section "chapter", "xhtml.nodes.chapter" do %>
598
633
  A collection of sections.
599
634
 
600
635
  <% chapter "An example" do %>
@@ -602,7 +637,7 @@
602
637
  <% end %>
603
638
  <% end %>
604
639
 
605
- <% section "section", "html.nodes.section" do %>
640
+ <% section "section", "xhtml.nodes.section" do %>
606
641
  A collection of paragraphs about a particular topic.
607
642
 
608
643
  <% section "An example" do %>
@@ -610,7 +645,7 @@
610
645
  <% end %>
611
646
  <% end %>
612
647
 
613
- <% section "paragraph", "html.nodes.paragraph" do %>
648
+ <% section "paragraph", "xhtml.nodes.paragraph" do %>
614
649
  A collection of sentences about a particular idea.
615
650
 
616
651
  <% paragraph "An example" do %>
@@ -625,10 +660,10 @@
625
660
  I like to follow the KDE guidelines<%= cite "KDE.admonitions" %> when determining which admonition to use in my documents.
626
661
 
627
662
  <% reference "KDE.admonitions" do %>
628
- L. Watts, "Admonitions: Tips, hints, and Warnings", in _The KDE DocBook Authors guide_, Chapter 13, \[Online document], 22 September 2004 (Revision 1.00.00), \[cited 8 December 2007], Available at <%= link 'http://l10n.kde.org/docs/markup/tips-hints-etc.html' %>
663
+ L. Watts, "Admonitions: Tips, hints, and Warnings", in _The KDE DocBook Authors guide_, Chapter 13, \[Online document], 22 September 2004 (Revision 1.00.00), \[cited 8 December 2007], Available at <%= hyperlink 'http://l10n.kde.org/docs/markup/tips-hints-etc.html' %>
629
664
  <% end %>
630
665
 
631
- <% section "warning", "html.nodes.warning" do %>
666
+ <% section "warning", "xhtml.nodes.warning" do %>
632
667
  Use a **warning** node when "data loss could occur if you follow the procedure being described." <%= cite "KDE.admonitions" %>
633
668
 
634
669
  <% warning "An example" do %>
@@ -636,7 +671,7 @@
636
671
  <% end %>
637
672
  <% end %>
638
673
 
639
- <% section "caution", "html.nodes.caution" do %>
674
+ <% section "caution", "xhtml.nodes.caution" do %>
640
675
  bq. A note of caution. Use this for example when the reader may lose easily recovered or replaceable information (e.g. user settings), or when they could cause data loss if they don't correctly follow the procedure being outlined. <%= cite "KDE.admonitions" %>
641
676
 
642
677
  <% caution "An example" do %>
@@ -644,7 +679,7 @@
644
679
  <% end %>
645
680
  <% end %>
646
681
 
647
- <% section "important", "html.nodes.important" do %>
682
+ <% section "important", "xhtml.nodes.important" do %>
648
683
  Use an **important** node when:
649
684
 
650
685
  bq. When there is no danger of data loss, but you wish to make clear to the reader a consequence that isn't immediately obvious (e.g. when changing the font for one instance of a program also changes the default setting, and this isn't clear from the GUI.) <%= cite "KDE.admonitions" %>
@@ -654,7 +689,7 @@
654
689
  <% end %>
655
690
  <% end %>
656
691
 
657
- <% section "note", "html.nodes.note" do %>
692
+ <% section "note", "xhtml.nodes.note" do %>
658
693
  Use a **note** node to convey:
659
694
 
660
695
  bq. Information the user should be aware of, but is peripheral to the actual task being described. <%= cite "KDE.admonitions" %>
@@ -664,7 +699,7 @@
664
699
  <% end %>
665
700
  <% end %>
666
701
 
667
- <% section "tip", "html.nodes.tip" do %>
702
+ <% section "tip", "xhtml.nodes.tip" do %>
668
703
  Use a **tip** node when:
669
704
 
670
705
  bq. When you're giving a hint to make things easier or more productive for the reader. <%= cite "KDE.admonitions" %>
@@ -676,7 +711,7 @@
676
711
  <% end %>
677
712
 
678
713
  <% section "Auxilary materials" do %>
679
- <% section "figure", "html.nodes.figure" do %>
714
+ <% section "figure", "xhtml.nodes.figure" do %>
680
715
  A diagram, sketch, image, or illustration; something that visually depicts an idea or thought.
681
716
 
682
717
  <% figure "An example" do %>
@@ -684,7 +719,7 @@
684
719
  <% end %>
685
720
  <% end %>
686
721
 
687
- <% section "table", "html.nodes.table" do %>
722
+ <% section "table", "xhtml.nodes.table" do %>
688
723
  Information (typically measurement data) represented in tabular form for easy reading, comparison, and analysis.
689
724
 
690
725
  <% table "An example" do %>
@@ -692,7 +727,7 @@
692
727
  <% end %>
693
728
  <% end %>
694
729
 
695
- <% section "example", "html.nodes.example" do %>
730
+ <% section "example", "xhtml.nodes.example" do %>
696
731
  A sample application of an idea or thought.
697
732
 
698
733
  <% example "An example" do %>
@@ -700,7 +735,7 @@
700
735
  <% end %>
701
736
  <% end %>
702
737
 
703
- <% section "equation", "html.nodes.equation" do %>
738
+ <% section "equation", "xhtml.nodes.equation" do %>
704
739
  A mathematical equation or formula.
705
740
 
706
741
  <% equation "An example" do %>
@@ -708,7 +743,7 @@
708
743
  <% end %>
709
744
  <% end %>
710
745
 
711
- <% section "procedure", "html.nodes.procedure" do %>
746
+ <% section "procedure", "xhtml.nodes.procedure" do %>
712
747
  An outline; a series of steps outlining some kind of process.
713
748
 
714
749
  <% procedure "An example" do %>
@@ -720,50 +755,58 @@
720
755
  <% section "Bibliographical nodes" do %>
721
756
  The nodes in this section deal with attribution of ideas---an important weapon against plagiarism.
722
757
 
723
- <% section "reference", "html.nodes.reference" do %>
758
+ <% section "reference", "xhtml.nodes.reference" do %>
724
759
  This node stores bibliography information about an information source that is relevant to your document.
725
760
 
726
- If you wish to cite a certain source in several places in your document, start by creating a **reference** node first and then use a **cite** node (see <%= xref "html.nodes.cite" %>) to perform the citation.
761
+ If you wish to cite a certain source in several places in your document, start by creating a **reference** node first and then use a **cite** node (see <%= xref "xhtml.nodes.cite" %>) to perform the citation.
727
762
 
728
763
  <% paragraph "An example" do %>
729
- See <%= xref 'html.nodes.reference.example' %> for an example of how a **reference** node appears.
764
+ See <%= xref 'xhtml.nodes.reference.example' %> for an example of how a **reference** node appears.
730
765
  <% end %>
731
766
 
732
- <% reference 'html.nodes.reference.example' do %>
767
+ <% reference 'xhtml.nodes.reference.example' do %>
733
768
  This is how a **reference** node appears.
734
769
  <% end %>
735
770
  <% end %>
736
771
 
737
- <% section "cite", "html.nodes.cite" do %>
738
- A citation to a **reference** node (see <%= xref 'html.nodes.reference' %>) in the document's bibliography.
772
+ <% section "cite", "xhtml.nodes.cite" do %>
773
+ A citation to a **reference** node (see <%= xref 'xhtml.nodes.reference' %>) in the document's bibliography.
739
774
 
740
775
  The first argument of this node is the unique identifier of the reference node you wish to cite. You can specify additional arguments to give more detail about the citation.
741
776
 
742
777
  For example, this node in the input document:
743
778
 
744
- <%%= cite "html.nodes.reference.example" %>
779
+ <%%= cite "xhtml.nodes.reference.example" %>
745
780
 
746
- appears in the output document like this: <%= cite "html.nodes.reference.example" %>
781
+ appears in the output document like this: <%= cite "xhtml.nodes.reference.example" %>
747
782
 
748
783
  As another example, this node in the input document:
749
784
 
750
- <%%= cite "html.nodes.reference.example", "chapter 10", "page 53", "..." %>
785
+ <%%= cite "xhtml.nodes.reference.example", "chapter 10", "page 53", "..." %>
751
786
 
752
- appears in the output document like this: <%= cite "html.nodes.reference.example", "chapter 10", "page 53", "..." %>
787
+ appears in the output document like this: <%= cite "xhtml.nodes.reference.example", "chapter 10", "page 53", "..." %>
753
788
  <% end %>
754
789
  <% end %>
755
790
  <% end %>
756
791
  <% end %>
757
792
 
793
+ <% patches_are_welcome = "This format is not yet implemented. I will do this evenually, but until then, **patches are welcome!** :-)" %>
794
+
758
795
  <% chapter "Plain text", 'text' do %>
759
- [This format is not yet implemented.](http://en.wikipedia.org/wiki/Plain_text)
796
+ <%= patches_are_welcome %>
797
+
798
+ <%= hyperlink 'http://en.wikipedia.org/wiki/Plain_text' %>
760
799
  <% end %>
761
800
 
762
- <% chapter "LaTeX", 'latex' do %>
763
- [This format is not yet implemented.](http://www.latex-project.org)
801
+ <% chapter "LaTeX (PDF)", 'latex' do %>
802
+ <%= patches_are_welcome %>
803
+
804
+ <%= hyperlink 'http://www.latex-project.org' %>
764
805
  <% end %>
765
806
 
766
- <% chapter "UNIX man page", 'man' do %>
767
- [This format is not yet implemented.](http://en.wikipedia.org/wiki/Man_page)
807
+ <% chapter "man (UNIX manual page)", 'man' do %>
808
+ <%= patches_are_welcome %>
809
+
810
+ <%= hyperlink 'http://en.wikipedia.org/wiki/Man_page' %>
768
811
  <% end %>
769
812
  <% end %>