erbook 7.3.0 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/doc/HelloWorld.spec +9 -10
- data/doc/api/classes/ERBook/Document.html +50 -38
- data/doc/api/classes/ERBook/Document/Node.html +185 -8
- data/doc/api/classes/ERBook/Template.html +20 -20
- data/doc/api/classes/ERBook/Template/Sandbox.html +5 -5
- data/doc/api/classes/RDoc/AnyMethod.html +20 -20
- data/doc/api/classes/RDoc/TopLevel.html +30 -30
- data/doc/api/classes/String.html +10 -10
- data/doc/api/created.rid +1 -1
- data/doc/api/files/lib/erbook/document_rb.html +1 -1
- data/doc/api/files/lib/erbook/to_xhtml_rb.html +2 -2
- data/doc/api/files/lib/erbook_rb.html +1 -1
- data/doc/api/panel/search_index.js +1 -1
- data/doc/formats.erb +196 -61
- data/doc/history.erb +45 -0
- data/doc/index.html +608 -537
- data/doc/intro.erb +1 -1
- data/doc/setup.erb +66 -38
- data/doc/theory.erb +292 -61
- data/doc/usage.erb +1 -1
- data/fmt/xhtml.yaml +139 -150
- data/lib/erbook.rb +2 -2
- data/lib/erbook/document.rb +62 -26
- metadata +5 -5
data/lib/erbook.rb
CHANGED
@@ -9,8 +9,8 @@ require 'inochi'
|
|
9
9
|
|
10
10
|
Inochi.init :ERBook,
|
11
11
|
:program => 'erbook',
|
12
|
-
:version => '
|
13
|
-
:release => '2009-10-
|
12
|
+
:version => '8.0.0',
|
13
|
+
:release => '2009-10-10',
|
14
14
|
:website => 'http://snk.tuxfamily.org/lib/erbook/',
|
15
15
|
:tagline => 'Write books, manuals, and documents in eRuby',
|
16
16
|
:require => {
|
data/lib/erbook/document.rb
CHANGED
@@ -83,44 +83,54 @@ module ERBook
|
|
83
83
|
#
|
84
84
|
def sandbox.__node_impl__ node_type, *node_args, &node_content
|
85
85
|
node = Node.new(
|
86
|
-
:type
|
87
|
-
:
|
88
|
-
:
|
89
|
-
:
|
90
|
-
:
|
86
|
+
:type => node_type,
|
87
|
+
:definition => @format['nodes'][node_type],
|
88
|
+
:arguments => node_args,
|
89
|
+
:backtrace => caller,
|
90
|
+
:parent => @stack.last,
|
91
|
+
:children => []
|
91
92
|
)
|
93
|
+
|
94
|
+
Array(node.definition['params']).each do |param|
|
95
|
+
break if node_args.empty?
|
96
|
+
node.__send__ "#{param}=", node_args.shift
|
97
|
+
end
|
98
|
+
|
92
99
|
@nodes << node
|
93
100
|
@nodes_by_type[node.type] << node
|
94
101
|
|
95
|
-
# calculate
|
96
|
-
if node.
|
102
|
+
# calculate ordinal number for this node
|
103
|
+
if node.ordinal_number?
|
97
104
|
@count_by_type ||= Hash.new {|h,k| h[k] = 0 }
|
98
|
-
node.
|
105
|
+
node.ordinal_number = (@count_by_type[node.type] += 1)
|
99
106
|
end
|
100
107
|
|
101
108
|
# assign node family
|
102
|
-
if parent =
|
109
|
+
if parent = node.parent
|
103
110
|
parent.children << node
|
104
111
|
node.parent = parent
|
105
112
|
node.depth = parent.depth
|
106
|
-
node.depth += 1 if node.
|
113
|
+
node.depth += 1 if node.anchor?
|
107
114
|
|
108
|
-
# calculate
|
109
|
-
if node.
|
110
|
-
|
111
|
-
branches =
|
115
|
+
# calculate section number for this node
|
116
|
+
if node.section_number?
|
117
|
+
ancestor = @stack.reverse.find {|n| n.section_number }
|
118
|
+
branches = parent.children.select {|n| n.section_number }
|
112
119
|
|
113
|
-
node.
|
120
|
+
node.section_number = [
|
121
|
+
ancestor.section_number,
|
122
|
+
branches.length + 1
|
123
|
+
].join('.')
|
114
124
|
end
|
115
125
|
else
|
116
126
|
@roots << node
|
117
127
|
node.parent = nil
|
118
128
|
node.depth = 0
|
119
129
|
|
120
|
-
# calculate
|
121
|
-
if node.
|
122
|
-
branches = @roots.select {|n| n.
|
123
|
-
node.
|
130
|
+
# calculate section number for this node
|
131
|
+
if node.section_number?
|
132
|
+
branches = @roots.select {|n| n.section_number }
|
133
|
+
node.section_number = (branches.length + 1).to_s
|
124
134
|
end
|
125
135
|
end
|
126
136
|
|
@@ -153,9 +163,7 @@ module ERBook
|
|
153
163
|
@processed_document = template.buffer
|
154
164
|
|
155
165
|
# chain block-level nodes together for local navigation
|
156
|
-
block_nodes = @nodes.
|
157
|
-
n.defn['bypass'] || n.defn['inline']
|
158
|
-
end
|
166
|
+
block_nodes = @nodes.select {|n| n.anchor? }
|
159
167
|
|
160
168
|
require 'enumerator'
|
161
169
|
block_nodes.each_cons(2) do |a, b|
|
@@ -179,16 +187,20 @@ module ERBook
|
|
179
187
|
# calculate the output for this node
|
180
188
|
actual_output = Template.new(
|
181
189
|
"#{@format_file}:nodes:#{n.type}:output",
|
182
|
-
n.
|
190
|
+
n.definition['output'].to_s.chomp
|
183
191
|
).render_with(@template_vars.merge(:@node => n))
|
184
192
|
|
185
193
|
# reveal child nodes' actual output in this node's actual output
|
186
194
|
n.children.each do |c|
|
187
|
-
if c.
|
195
|
+
if c.silent?
|
196
|
+
# this child's output is not meant to be revealed at this time
|
197
|
+
next
|
198
|
+
|
199
|
+
elsif c.inline?
|
188
200
|
actual_output[c.output] = actual_output_by_node[c]
|
189
201
|
|
190
202
|
else
|
191
|
-
# pull block-level
|
203
|
+
# pull block-level child out of paragraph tag added by Maruku
|
192
204
|
actual_output.sub! %r/(<p>\s*)?#{Regexp.quote c.output}/ do
|
193
205
|
actual_output_by_node[c] + $1.to_s
|
194
206
|
end
|
@@ -239,7 +251,31 @@ module ERBook
|
|
239
251
|
# Returns the output of this node.
|
240
252
|
#
|
241
253
|
def to_s
|
242
|
-
|
254
|
+
if silent?
|
255
|
+
''
|
256
|
+
else
|
257
|
+
output
|
258
|
+
end
|
259
|
+
end
|
260
|
+
|
261
|
+
def section_number?
|
262
|
+
Array(definition['number']).include? 'section'
|
263
|
+
end
|
264
|
+
|
265
|
+
def ordinal_number?
|
266
|
+
Array(definition['number']).include? 'ordinal'
|
267
|
+
end
|
268
|
+
|
269
|
+
def anchor?
|
270
|
+
not inline? and not silent?
|
271
|
+
end
|
272
|
+
|
273
|
+
def inline?
|
274
|
+
definition['inline']
|
275
|
+
end
|
276
|
+
|
277
|
+
def silent?
|
278
|
+
definition['silent']
|
243
279
|
end
|
244
280
|
end
|
245
281
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: erbook
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 8.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Suraj N. Kurapati
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-10-
|
12
|
+
date: 2009-10-10 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -82,9 +82,9 @@ dependencies:
|
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: "1"
|
84
84
|
version:
|
85
|
-
description: " ERBook
|
86
|
-
Version
|
87
|
-
References\n\n 1. http://snk.tuxfamily.org/lib/erbook/#HelloWorld\n 2. http://en.wikipedia.org/wiki/ERuby\n 3. http://snk.tuxfamily.org/lib/erbook/#
|
85
|
+
description: " ERBook 8.0.0\n\n Write books, manuals, and documents in eRuby\n\n http://snk.tuxfamily.org/lib/erbook/\n\n ERBook is an extensible document processor that emits [1]any\n document you can imagine from [2]eRuby templates, which allow\n scripting and dynamic content generation.\n\n\
|
86
|
+
Version 8.0.0 (2009-10-10)\n\n This release simplifies [3]node definitions, adds [4]Table\n nodes for building tables the HTML way, and introduces\n [5]Arbitrary floats to combat the [6]explosion of\n special-purpose document nodes.\n\n * [7]Incompatible changes\n\n * [8]New features\n\n * [9]Housekeeping\n\n Incompatible changes\n\n * Reduce and rename [10]node definitions attributes:\n + toc: true -> index: tree\n + lof: true -> index: list\n + index: true -> number: section\n + number: true -> number: ordinal\n + depth: true -> (removed)\n + bypass: true -> (removed)\n\n * Rename [11]The ERBook::Document::Node class properties to\n be more self-documenting:\n + args -> arguments\n + defn -> definition\n + trace -> backtrace\n + index -> section_number\n + number -> ordinal_number\n\n * Replace formal blocks (figure, table, example, equation,\n procedure) with [12]Arbitrary floats.\n\n * Append an exclamation mark (!) to the names of\n [13]Admonition nodes, thereby making them a special case\n of [14]Arbitrary floats.\n\n New features\n\n * Add \"params\" attribute to [15]node definitions.\n\n * Add [16]Table nodes for building tables the HTML way.\n\n Housekeeping\n\n * Use YAML hash merging to DRY node definitions in XHTML\n format.\n\n * Use [17]Table nodes instead of PHP Markdown Extra table\n syntax in the user manual.\n\n * Remove the \"digest\" [18]Node definition attribute from\n the user manual. Its use was discontinued a few major\n versions ago.\n\n\
|
87
|
+
References\n\n 1. http://snk.tuxfamily.org/lib/erbook/#HelloWorld\n 2. http://en.wikipedia.org/wiki/ERuby\n 3. http://snk.tuxfamily.org/lib/erbook/#SpecFile-nodes\n 4. http://snk.tuxfamily.org/lib/erbook/#Table-nodes\n 5. http://snk.tuxfamily.org/lib/erbook/#Arbitrary-floats\n 6. http://www.docbook.org/tdg/en/html/part2.html\n 7. http://snk.tuxfamily.org/lib/erbook/#Incompatible-changes\n 8. http://snk.tuxfamily.org/lib/erbook/#New-features\n 9. http://snk.tuxfamily.org/lib/erbook/#Housekeeping\n 10. http://snk.tuxfamily.org/lib/erbook/#SpecFile-nodes\n 11. http://snk.tuxfamily.org/lib/erbook/#Node-class\n 12. http://snk.tuxfamily.org/lib/erbook/#Arbitrary-floats\n 13. http://snk.tuxfamily.org/lib/erbook/#Admonition-nodes\n 14. http://snk.tuxfamily.org/lib/erbook/#Arbitrary-floats\n 15. http://snk.tuxfamily.org/lib/erbook/#SpecFile-nodes\n 16. http://snk.tuxfamily.org/lib/erbook/#Table-nodes\n 17. http://snk.tuxfamily.org/lib/erbook/#Table-nodes\n 18. http://snk.tuxfamily.org/lib/erbook/#SpecFile-nodes\n"
|
88
88
|
email: sunaku@gmail.com
|
89
89
|
executables:
|
90
90
|
- erbook
|