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/doc/HelloWorld.spec
CHANGED
@@ -33,8 +33,7 @@ code: |
|
|
33
33
|
|
34
34
|
nodes:
|
35
35
|
hello:
|
36
|
-
|
37
|
-
number: true
|
36
|
+
number: [section, ordinal]
|
38
37
|
silent: false
|
39
38
|
output: |
|
40
39
|
|
@@ -43,17 +42,17 @@ nodes:
|
|
43
42
|
My name is <%= @node.name.inspect %> and these are my properties:
|
44
43
|
|
45
44
|
<dl style="<%= $style %>">
|
46
|
-
<dt>
|
47
|
-
<dd><code><%= @node.
|
45
|
+
<dt>arguments</dt>
|
46
|
+
<dd><code><%= @node.arguments.inspect %></code></dd>
|
48
47
|
|
49
|
-
<dt>
|
50
|
-
<dd><code><%= @node.
|
48
|
+
<dt>section_number</dt>
|
49
|
+
<dd><code><%= @node.section_number.inspect %></code></dd>
|
51
50
|
|
52
|
-
<dt>
|
53
|
-
<dd><code><%= @node.
|
51
|
+
<dt>ordinal_number</dt>
|
52
|
+
<dd><code><%= @node.ordinal_number.inspect %></code></dd>
|
54
53
|
|
55
|
-
<dt>
|
56
|
-
<dd><pre><%= @node.
|
54
|
+
<dt>backtrace</dt>
|
55
|
+
<dd><pre><%= @node.backtrace.join("\n") %></pre></dd>
|
57
56
|
|
58
57
|
<dt>content</dt>
|
59
58
|
<dd><%= @node.content %></dd>
|
@@ -49,7 +49,7 @@
|
|
49
49
|
<dd>
|
50
50
|
<ul>
|
51
51
|
|
52
|
-
<li><a href="#
|
52
|
+
<li><a href="#M000052">new</a></li>
|
53
53
|
|
54
54
|
</ul>
|
55
55
|
</dd>
|
@@ -58,7 +58,7 @@
|
|
58
58
|
<dd>
|
59
59
|
<ul>
|
60
60
|
|
61
|
-
<li><a href="#
|
61
|
+
<li><a href="#M000064">to_s</a></li>
|
62
62
|
|
63
63
|
</ul>
|
64
64
|
</dd>
|
@@ -132,9 +132,9 @@ All nodes in the document arranged by node type.
|
|
132
132
|
<div class="sectiontitle">Class Public methods</div>
|
133
133
|
|
134
134
|
<div class="method">
|
135
|
-
<div class="title" id="
|
135
|
+
<div class="title" id="M000052">
|
136
136
|
|
137
|
-
<a name="
|
137
|
+
<a name="M000052"></a><b>new</b>(format_name, input_text, input_file, options = {})
|
138
138
|
|
139
139
|
</div>
|
140
140
|
|
@@ -166,12 +166,12 @@ specification file.
|
|
166
166
|
|
167
167
|
<div class="sourcecode">
|
168
168
|
<p class="source-link">
|
169
|
-
Source: <a href="javascript:toggleSource('
|
169
|
+
Source: <a href="javascript:toggleSource('M000052_source')" id="l_M000052_source">show</a>
|
170
170
|
|
171
|
-
| <a href="http://github.com/sunaku/erbook/blob/
|
171
|
+
| <a href="http://github.com/sunaku/erbook/blob/aeaff38e68b16f53360682a1f9770747dd84ecb6/lib/erbook/document.rb#L42" target="_blank" class="github_url">on GitHub</a>
|
172
172
|
|
173
173
|
</p>
|
174
|
-
<div id="
|
174
|
+
<div id="M000052_source" class="dyn-source">
|
175
175
|
<pre><span class="ruby-comment cmt"># File lib/erbook/document.rb, line 42</span>
|
176
176
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span> <span class="ruby-identifier">format_name</span>, <span class="ruby-identifier">input_text</span>, <span class="ruby-identifier">input_file</span>, <span class="ruby-identifier">options</span> = {}
|
177
177
|
<span class="ruby-comment cmt"># process format specification</span>
|
@@ -217,44 +217,54 @@ specification file.
|
|
217
217
|
<span class="ruby-comment cmt">#</span>
|
218
218
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sandbox</span>.<span class="ruby-identifier">__node_impl__</span> <span class="ruby-identifier">node_type</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">node_args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">node_content</span>
|
219
219
|
<span class="ruby-identifier">node</span> = <span class="ruby-constant">Node</span>.<span class="ruby-identifier">new</span>(
|
220
|
-
<span class="ruby-identifier">:type</span>
|
221
|
-
<span class="ruby-identifier">:
|
222
|
-
<span class="ruby-identifier">:
|
223
|
-
<span class="ruby-identifier">:
|
224
|
-
<span class="ruby-identifier">:
|
220
|
+
<span class="ruby-identifier">:type</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">node_type</span>,
|
221
|
+
<span class="ruby-identifier">:definition</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@format</span>[<span class="ruby-value str">'nodes'</span>][<span class="ruby-identifier">node_type</span>],
|
222
|
+
<span class="ruby-identifier">:arguments</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">node_args</span>,
|
223
|
+
<span class="ruby-identifier">:backtrace</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">caller</span>,
|
224
|
+
<span class="ruby-identifier">:parent</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@stack</span>.<span class="ruby-identifier">last</span>,
|
225
|
+
<span class="ruby-identifier">:children</span> =<span class="ruby-operator">></span> []
|
225
226
|
)
|
227
|
+
|
228
|
+
<span class="ruby-constant">Array</span>(<span class="ruby-identifier">node</span>.<span class="ruby-identifier">definition</span>[<span class="ruby-value str">'params'</span>]).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">param</span><span class="ruby-operator">|</span>
|
229
|
+
<span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">node_args</span>.<span class="ruby-identifier">empty?</span>
|
230
|
+
<span class="ruby-identifier">node</span>.<span class="ruby-identifier">__send__</span> <span class="ruby-node">"#{param}="</span>, <span class="ruby-identifier">node_args</span>.<span class="ruby-identifier">shift</span>
|
231
|
+
<span class="ruby-keyword kw">end</span>
|
232
|
+
|
226
233
|
<span class="ruby-ivar">@nodes</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">node</span>
|
227
234
|
<span class="ruby-ivar">@nodes_by_type</span>[<span class="ruby-identifier">node</span>.<span class="ruby-identifier">type</span>] <span class="ruby-operator"><<</span> <span class="ruby-identifier">node</span>
|
228
235
|
|
229
|
-
<span class="ruby-comment cmt"># calculate
|
230
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">
|
236
|
+
<span class="ruby-comment cmt"># calculate ordinal number for this node</span>
|
237
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">ordinal_number?</span>
|
231
238
|
<span class="ruby-ivar">@count_by_type</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">h</span>,<span class="ruby-identifier">k</span><span class="ruby-operator">|</span> <span class="ruby-identifier">h</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-value">0</span> }
|
232
|
-
<span class="ruby-identifier">node</span>.<span class="ruby-identifier">
|
239
|
+
<span class="ruby-identifier">node</span>.<span class="ruby-identifier">ordinal_number</span> = (<span class="ruby-ivar">@count_by_type</span>[<span class="ruby-identifier">node</span>.<span class="ruby-identifier">type</span>] <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>)
|
233
240
|
<span class="ruby-keyword kw">end</span>
|
234
241
|
|
235
242
|
<span class="ruby-comment cmt"># assign node family</span>
|
236
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">parent</span> = <span class="ruby-
|
243
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">parent</span> = <span class="ruby-identifier">node</span>.<span class="ruby-identifier">parent</span>
|
237
244
|
<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">children</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">node</span>
|
238
245
|
<span class="ruby-identifier">node</span>.<span class="ruby-identifier">parent</span> = <span class="ruby-identifier">parent</span>
|
239
246
|
<span class="ruby-identifier">node</span>.<span class="ruby-identifier">depth</span> = <span class="ruby-identifier">parent</span>.<span class="ruby-identifier">depth</span>
|
240
|
-
<span class="ruby-identifier">node</span>.<span class="ruby-identifier">depth</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">
|
247
|
+
<span class="ruby-identifier">node</span>.<span class="ruby-identifier">depth</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">anchor?</span>
|
241
248
|
|
242
|
-
<span class="ruby-comment cmt"># calculate
|
243
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">
|
244
|
-
<span class="ruby-identifier">
|
245
|
-
<span class="ruby-identifier">branches</span> = <span class="ruby-identifier">
|
249
|
+
<span class="ruby-comment cmt"># calculate section number for this node</span>
|
250
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">section_number?</span>
|
251
|
+
<span class="ruby-identifier">ancestor</span> = <span class="ruby-ivar">@stack</span>.<span class="ruby-identifier">reverse</span>.<span class="ruby-identifier">find</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">n</span><span class="ruby-operator">|</span> <span class="ruby-identifier">n</span>.<span class="ruby-identifier">section_number</span> }
|
252
|
+
<span class="ruby-identifier">branches</span> = <span class="ruby-identifier">parent</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">select</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">n</span><span class="ruby-operator">|</span> <span class="ruby-identifier">n</span>.<span class="ruby-identifier">section_number</span> }
|
246
253
|
|
247
|
-
<span class="ruby-identifier">node</span>.<span class="ruby-identifier">
|
254
|
+
<span class="ruby-identifier">node</span>.<span class="ruby-identifier">section_number</span> = [
|
255
|
+
<span class="ruby-identifier">ancestor</span>.<span class="ruby-identifier">section_number</span>,
|
256
|
+
<span class="ruby-identifier">branches</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>
|
257
|
+
].<span class="ruby-identifier">join</span>(<span class="ruby-value str">'.'</span>)
|
248
258
|
<span class="ruby-keyword kw">end</span>
|
249
259
|
<span class="ruby-keyword kw">else</span>
|
250
260
|
<span class="ruby-ivar">@roots</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">node</span>
|
251
261
|
<span class="ruby-identifier">node</span>.<span class="ruby-identifier">parent</span> = <span class="ruby-keyword kw">nil</span>
|
252
262
|
<span class="ruby-identifier">node</span>.<span class="ruby-identifier">depth</span> = <span class="ruby-value">0</span>
|
253
263
|
|
254
|
-
<span class="ruby-comment cmt"># calculate
|
255
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">
|
256
|
-
<span class="ruby-identifier">branches</span> = <span class="ruby-ivar">@roots</span>.<span class="ruby-identifier">select</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">n</span><span class="ruby-operator">|</span> <span class="ruby-identifier">n</span>.<span class="ruby-identifier">
|
257
|
-
<span class="ruby-identifier">node</span>.<span class="ruby-identifier">
|
264
|
+
<span class="ruby-comment cmt"># calculate section number for this node</span>
|
265
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">section_number?</span>
|
266
|
+
<span class="ruby-identifier">branches</span> = <span class="ruby-ivar">@roots</span>.<span class="ruby-identifier">select</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">n</span><span class="ruby-operator">|</span> <span class="ruby-identifier">n</span>.<span class="ruby-identifier">section_number</span> }
|
267
|
+
<span class="ruby-identifier">node</span>.<span class="ruby-identifier">section_number</span> = (<span class="ruby-identifier">branches</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>).<span class="ruby-identifier">to_s</span>
|
258
268
|
<span class="ruby-keyword kw">end</span>
|
259
269
|
<span class="ruby-keyword kw">end</span>
|
260
270
|
|
@@ -287,9 +297,7 @@ specification file.
|
|
287
297
|
<span class="ruby-ivar">@processed_document</span> = <span class="ruby-identifier">template</span>.<span class="ruby-identifier">buffer</span>
|
288
298
|
|
289
299
|
<span class="ruby-comment cmt"># chain block-level nodes together for local navigation</span>
|
290
|
-
<span class="ruby-identifier">block_nodes</span> = <span class="ruby-ivar">@nodes</span>.<span class="ruby-identifier">
|
291
|
-
<span class="ruby-identifier">n</span>.<span class="ruby-identifier">defn</span>[<span class="ruby-value str">'bypass'</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">n</span>.<span class="ruby-identifier">defn</span>[<span class="ruby-value str">'inline'</span>]
|
292
|
-
<span class="ruby-keyword kw">end</span>
|
300
|
+
<span class="ruby-identifier">block_nodes</span> = <span class="ruby-ivar">@nodes</span>.<span class="ruby-identifier">select</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">n</span><span class="ruby-operator">|</span> <span class="ruby-identifier">n</span>.<span class="ruby-identifier">anchor?</span> }
|
293
301
|
|
294
302
|
<span class="ruby-identifier">require</span> <span class="ruby-value str">'enumerator'</span>
|
295
303
|
<span class="ruby-identifier">block_nodes</span>.<span class="ruby-identifier">each_cons</span>(<span class="ruby-value">2</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">a</span>, <span class="ruby-identifier">b</span><span class="ruby-operator">|</span>
|
@@ -313,16 +321,20 @@ specification file.
|
|
313
321
|
<span class="ruby-comment cmt"># calculate the output for this node</span>
|
314
322
|
<span class="ruby-identifier">actual_output</span> = <span class="ruby-constant">Template</span>.<span class="ruby-identifier">new</span>(
|
315
323
|
<span class="ruby-node">"#{@format_file}:nodes:#{n.type}:output"</span>,
|
316
|
-
<span class="ruby-identifier">n</span>.<span class="ruby-identifier">
|
324
|
+
<span class="ruby-identifier">n</span>.<span class="ruby-identifier">definition</span>[<span class="ruby-value str">'output'</span>].<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">chomp</span>
|
317
325
|
).<span class="ruby-identifier">render_with</span>(<span class="ruby-ivar">@template_vars</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">:@node</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">n</span>))
|
318
326
|
|
319
327
|
<span class="ruby-comment cmt"># reveal child nodes' actual output in this node's actual output</span>
|
320
328
|
<span class="ruby-identifier">n</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span>
|
321
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">
|
329
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">silent?</span>
|
330
|
+
<span class="ruby-comment cmt"># this child's output is not meant to be revealed at this time</span>
|
331
|
+
<span class="ruby-keyword kw">next</span>
|
332
|
+
|
333
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">inline?</span>
|
322
334
|
<span class="ruby-identifier">actual_output</span>[<span class="ruby-identifier">c</span>.<span class="ruby-identifier">output</span>] = <span class="ruby-identifier">actual_output_by_node</span>[<span class="ruby-identifier">c</span>]
|
323
335
|
|
324
336
|
<span class="ruby-keyword kw">else</span>
|
325
|
-
<span class="ruby-comment cmt"># pull block-level
|
337
|
+
<span class="ruby-comment cmt"># pull block-level child out of paragraph tag added by Maruku</span>
|
326
338
|
<span class="ruby-identifier">actual_output</span>.<span class="ruby-identifier">sub!</span> <span class="ruby-node">%r/(<p>\s*)?#{Regexp.quote c.output}/</span> <span class="ruby-keyword kw">do</span>
|
327
339
|
<span class="ruby-identifier">actual_output_by_node</span>[<span class="ruby-identifier">c</span>] <span class="ruby-operator">+</span> <span class="ruby-identifier">$1</span>.<span class="ruby-identifier">to_s</span>
|
328
340
|
<span class="ruby-keyword kw">end</span>
|
@@ -362,9 +374,9 @@ specification file.
|
|
362
374
|
<div class="sectiontitle">Instance Public methods</div>
|
363
375
|
|
364
376
|
<div class="method">
|
365
|
-
<div class="title" id="
|
377
|
+
<div class="title" id="M000064">
|
366
378
|
|
367
|
-
<a name="
|
379
|
+
<a name="M000064"></a><b>to_s</b>()
|
368
380
|
|
369
381
|
</div>
|
370
382
|
|
@@ -380,13 +392,13 @@ Returns the output of this document.
|
|
380
392
|
|
381
393
|
<div class="sourcecode">
|
382
394
|
<p class="source-link">
|
383
|
-
Source: <a href="javascript:toggleSource('
|
395
|
+
Source: <a href="javascript:toggleSource('M000064_source')" id="l_M000064_source">show</a>
|
384
396
|
|
385
|
-
| <a href="http://github.com/sunaku/erbook/blob/
|
397
|
+
| <a href="http://github.com/sunaku/erbook/blob/aeaff38e68b16f53360682a1f9770747dd84ecb6/lib/erbook/document.rb#L239" target="_blank" class="github_url">on GitHub</a>
|
386
398
|
|
387
399
|
</p>
|
388
|
-
<div id="
|
389
|
-
<pre><span class="ruby-comment cmt"># File lib/erbook/document.rb, line
|
400
|
+
<div id="M000064_source" class="dyn-source">
|
401
|
+
<pre><span class="ruby-comment cmt"># File lib/erbook/document.rb, line 239</span>
|
390
402
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
|
391
403
|
<span class="ruby-constant">Template</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">"#{@format_file}:output"</span>, <span class="ruby-ivar">@format</span>[<span class="ruby-value str">'output'</span>].<span class="ruby-identifier">to_s</span>).
|
392
404
|
<span class="ruby-identifier">render_with</span>(<span class="ruby-ivar">@template_vars</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">:@content</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@processed_document</span>.<span class="ruby-identifier">join</span>))
|
@@ -45,11 +45,49 @@
|
|
45
45
|
<div class="sectiontitle">Methods</div>
|
46
46
|
<dl class="methods">
|
47
47
|
|
48
|
+
<dt>A</dt>
|
49
|
+
<dd>
|
50
|
+
<ul>
|
51
|
+
|
52
|
+
<li><a href="#M000068">anchor?</a></li>
|
53
|
+
|
54
|
+
</ul>
|
55
|
+
</dd>
|
56
|
+
|
57
|
+
<dt>I</dt>
|
58
|
+
<dd>
|
59
|
+
<ul>
|
60
|
+
|
61
|
+
<li><a href="#M000069">inline?</a></li>
|
62
|
+
|
63
|
+
</ul>
|
64
|
+
</dd>
|
65
|
+
|
66
|
+
<dt>O</dt>
|
67
|
+
<dd>
|
68
|
+
<ul>
|
69
|
+
|
70
|
+
<li><a href="#M000067">ordinal_number?</a></li>
|
71
|
+
|
72
|
+
</ul>
|
73
|
+
</dd>
|
74
|
+
|
75
|
+
<dt>S</dt>
|
76
|
+
<dd>
|
77
|
+
<ul>
|
78
|
+
|
79
|
+
<li><a href="#M000066">section_number?</a>,</li>
|
80
|
+
|
81
|
+
<li><a href="#M000070">silent?</a></li>
|
82
|
+
|
83
|
+
</ul>
|
84
|
+
</dd>
|
85
|
+
|
48
86
|
<dt>T</dt>
|
49
87
|
<dd>
|
50
88
|
<ul>
|
51
89
|
|
52
|
-
<li><a href="#
|
90
|
+
<li><a href="#M000065">to_s</a></li>
|
53
91
|
|
54
92
|
</ul>
|
55
93
|
</dd>
|
@@ -71,9 +109,144 @@
|
|
71
109
|
<div class="sectiontitle">Instance Public methods</div>
|
72
110
|
|
73
111
|
<div class="method">
|
74
|
-
<div class="title" id="
|
112
|
+
<div class="title" id="M000068">
|
113
|
+
|
114
|
+
<a name="M000068"></a><b>anchor?</b>()
|
115
|
+
|
116
|
+
</div>
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
<div class="sourcecode">
|
122
|
+
<p class="source-link">
|
123
|
+
Source: <a href="javascript:toggleSource('M000068_source')" id="l_M000068_source">show</a>
|
124
|
+
|
125
|
+
| <a href="http://github.com/sunaku/erbook/blob/aeaff38e68b16f53360682a1f9770747dd84ecb6/lib/erbook/document.rb#L269" target="_blank" class="github_url">on GitHub</a>
|
126
|
+
|
127
|
+
</p>
|
128
|
+
<div id="M000068_source" class="dyn-source">
|
129
|
+
<pre><span class="ruby-comment cmt"># File lib/erbook/document.rb, line 269</span>
|
130
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">anchor?</span>
|
131
|
+
<span class="ruby-keyword kw">not</span> <span class="ruby-identifier">inline?</span> <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">silent?</span>
|
132
|
+
<span class="ruby-keyword kw">end</span></pre>
|
133
|
+
</div>
|
134
|
+
</div>
|
135
|
+
|
136
|
+
</div>
|
137
|
+
|
138
|
+
<div class="method">
|
139
|
+
<div class="title" id="M000069">
|
140
|
+
|
141
|
+
<a name="M000069"></a><b>inline?</b>()
|
142
|
+
|
143
|
+
</div>
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
<div class="sourcecode">
|
149
|
+
<p class="source-link">
|
150
|
+
Source: <a href="javascript:toggleSource('M000069_source')" id="l_M000069_source">show</a>
|
151
|
+
|
152
|
+
| <a href="http://github.com/sunaku/erbook/blob/aeaff38e68b16f53360682a1f9770747dd84ecb6/lib/erbook/document.rb#L273" target="_blank" class="github_url">on GitHub</a>
|
153
|
+
|
154
|
+
</p>
|
155
|
+
<div id="M000069_source" class="dyn-source">
|
156
|
+
<pre><span class="ruby-comment cmt"># File lib/erbook/document.rb, line 273</span>
|
157
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">inline?</span>
|
158
|
+
<span class="ruby-identifier">definition</span>[<span class="ruby-value str">'inline'</span>]
|
159
|
+
<span class="ruby-keyword kw">end</span></pre>
|
160
|
+
</div>
|
161
|
+
</div>
|
162
|
+
|
163
|
+
</div>
|
164
|
+
|
165
|
+
<div class="method">
|
166
|
+
<div class="title" id="M000067">
|
167
|
+
|
168
|
+
<a name="M000067"></a><b>ordinal_number?</b>()
|
169
|
+
|
170
|
+
</div>
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
<div class="sourcecode">
|
176
|
+
<p class="source-link">
|
177
|
+
Source: <a href="javascript:toggleSource('M000067_source')" id="l_M000067_source">show</a>
|
178
|
+
|
179
|
+
| <a href="http://github.com/sunaku/erbook/blob/aeaff38e68b16f53360682a1f9770747dd84ecb6/lib/erbook/document.rb#L265" target="_blank" class="github_url">on GitHub</a>
|
180
|
+
|
181
|
+
</p>
|
182
|
+
<div id="M000067_source" class="dyn-source">
|
183
|
+
<pre><span class="ruby-comment cmt"># File lib/erbook/document.rb, line 265</span>
|
184
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ordinal_number?</span>
|
185
|
+
<span class="ruby-constant">Array</span>(<span class="ruby-identifier">definition</span>[<span class="ruby-value str">'number'</span>]).<span class="ruby-identifier">include?</span> <span class="ruby-value str">'ordinal'</span>
|
186
|
+
<span class="ruby-keyword kw">end</span></pre>
|
187
|
+
</div>
|
188
|
+
</div>
|
189
|
+
|
190
|
+
</div>
|
191
|
+
|
192
|
+
<div class="method">
|
193
|
+
<div class="title" id="M000066">
|
194
|
+
|
195
|
+
<a name="M000066"></a><b>section_number?</b>()
|
196
|
+
|
197
|
+
</div>
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
<div class="sourcecode">
|
203
|
+
<p class="source-link">
|
204
|
+
Source: <a href="javascript:toggleSource('M000066_source')" id="l_M000066_source">show</a>
|
205
|
+
|
206
|
+
| <a href="http://github.com/sunaku/erbook/blob/aeaff38e68b16f53360682a1f9770747dd84ecb6/lib/erbook/document.rb#L261" target="_blank" class="github_url">on GitHub</a>
|
207
|
+
|
208
|
+
</p>
|
209
|
+
<div id="M000066_source" class="dyn-source">
|
210
|
+
<pre><span class="ruby-comment cmt"># File lib/erbook/document.rb, line 261</span>
|
211
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">section_number?</span>
|
212
|
+
<span class="ruby-constant">Array</span>(<span class="ruby-identifier">definition</span>[<span class="ruby-value str">'number'</span>]).<span class="ruby-identifier">include?</span> <span class="ruby-value str">'section'</span>
|
213
|
+
<span class="ruby-keyword kw">end</span></pre>
|
214
|
+
</div>
|
215
|
+
</div>
|
216
|
+
|
217
|
+
</div>
|
218
|
+
|
219
|
+
<div class="method">
|
220
|
+
<div class="title" id="M000070">
|
221
|
+
|
222
|
+
<a name="M000070"></a><b>silent?</b>()
|
223
|
+
|
224
|
+
</div>
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
<div class="sourcecode">
|
230
|
+
<p class="source-link">
|
231
|
+
Source: <a href="javascript:toggleSource('M000070_source')" id="l_M000070_source">show</a>
|
232
|
+
|
233
|
+
| <a href="http://github.com/sunaku/erbook/blob/aeaff38e68b16f53360682a1f9770747dd84ecb6/lib/erbook/document.rb#L277" target="_blank" class="github_url">on GitHub</a>
|
234
|
+
|
235
|
+
</p>
|
236
|
+
<div id="M000070_source" class="dyn-source">
|
237
|
+
<pre><span class="ruby-comment cmt"># File lib/erbook/document.rb, line 277</span>
|
238
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">silent?</span>
|
239
|
+
<span class="ruby-identifier">definition</span>[<span class="ruby-value str">'silent'</span>]
|
240
|
+
<span class="ruby-keyword kw">end</span></pre>
|
241
|
+
</div>
|
242
|
+
</div>
|
243
|
+
|
244
|
+
</div>
|
245
|
+
|
246
|
+
<div class="method">
|
247
|
+
<div class="title" id="M000065">
|
75
248
|
|
76
|
-
<a name="
|
249
|
+
<a name="M000065"></a><b>to_s</b>()
|
77
250
|
|
78
251
|
</div>
|
79
252
|
|
@@ -89,15 +262,19 @@ Returns the output of this node.
|
|
89
262
|
|
90
263
|
<div class="sourcecode">
|
91
264
|
<p class="source-link">
|
92
|
-
Source: <a href="javascript:toggleSource('
|
265
|
+
Source: <a href="javascript:toggleSource('M000065_source')" id="l_M000065_source">show</a>
|
93
266
|
|
94
|
-
| <a href="http://github.com/sunaku/erbook/blob/
|
267
|
+
| <a href="http://github.com/sunaku/erbook/blob/aeaff38e68b16f53360682a1f9770747dd84ecb6/lib/erbook/document.rb#L253" target="_blank" class="github_url">on GitHub</a>
|
95
268
|
|
96
269
|
</p>
|
97
|
-
<div id="
|
98
|
-
<pre><span class="ruby-comment cmt"># File lib/erbook/document.rb, line
|
270
|
+
<div id="M000065_source" class="dyn-source">
|
271
|
+
<pre><span class="ruby-comment cmt"># File lib/erbook/document.rb, line 253</span>
|
99
272
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
|
100
|
-
<span class="ruby-
|
273
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">silent?</span>
|
274
|
+
<span class="ruby-value str">''</span>
|
275
|
+
<span class="ruby-keyword kw">else</span>
|
276
|
+
<span class="ruby-identifier">output</span>
|
277
|
+
<span class="ruby-keyword kw">end</span>
|
101
278
|
<span class="ruby-keyword kw">end</span></pre>
|
102
279
|
</div>
|
103
280
|
</div>
|
@@ -58,7 +58,7 @@ sandboxing for isolated template rendering.
|
|
58
58
|
<dd>
|
59
59
|
<ul>
|
60
60
|
|
61
|
-
<li><a href="#
|
61
|
+
<li><a href="#M000047">buffer</a></li>
|
62
62
|
|
63
63
|
</ul>
|
64
64
|
</dd>
|
@@ -67,7 +67,7 @@ sandboxing for isolated template rendering.
|
|
67
67
|
<dd>
|
68
68
|
<ul>
|
69
69
|
|
70
|
-
<li><a href="#
|
70
|
+
<li><a href="#M000042">new</a></li>
|
71
71
|
|
72
72
|
</ul>
|
73
73
|
</dd>
|
@@ -76,9 +76,9 @@ sandboxing for isolated template rendering.
|
|
76
76
|
<dd>
|
77
77
|
<ul>
|
78
78
|
|
79
|
-
<li><a href="#
|
79
|
+
<li><a href="#M000046">render</a>,</li>
|
80
80
|
|
81
|
-
<li><a href="#
|
81
|
+
<li><a href="#M000048">render_with</a></li>
|
82
82
|
|
83
83
|
</ul>
|
84
84
|
</dd>
|
@@ -120,9 +120,9 @@ sandboxing for isolated template rendering.
|
|
120
120
|
<div class="sectiontitle">Class Public methods</div>
|
121
121
|
|
122
122
|
<div class="method">
|
123
|
-
<div class="title" id="
|
123
|
+
<div class="title" id="M000042">
|
124
124
|
|
125
|
-
<a name="
|
125
|
+
<a name="M000042"></a><b>new</b>(source, input, unindent = true, safe_level = nil)
|
126
126
|
|
127
127
|
</div>
|
128
128
|
|
@@ -151,12 +151,12 @@ traces; so that the user can better determine the source of an error.
|
|
151
151
|
|
152
152
|
<div class="sourcecode">
|
153
153
|
<p class="source-link">
|
154
|
-
Source: <a href="javascript:toggleSource('
|
154
|
+
Source: <a href="javascript:toggleSource('M000042_source')" id="l_M000042_source">show</a>
|
155
155
|
|
156
156
|
| <a href="http://github.com/sunaku/erbook/blob/2b6f0dba66f674e479ef2cdeb7530389bf2af169/lib/erbook/template.rb#L33" target="_blank" class="github_url">on GitHub</a>
|
157
157
|
|
158
158
|
</p>
|
159
|
-
<div id="
|
159
|
+
<div id="M000042_source" class="dyn-source">
|
160
160
|
<pre><span class="ruby-comment cmt"># File lib/erbook/template.rb, line 33</span>
|
161
161
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span> <span class="ruby-identifier">source</span>, <span class="ruby-identifier">input</span>, <span class="ruby-identifier">unindent</span> = <span class="ruby-keyword kw">true</span>, <span class="ruby-identifier">safe_level</span> = <span class="ruby-keyword kw">nil</span>
|
162
162
|
<span class="ruby-keyword kw">super</span> <span class="ruby-identifier">input</span>,
|
@@ -184,9 +184,9 @@ traces; so that the user can better determine the source of an error.
|
|
184
184
|
<div class="sectiontitle">Instance Public methods</div>
|
185
185
|
|
186
186
|
<div class="method">
|
187
|
-
<div class="title" id="
|
187
|
+
<div class="title" id="M000047">
|
188
188
|
|
189
|
-
<a name="
|
189
|
+
<a name="M000047"></a><b>buffer</b>()
|
190
190
|
|
191
191
|
</div>
|
192
192
|
|
@@ -202,12 +202,12 @@ Returns the result of template evaluation thus far.
|
|
202
202
|
|
203
203
|
<div class="sourcecode">
|
204
204
|
<p class="source-link">
|
205
|
-
Source: <a href="javascript:toggleSource('
|
205
|
+
Source: <a href="javascript:toggleSource('M000047_source')" id="l_M000047_source">show</a>
|
206
206
|
|
207
207
|
| <a href="http://github.com/sunaku/erbook/blob/2b6f0dba66f674e479ef2cdeb7530389bf2af169/lib/erbook/template.rb#L64" target="_blank" class="github_url">on GitHub</a>
|
208
208
|
|
209
209
|
</p>
|
210
|
-
<div id="
|
210
|
+
<div id="M000047_source" class="dyn-source">
|
211
211
|
<pre><span class="ruby-comment cmt"># File lib/erbook/template.rb, line 64</span>
|
212
212
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">buffer</span>
|
213
213
|
<span class="ruby-ivar">@sandbox</span>.<span class="ruby-identifier">instance_variable_get</span>(<span class="ruby-identifier">:@buffer</span>)
|
@@ -218,9 +218,9 @@ Returns the result of template evaluation thus far.
|
|
218
218
|
</div>
|
219
219
|
|
220
220
|
<div class="method">
|
221
|
-
<div class="title" id="
|
221
|
+
<div class="title" id="M000046">
|
222
222
|
|
223
|
-
<a name="
|
223
|
+
<a name="M000046"></a><b>render</b>()
|
224
224
|
|
225
225
|
</div>
|
226
226
|
|
@@ -239,12 +239,12 @@ If no context is given, then the sandbox of this template is used.
|
|
239
239
|
|
240
240
|
<div class="sourcecode">
|
241
241
|
<p class="source-link">
|
242
|
-
Source: <a href="javascript:toggleSource('
|
242
|
+
Source: <a href="javascript:toggleSource('M000046_source')" id="l_M000046_source">show</a>
|
243
243
|
|
244
244
|
| <a href="http://github.com/sunaku/erbook/blob/2b6f0dba66f674e479ef2cdeb7530389bf2af169/lib/erbook/template.rb#L57" target="_blank" class="github_url">on GitHub</a>
|
245
245
|
|
246
246
|
</p>
|
247
|
-
<div id="
|
247
|
+
<div id="M000046_source" class="dyn-source">
|
248
248
|
<pre><span class="ruby-comment cmt"># File lib/erbook/template.rb, line 57</span>
|
249
249
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">render</span>
|
250
250
|
<span class="ruby-keyword kw">super</span> <span class="ruby-ivar">@sandbox</span>.<span class="ruby-identifier">instance_eval</span>(<span class="ruby-value str">'binding'</span>)
|
@@ -255,9 +255,9 @@ If no context is given, then the sandbox of this template is used.
|
|
255
255
|
</div>
|
256
256
|
|
257
257
|
<div class="method">
|
258
|
-
<div class="title" id="
|
258
|
+
<div class="title" id="M000048">
|
259
259
|
|
260
|
-
<a name="
|
260
|
+
<a name="M000048"></a><b>render_with</b>(inst_vars = {})
|
261
261
|
|
262
262
|
</div>
|
263
263
|
|
@@ -275,12 +275,12 @@ given instance variables, whose names must be prefixed with
|
|
275
275
|
|
276
276
|
<div class="sourcecode">
|
277
277
|
<p class="source-link">
|
278
|
-
Source: <a href="javascript:toggleSource('
|
278
|
+
Source: <a href="javascript:toggleSource('M000048_source')" id="l_M000048_source">show</a>
|
279
279
|
|
280
280
|
| <a href="http://github.com/sunaku/erbook/blob/2b6f0dba66f674e479ef2cdeb7530389bf2af169/lib/erbook/template.rb#L72" target="_blank" class="github_url">on GitHub</a>
|
281
281
|
|
282
282
|
</p>
|
283
|
-
<div id="
|
283
|
+
<div id="M000048_source" class="dyn-source">
|
284
284
|
<pre><span class="ruby-comment cmt"># File lib/erbook/template.rb, line 72</span>
|
285
285
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">render_with</span> <span class="ruby-identifier">inst_vars</span> = {}
|
286
286
|
<span class="ruby-identifier">old_sandbox</span> = <span class="ruby-ivar">@sandbox</span>
|