erbook 6.1.0 → 7.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/erbook +29 -25
- data/doc/HelloWorld.spec +3 -1
- data/doc/api/classes/ERBook.html +86 -0
- data/doc/api/classes/ERBook/Document.html +399 -0
- data/doc/api/classes/ERBook/Document/Node.html +110 -0
- data/doc/api/classes/ERBook/Template.html +309 -0
- data/doc/api/classes/ERBook/Template/Sandbox.html +134 -0
- data/doc/api/classes/RDoc.html +69 -0
- data/doc/api/classes/RDoc/AnyMethod.html +249 -0
- data/doc/api/classes/RDoc/DummyMarkup.html +60 -0
- data/doc/api/classes/RDoc/DummyMixin.html +54 -0
- data/doc/api/classes/RDoc/DummyOptions.html +60 -0
- data/doc/api/classes/RDoc/TopLevel.html +344 -0
- data/doc/api/classes/String.html +212 -0
- data/doc/api/created.rid +1 -0
- data/doc/api/css/main.css +263 -0
- data/doc/api/css/panel.css +383 -0
- data/doc/api/css/reset.css +53 -0
- data/doc/api/files/ANN_eml.html +276 -0
- data/doc/api/files/ANN_html.html +407 -0
- data/doc/api/files/ANN_txt.html +271 -0
- data/doc/api/files/LICENSE.html +76 -0
- data/doc/api/files/lib/erbook/document_rb.html +74 -0
- data/doc/api/files/lib/erbook/rdoc_rb.html +77 -0
- data/doc/api/files/lib/erbook/template_rb.html +66 -0
- data/doc/api/files/lib/erbook/to_xhtml_rb.html +89 -0
- data/doc/api/files/lib/erbook_rb.html +70 -0
- data/doc/api/i/arrows.png +0 -0
- data/doc/api/i/results_bg.png +0 -0
- data/doc/api/i/tree_bg.png +0 -0
- data/doc/api/index.html +14 -18
- data/doc/api/js/jquery-1.3.2.min.js +19 -0
- data/doc/api/js/jquery-effect.js +593 -0
- data/doc/api/js/main.js +22 -0
- data/doc/api/js/searchdoc.js +605 -0
- data/doc/api/panel/index.html +63 -0
- data/doc/api/panel/search_index.js +1 -0
- data/doc/api/panel/tree.js +1 -0
- data/doc/formats.erb +63 -115
- data/doc/history.erb +125 -92
- data/doc/index.erb +12 -7
- data/doc/index.xhtml +1020 -1347
- data/doc/intro.erb +42 -40
- data/doc/setup.erb +18 -18
- data/doc/theory.erb +24 -31
- data/doc/usage.erb +14 -24
- data/fmt/xhtml.icons/index.yaml +16 -14
- data/fmt/xhtml.icons/rakefile +33 -0
- data/fmt/xhtml.icons/tango-icon-theme-0.8.90/16x16/places/start-here.png +0 -0
- data/fmt/xhtml.icons/tango-icon-theme-0.8.90/32x32/actions/go-down.png +0 -0
- data/fmt/xhtml.icons/tango-icon-theme-0.8.90/32x32/actions/go-up.png +0 -0
- data/fmt/xhtml.icons/tango-icon-theme-0.8.90/32x32/places/start-here.png +0 -0
- data/fmt/xhtml.icons/tango-icon-theme-0.8.90/32x32/status/software-update-available.png +0 -0
- data/fmt/xhtml.icons/{tango-icon-theme-0.8.1 → tango-icon-theme-0.8.90}/48x48/apps/accessories-text-editor.png +0 -0
- data/fmt/xhtml.icons/tango-icon-theme-0.8.90/48x48/apps/internet-group-chat.png +0 -0
- data/fmt/xhtml.icons/{tango-icon-theme-0.8.1 → tango-icon-theme-0.8.90}/48x48/emblems/emblem-important.png +0 -0
- data/fmt/xhtml.icons/{tango-icon-theme-0.8.1 → tango-icon-theme-0.8.90}/48x48/status/dialog-error.png +0 -0
- data/fmt/xhtml.icons/{tango-icon-theme-0.8.1 → tango-icon-theme-0.8.90}/48x48/status/dialog-information.png +0 -0
- data/fmt/xhtml.icons/{tango-icon-theme-0.8.1 → tango-icon-theme-0.8.90}/48x48/status/dialog-warning.png +0 -0
- data/fmt/xhtml.icons/tango-icon-theme-0.8.90/COPYING +1 -0
- data/fmt/xhtml.icons/{tango-icon-theme-0.8.1 → tango-icon-theme-0.8.90}/README +0 -0
- data/fmt/xhtml.icons/tango-icon-theme-0.8.90/scalable/actions/bookmark-new.svg +672 -0
- data/fmt/xhtml.icons/tango-icon-theme-0.8.90/scalable/actions/go-down.svg +200 -0
- data/fmt/xhtml.icons/tango-icon-theme-0.8.90/scalable/actions/go-home.svg +445 -0
- data/fmt/xhtml.icons/tango-icon-theme-0.8.90/scalable/actions/go-up.svg +196 -0
- data/fmt/xhtml.icons/tango-icon-theme-0.8.90/scalable/actions/view-refresh.svg +393 -0
- data/fmt/xhtml.icons/tango-icon-theme-0.8.90/scalable/apps/accessories-text-editor.svg +554 -0
- data/fmt/xhtml.icons/tango-icon-theme-0.8.90/scalable/apps/internet-group-chat.svg +312 -0
- data/fmt/xhtml.icons/tango-icon-theme-0.8.90/scalable/emblems/emblem-favorite.svg +242 -0
- data/fmt/xhtml.icons/tango-icon-theme-0.8.90/scalable/emblems/emblem-important.svg +164 -0
- data/fmt/xhtml.icons/tango-icon-theme-0.8.90/scalable/mimetypes/application-certificate.svg +443 -0
- data/fmt/xhtml.icons/tango-icon-theme-0.8.90/scalable/places/start-here.svg +492 -0
- data/fmt/xhtml.icons/tango-icon-theme-0.8.90/scalable/status/dialog-error.svg +330 -0
- data/fmt/xhtml.icons/tango-icon-theme-0.8.90/scalable/status/dialog-information.svg +1159 -0
- data/fmt/xhtml.icons/tango-icon-theme-0.8.90/scalable/status/dialog-warning.svg +373 -0
- data/fmt/xhtml.icons/tango-icon-theme-0.8.90/scalable/status/software-update-available.svg +209 -0
- data/fmt/xhtml.scripts/jquery-1.3.2.min.js +19 -0
- data/fmt/xhtml.scripts/jquery.localscroll-1.2.7-min.js +9 -0
- data/fmt/xhtml.scripts/jquery.scrollTo-1.4.1-min.js +11 -0
- data/fmt/xhtml.yaml +470 -454
- data/lang/de.yaml +5 -5
- data/lang/el.yaml +4 -4
- data/lang/es.yaml +5 -5
- data/lang/fr.yaml +5 -5
- data/lang/it.yaml +5 -5
- data/lang/ja.yaml +4 -4
- data/lang/ko.yaml +4 -4
- data/lang/nl.yaml +4 -4
- data/lang/phrases.yaml +4 -4
- data/lang/pt.yaml +5 -5
- data/lang/ru.yaml +5 -5
- data/lang/zh.yaml +5 -5
- data/lang/zt.yaml +5 -5
- data/lib/erbook.rb +12 -5
- data/lib/erbook/document.rb +127 -107
- data/lib/erbook/rdoc.rb +18 -11
- data/lib/erbook/template.rb +86 -176
- data/lib/erbook/to_xhtml.rb +98 -25
- data/{Rakefile → rakefile} +1 -0
- metadata +106 -53
- data/doc/api/ERBook.html +0 -35
- data/doc/api/ERBook/Document.html +0 -669
- data/doc/api/ERBook/Document/Node.html +0 -102
- data/doc/api/ERBook/Template.html +0 -670
- data/doc/api/RDoc.html +0 -23
- data/doc/api/RDoc/AnyMethod.html +0 -302
- data/doc/api/RDoc/DummyMarkup.html +0 -73
- data/doc/api/RDoc/DummyMixin.html +0 -23
- data/doc/api/RDoc/DummyOptions.html +0 -140
- data/doc/api/RDoc/TopLevel.html +0 -465
- data/doc/api/String.html +0 -372
- data/doc/api/all-methods.html +0 -253
- data/doc/api/all-namespaces.html +0 -42
- data/doc/api/app.js +0 -18
- data/doc/api/jquery.js +0 -11
- data/doc/api/readme.html +0 -38
- data/doc/api/style.css +0 -68
- data/doc/api/syntax_highlight.css +0 -21
- data/fmt/xhtml.icons/tango-icon-theme-0.8.1/48x48/README +0 -2
- data/fmt/xhtml.icons/tango-icon-theme-0.8.1/48x48/apps/internet-group-chat.png +0 -0
- data/fmt/xhtml.icons/tango-icon-theme-0.8.1/COPYING +0 -67
data/doc/intro.erb
CHANGED
@@ -1,35 +1,43 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
%#--
|
2
|
+
%# Copyright 2007 Suraj N. Kurapati
|
3
|
+
%# See the LICENSE file for details.
|
4
|
+
%#++
|
3
5
|
|
4
|
-
|
5
|
-
|
6
|
+
% eruby_url = "http://en.wikipedia.org/wiki/ERuby"
|
7
|
+
% api_url = './api/index.html'
|
8
|
+
% repo_url = 'http://github.com/sunaku/' + $program
|
9
|
+
% repo_scm = '[Git](http://git-scm.com)'
|
10
|
+
|
11
|
+
%|chapter "Introduction"
|
12
|
+
%|project
|
13
|
+
<%= $project %> is an extensible document processor that emits <%= xref "HelloWorld", "any document you can imagine" %> from [eRuby templates](<%= eruby_url %>) that allow scripting and dynamic content generation.
|
6
14
|
|
7
15
|
A working <%= xref "xhtml", "XHTML (web page)" %> format is provided, while <%= xref "latex", "LaTeX (PDF)" %>, <%= xref "man", "UNIX manual page" %>, and <%= xref "text", "plain text" %> formats are planned... <%= xref "License", "patches are welcome" %>!
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
16
|
+
|
17
|
+
<%= $project %> is exciting because:
|
18
|
+
* Its documents are scriptable [eRuby templates](<%= eruby_url %>).
|
19
|
+
* It lets you <%= xref "HelloWorld", "define your own document formats" %>.
|
20
|
+
* Its core contains less than 300 lines of code.
|
21
|
+
|
22
|
+
These features distinguish <%= $project %> from the competition, which offers neither scriptable documents nor definable document formats:
|
23
|
+
* [DocBook](http://www.docbook.org)
|
24
|
+
* [Deplate](http://deplate.sourceforge.net)
|
25
|
+
* [SiSU](http://www.jus.uio.no/sisu/SiSU/)
|
26
|
+
* [AsciiDoc](http://www.methods.co.nz/asciidoc/)
|
27
|
+
* [txt2tags](http://txt2tags.sourceforge.net)
|
28
|
+
* [Grutatxt](http://www.triptico.com/software/grutatxt.html)
|
29
|
+
|
30
|
+
%|section "Logistics"
|
31
|
+
* <%= xref "History", "Release notes" %> --- history of project releases.
|
32
|
+
* [Source code](<%= repo_url %>) --- obtain via <%= repo_scm %> or browse online.
|
33
|
+
* [API reference](<%= api_url %>) --- documentation for source code.
|
34
|
+
* [Project home](<%= $website %>) --- the <%= $project %> project home page.
|
27
35
|
|
28
36
|
To get help or provide feedback, simply
|
29
37
|
<%= xref "License", "contact the authors" %>.
|
30
38
|
|
31
|
-
|
32
|
-
|
39
|
+
%|paragraph "Version numbers"
|
40
|
+
<%= $project %> releases are numbered in *major.minor.patch*
|
33
41
|
form according to the [RubyGems rational versioning
|
34
42
|
policy](http://www.rubygems.org/read/chapter/7), which
|
35
43
|
can be summarized thus:
|
@@ -67,27 +75,23 @@
|
|
67
75
|
</tr>
|
68
76
|
</tbody>
|
69
77
|
</table>
|
70
|
-
<% end %>
|
71
|
-
<% end %>
|
72
78
|
|
73
|
-
|
74
|
-
|
75
|
-
<% end %>
|
79
|
+
%|section "License"
|
80
|
+
%< "../LICENSE"
|
76
81
|
|
77
|
-
|
78
|
-
|
79
|
-
|
82
|
+
%|section "Credits" |n|
|
83
|
+
%= $logo = n.xref_link("![#{$project} logo](#{$program}.png)".to_inline_xhtml)
|
84
|
+
%< "README"
|
80
85
|
|
81
|
-
|
86
|
+
<%= $project %> is made possible by
|
82
87
|
<%= xref "History", "contributions" %>
|
83
88
|
from users like you:
|
84
89
|
|
85
90
|
* Jens Vierbuchen
|
86
91
|
* Maunika Gosike
|
87
92
|
* [Zhang Chiyuan](http://lifegoo.pluskid.org)
|
88
|
-
<% end %>
|
89
93
|
|
90
|
-
|
94
|
+
%|section "Reviews"
|
91
95
|
Tom Cloyd in [ruby-talk](http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/327499):
|
92
96
|
|
93
97
|
> This documentation is simply gorgeous!
|
@@ -95,16 +99,14 @@
|
|
95
99
|
|
96
100
|
Vitor Peres in [ruby-talk](http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/283052):
|
97
101
|
|
98
|
-
> I actually felt like printing \[this manual], because it's just so well-thought typographically... Even if \[
|
102
|
+
> I actually felt like printing \[this manual], because it's just so well-thought typographically... Even if \[<%= $project %>] weren't great by itself, I'd feel good just looking at the manual.
|
99
103
|
|
100
104
|
|
101
105
|
Ara T. Howard in [ruby-talk](http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/282949):
|
102
106
|
|
103
|
-
> \[This manual is] a insanely complete and nice looking bit of documentation \[...
|
107
|
+
> \[This manual is] a insanely complete and nice looking bit of documentation \[... <%= $project %>] looks like a great project
|
104
108
|
|
105
109
|
|
106
110
|
Martin DeMello in [ruby-talk](http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/283304):
|
107
111
|
|
108
112
|
> Very nice work indeed!
|
109
|
-
<% end %>
|
110
|
-
<% end %>
|
data/doc/setup.erb
CHANGED
@@ -1,15 +1,19 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
%#--
|
2
|
+
%# Copyright 2007 Suraj N. Kurapati
|
3
|
+
%# See the LICENSE file for details.
|
4
|
+
%#++
|
5
|
+
|
6
|
+
%|chapter "Setup"
|
7
|
+
%|section "Requirements"
|
8
|
+
Your system needs the following software to run <%= $project %>.
|
4
9
|
|
5
10
|
| Software | Description | Notes |
|
6
11
|
| -------- | ----------- | ----- |
|
7
12
|
| [Ruby](http://ruby-lang.org) | Ruby language interpreter | Version 1.8.7 or newer is required. |
|
8
13
|
| [RubyGems](http://rubygems.org) | Ruby packaging system | Version 1.0.0 or newer is required. |
|
9
|
-
<% end %>
|
10
14
|
|
11
|
-
|
12
|
-
You can install
|
15
|
+
%|section "Installation"
|
16
|
+
You can install <%= $project %> by running this command:
|
13
17
|
|
14
18
|
gem install <%= $program %>
|
15
19
|
|
@@ -22,41 +26,37 @@
|
|
22
26
|
<pre><%= verbatim `ruby bin/#{$program} -v` %></pre>
|
23
27
|
|
24
28
|
Otherwise, you can <%= xref "License", "contact the author" %> for help.
|
25
|
-
<% end %>
|
26
29
|
|
27
|
-
|
28
|
-
You will see the following items inside
|
30
|
+
%|section "Manifest"
|
31
|
+
You will see the following items inside <%= $project %>'s installation directory, whose path you can determine by running this command:
|
29
32
|
|
30
33
|
<%= $program %> -v
|
31
34
|
|
32
35
|
* <tt>bin/</tt>
|
33
36
|
|
34
|
-
* <tt><%= $program %></tt> --- the main
|
37
|
+
* <tt><%= $program %></tt> --- the main <%= $project %> executable.
|
35
38
|
|
36
39
|
* <tt>fmt/</tt> --- contains the predefined set of <%= xref "SpecFile", "format specification files" %>. If you ever need to install your custom format specification file globally, then put it inside this directory.
|
37
40
|
|
38
|
-
|
39
|
-
|
40
|
-
<% end %>
|
41
|
+
%|ERBook::FORMAT_FILES.each do |file|
|
42
|
+
<%=' '%>* <tt><%= File.basename(file) %></tt> --- <%= YAML.load_file(file)['desc'] %>
|
41
43
|
|
42
44
|
* <tt>lib/</tt>
|
43
45
|
|
44
|
-
* <tt><%= $program %>.rb</tt> --- the main
|
46
|
+
* <tt><%= $program %>.rb</tt> --- the main <%= $project %> library.
|
45
47
|
|
46
48
|
* <tt><%= $program %>/</tt>
|
47
49
|
|
48
|
-
* <tt>to_xhtml.rb</tt> ---
|
50
|
+
* <tt>to_xhtml.rb</tt> --- implements <%= xref "Text to XHTML conversion" %> methods for the <%= xref "xhtml" %> format.
|
49
51
|
|
50
52
|
* <tt>rdoc.rb</tt> --- provides RDoc parse trees to Ruby code.
|
51
53
|
|
52
54
|
* <tt>doc/</tt> --- contains this manual and other documentation.
|
53
55
|
|
54
|
-
* <tt><%= $program %>.svg</tt> --- source file of the
|
56
|
+
* <tt><%= $program %>.svg</tt> --- source file of the <%= $project %> logo.
|
55
57
|
|
56
58
|
* <tt>index.erb</tt> --- source file of this manual.
|
57
59
|
|
58
60
|
* <tt>api/</tt> --- API reference documentation.
|
59
61
|
|
60
62
|
* <tt>LICENSE</tt> --- project license and copyright notice.
|
61
|
-
<% end %>
|
62
|
-
<% end %>
|
data/doc/theory.erb
CHANGED
@@ -1,27 +1,30 @@
|
|
1
|
-
|
1
|
+
%#--
|
2
|
+
%# Copyright 2007 Suraj N. Kurapati
|
3
|
+
%# See the LICENSE file for details.
|
4
|
+
%#++
|
5
|
+
|
6
|
+
%|chapter "Theory of operation"
|
2
7
|
When you run <%= $project %>, it does the following:
|
3
8
|
|
4
9
|
1. Loads the <%= xref "SpecFile", "format specification file" %>.
|
5
10
|
|
6
|
-
2. Creates an
|
11
|
+
2. Creates an *input document* by:
|
7
12
|
|
8
13
|
* Reading the input (the content of either the input file or the standard input stream) into memory.
|
9
14
|
|
10
|
-
|
11
|
-
|
12
|
-
3. Transforms the input document into a **processed document** by:
|
15
|
+
3. Transforms the input document into a *processed document* by:
|
13
16
|
|
14
|
-
* Building a
|
17
|
+
* Building a *document tree* data structure from <%= xref "Nodes", "nodes" %> present in the input document.
|
15
18
|
|
16
19
|
* Replacing every node in the input document with the result of its <%= xref "SpecFile.nodes.output", "node output template" %>.
|
17
20
|
|
18
|
-
4. Transforms the processed document into an
|
21
|
+
4. Transforms the processed document into an *output document* according to the <%= xref "SpecFile.output", "document output template" %>.
|
19
22
|
|
20
23
|
5. Prints the output document to the standard output stream.
|
21
24
|
|
22
|
-
Although there is only one document being processed here, we refer to it using three distinct terms:
|
25
|
+
Although there is only one document being processed here, we refer to it using three distinct terms: *input*, *processed*, and *output*; because the content of the document changes radically with every transformation.
|
23
26
|
|
24
|
-
|
27
|
+
%|section "Nodes"
|
25
28
|
A node is a block of text that appears like this:
|
26
29
|
|
27
30
|
<%% node_type node_argument1, node_argument2, ... do |node_object| %>
|
@@ -65,7 +68,7 @@
|
|
65
68
|
|
66
69
|
A <%= xref "SpecFile", "format specification file" %> defines what types of nodes an input document may use.
|
67
70
|
|
68
|
-
|
71
|
+
%|section "The `ERBook::Document::Node` class", "Node.class"
|
69
72
|
When <%= $project %> builds a document tree from the nodes in an input document, it stores information about these nodes into `ERBook::Document::Node` objects. A `ERBook::Document::Node` object has the following properties (methods):
|
70
73
|
|
71
74
|
| Property | Type | Description |
|
@@ -83,10 +86,8 @@
|
|
83
86
|
| children | `Array` of `ERBook::Document::Node` | List of child nodes from the document tree. |
|
84
87
|
|
85
88
|
Furthermore, the `ERBook::Document::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::Document::Node` objects dynamically.
|
86
|
-
<% end %>
|
87
|
-
<% end %>
|
88
89
|
|
89
|
-
|
90
|
+
%|section "Format specification file", "SpecFile"
|
90
91
|
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.
|
91
92
|
|
92
93
|
| Parameter | Type | Description |
|
@@ -103,7 +104,7 @@
|
|
103
104
|
common_template_vars = nil
|
104
105
|
%>
|
105
106
|
|
106
|
-
|
107
|
+
%|section "Node definition", "SpecFile.nodes"
|
107
108
|
A node definition is a mapping from a name (the "node type") to the following set of parameters:
|
108
109
|
|
109
110
|
| Parameter | Type | Description |
|
@@ -113,10 +114,11 @@
|
|
113
114
|
| silent | Boolean | Suppress the output of this node? |
|
114
115
|
| output | `String` | An eRuby template for the content of this node. See <%= xref "SpecFile.nodes.output" %>. |
|
115
116
|
| inline | Boolean | Is node's output an in-line string of text that can be embedded anywhere in the document? |
|
117
|
+
| bypass | Boolean | Is node simply a wrapper (of negligible depth) for content? |
|
116
118
|
|
117
119
|
You may define additional parameters in a node definition if you want.
|
118
120
|
|
119
|
-
|
121
|
+
%|section "Node output template", "SpecFile.nodes.output"
|
120
122
|
A node output template (the **output** parameter in a node definition) is an eRuby template that transforms a node's content into output. During the processing stage, <%= $project %> replaces all nodes in the input document with the result of this template _unless_ the **silent** parameter is enabled in this node's definition.
|
121
123
|
|
122
124
|
The following variables are available for use in this template:
|
@@ -138,10 +140,8 @@
|
|
138
140
|
| `@format[:file]` | `String` | Path of the current format specification file. |
|
139
141
|
}.lstrip.gsub(/^ +/, '')
|
140
142
|
%>
|
141
|
-
<% end %>
|
142
|
-
<% end %>
|
143
143
|
|
144
|
-
|
144
|
+
%|section "Document output template", "SpecFile.output"
|
145
145
|
A document output template (the **output** parameter in a format specification file) is an eRuby template that transforms a processed document into the final output document.
|
146
146
|
|
147
147
|
The following variables are available for use in this template:
|
@@ -150,9 +150,8 @@
|
|
150
150
|
| -------- | ---- | ----------- |
|
151
151
|
| `@content` | `String` | Content of the processed document. |
|
152
152
|
<%= common_template_vars %>
|
153
|
-
<% end %>
|
154
153
|
|
155
|
-
|
154
|
+
%|section "Creating your own document format", "HelloWorld"
|
156
155
|
Here is a working example to help you digest all that you've learned so far about format specification files. A few things to notice in this example are:
|
157
156
|
|
158
157
|
* We define a `generate_name()` method in <%= xref "HelloWorld.spec" %> and make use of it in the <%= xref "HelloWorld.input" %>. This shows how to provide format-specific functionality to an input document.
|
@@ -171,17 +170,11 @@
|
|
171
170
|
|
172
171
|
4. Examine the <tt>HelloWorld.output</tt> file to your satisfaction!
|
173
172
|
|
174
|
-
|
173
|
+
%|example "HelloWorld format specification file", "HelloWorld.spec"
|
175
174
|
<code lang="rhtml"><%= verbatim File.read('doc/HelloWorld.spec') %></code>
|
176
|
-
<% end %>
|
177
175
|
|
178
|
-
|
176
|
+
%|example "Input document for HelloWorld format", "HelloWorld.input"
|
179
177
|
<code lang="rhtml"><%= verbatim File.read('doc/HelloWorld.input') %></code>
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
<%= `ruby bin/#{PROGRAM} -u doc/HelloWorld.spec doc/HelloWorld.input` %>
|
184
|
-
<% end %>
|
185
|
-
<% end %>
|
186
|
-
<% end %>
|
187
|
-
<% end %>
|
178
|
+
|
179
|
+
%|example "Output of HelloWorld format", "HelloWorld.output"
|
180
|
+
%= `ruby bin/#{PROGRAM} -u doc/HelloWorld.spec doc/HelloWorld.input`
|
data/doc/usage.erb
CHANGED
@@ -1,39 +1,29 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
%#--
|
2
|
+
%# Copyright 2007 Suraj N. Kurapati
|
3
|
+
%# See the LICENSE file for details.
|
4
|
+
%#++
|
5
|
+
|
6
|
+
%|chapter "Usage"
|
7
|
+
%|section "Command-line interface"
|
3
8
|
<pre><%= `ruby bin/#{$program} -h` %></pre>
|
4
9
|
|
5
|
-
The first command-line argument to
|
10
|
+
The first command-line argument to <%= $project %> is either the name of a predefined format (FormatName) or the path to a <%= xref "SpecFile", "format specification file" %> (FormatFile).
|
6
11
|
|
7
|
-
Predefined formats are simply short-hand names of format specification files located in the <tt>fmt/</tt> subdirectory of the
|
12
|
+
Predefined formats are simply short-hand names of format specification files located in the <tt>fmt/</tt> subdirectory of the <%= $project %> installation directory (see <%= xref "Manifest" %>).
|
8
13
|
|
9
|
-
|
14
|
+
%|section "Saving the output to a file"
|
10
15
|
Simply redirect the standard ouput stream (STDOUT) to a file like this:
|
11
16
|
|
12
17
|
<%= $program %> > YOUR_PATH_HERE
|
13
18
|
|
14
19
|
In the above example, *YOUR\_PATH\_HERE* is the path of the file in which the output should be saved.
|
15
20
|
|
16
|
-
|
21
|
+
%|important "Save XHTML output as <tt>.xhtml</tt>"
|
17
22
|
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.
|
18
23
|
|
19
24
|
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.
|
20
|
-
<% end %>
|
21
|
-
<% end %>
|
22
|
-
<% end %>
|
23
|
-
|
24
|
-
<% section "Including external documents", "include" do %>
|
25
|
-
The **include** directive allows you to insert the content of an arbitrary file at a certain place in the input document. It is written like this:
|
26
|
-
|
27
|
-
<%%# include YOUR_PATH_HERE #%>
|
28
|
-
|
29
|
-
In the above example, *YOUR\_PATH\_HERE* is the path of the file whose content you wish to insert into the input document.
|
30
|
-
|
31
|
-
You can divide a large document into separate files for easier editing and stitch them together, dynamically, into a single document using the **include** directive.
|
32
|
-
<% end %>
|
33
25
|
|
34
|
-
|
35
|
-
When writing
|
26
|
+
%|section "Unindenting nodes hierarchically"
|
27
|
+
When writing <%= $project %> documents, I prefer to indent the content of nodes according to their depth because my [text editor of choice](http://jedit.org) automatically folds blocks of text based on indentation.
|
36
28
|
|
37
|
-
If you also prefer to write documents in this way, be sure to pass the <tt>--unindent</tt> option to
|
38
|
-
<% end %>
|
39
|
-
<% end %>
|
29
|
+
If you also prefer to write documents in this way, be sure to pass the <tt>--unindent</tt> option to <%= $project %> so that the indentation will not affect the resulting output.
|
data/fmt/xhtml.icons/index.yaml
CHANGED
@@ -4,17 +4,19 @@
|
|
4
4
|
# icon_name: relative path to the image file
|
5
5
|
#
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
tip:
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
7
|
+
hyperlink: mediawiki-1.13.2/skins/simple/external.png
|
8
|
+
here_frag: tango-icon-theme-0.8.90/16x16/places/start-here.png
|
9
|
+
|
10
|
+
# admonitions
|
11
|
+
important: tango-icon-theme-0.8.90/48x48/emblems/emblem-important.png
|
12
|
+
warning: tango-icon-theme-0.8.90/48x48/status/dialog-error.png
|
13
|
+
caution: tango-icon-theme-0.8.90/48x48/status/dialog-warning.png
|
14
|
+
note: tango-icon-theme-0.8.90/48x48/apps/accessories-text-editor.png
|
15
|
+
tip: tango-icon-theme-0.8.90/48x48/status/dialog-information.png
|
16
|
+
quote: tango-icon-theme-0.8.90/48x48/apps/internet-group-chat.png
|
17
|
+
|
18
|
+
# navigation menu on every heading
|
19
|
+
nav_here: tango-icon-theme-0.8.90/32x32/status/software-update-available.png
|
20
|
+
nav_prev: tango-icon-theme-0.8.90/32x32/actions/go-up.png
|
21
|
+
nav_next: tango-icon-theme-0.8.90/32x32/actions/go-down.png
|
22
|
+
nav_list: tango-icon-theme-0.8.90/32x32/places/start-here.png
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright 2009 Suraj N. Kurapati
|
3
|
+
# See the LICENSE file for details.
|
4
|
+
#++
|
5
|
+
|
6
|
+
require 'rake/clean'
|
7
|
+
|
8
|
+
require 'yaml'
|
9
|
+
INDEX = YAML.load_file('index.yaml')
|
10
|
+
|
11
|
+
desc 'generate PNGs for tango icons from SVG sources'
|
12
|
+
task :default
|
13
|
+
|
14
|
+
INDEX.values.grep(/tango-icon-theme/).each do |dst|
|
15
|
+
sh 'git', 'add', dst
|
16
|
+
|
17
|
+
if dst =~ /(\d+)x\1/
|
18
|
+
size = $1
|
19
|
+
src = $` + 'scalable' + $'.ext('.svg')
|
20
|
+
|
21
|
+
file dst do
|
22
|
+
mkdir_p File.dirname(dst)
|
23
|
+
sh 'inkscape', '-e', dst, '-h', size, src
|
24
|
+
|
25
|
+
# ensure sources are in repository so everything
|
26
|
+
# works the next time this rake task is run
|
27
|
+
sh 'git', 'add', src
|
28
|
+
end
|
29
|
+
CLOBBER.include dst
|
30
|
+
|
31
|
+
task :default => dst
|
32
|
+
end
|
33
|
+
end
|
Binary file
|