erbook 7.0.0 → 7.1.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/CREDITS +3 -0
- data/bin/erbook +2 -2
- data/doc/HelloWorld.input +1 -1
- data/doc/api/classes/ERBook/Document.html +153 -150
- data/doc/api/classes/ERBook/Document/Node.html +7 -7
- data/doc/api/classes/ERBook/Template.html +24 -24
- data/doc/api/classes/ERBook/Template/Sandbox.html +6 -6
- data/doc/api/classes/RDoc/AnyMethod.html +32 -28
- data/doc/api/classes/RDoc/TopLevel.html +47 -47
- data/doc/api/classes/String.html +14 -14
- data/doc/api/created.rid +1 -1
- data/doc/api/files/CREDITS.html +68 -0
- data/doc/api/files/lib/erbook/document_rb.html +1 -3
- data/doc/api/files/lib/erbook/rdoc_rb.html +1 -1
- data/doc/api/files/lib/erbook/template_rb.html +1 -1
- data/doc/api/files/lib/erbook/to_xhtml_rb.html +3 -3
- data/doc/api/files/lib/erbook_rb.html +3 -1
- data/doc/api/panel/search_index.js +1 -1
- data/doc/api/panel/tree.js +1 -1
- data/doc/formats.erb +129 -8
- data/doc/history.erb +136 -2
- data/doc/index.erb +2 -2
- data/doc/index.xhtml +1867 -610
- data/doc/intro.erb +29 -13
- data/doc/setup.erb +9 -2
- data/doc/theory.erb +24 -3
- data/doc/usage.erb +11 -2
- data/fmt/xhtml.yaml +913 -707
- data/fmt/{xhtml.icons → xhtml/icons}/index.yaml +2 -2
- data/fmt/{xhtml.icons → xhtml/icons}/mediawiki-1.13.2/COPYING +0 -0
- data/fmt/{xhtml.icons → xhtml/icons}/mediawiki-1.13.2/README +0 -0
- data/fmt/{xhtml.icons → xhtml/icons}/mediawiki-1.13.2/skins/simple/external.png +0 -0
- data/fmt/{xhtml.icons → xhtml/icons}/rakefile +4 -6
- data/fmt/{xhtml.icons → 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-next.png +0 -0
- data/fmt/xhtml/icons/tango-icon-theme-0.8.90/32x32/actions/go-previous.png +0 -0
- data/fmt/{xhtml.icons → xhtml/icons}/tango-icon-theme-0.8.90/32x32/places/start-here.png +0 -0
- data/fmt/{xhtml.icons → xhtml/icons}/tango-icon-theme-0.8.90/32x32/status/software-update-available.png +0 -0
- data/fmt/{xhtml.icons → xhtml/icons}/tango-icon-theme-0.8.90/48x48/apps/accessories-text-editor.png +0 -0
- data/fmt/{xhtml.icons → xhtml/icons}/tango-icon-theme-0.8.90/48x48/apps/internet-group-chat.png +0 -0
- data/fmt/{xhtml.icons → xhtml/icons}/tango-icon-theme-0.8.90/48x48/emblems/emblem-important.png +0 -0
- data/fmt/{xhtml.icons → xhtml/icons}/tango-icon-theme-0.8.90/48x48/status/dialog-error.png +0 -0
- data/fmt/{xhtml.icons → xhtml/icons}/tango-icon-theme-0.8.90/48x48/status/dialog-information.png +0 -0
- data/fmt/{xhtml.icons → xhtml/icons}/tango-icon-theme-0.8.90/48x48/status/dialog-warning.png +0 -0
- data/fmt/{xhtml.icons → xhtml/icons}/tango-icon-theme-0.8.90/COPYING +0 -0
- data/fmt/{xhtml.icons → xhtml/icons}/tango-icon-theme-0.8.90/README +0 -0
- data/fmt/{xhtml.icons → xhtml/icons}/tango-icon-theme-0.8.90/scalable/actions/bookmark-new.svg +0 -0
- data/fmt/{xhtml.icons → xhtml/icons}/tango-icon-theme-0.8.90/scalable/actions/go-home.svg +0 -0
- data/fmt/xhtml/icons/tango-icon-theme-0.8.90/scalable/actions/go-next.svg +191 -0
- data/fmt/xhtml/icons/tango-icon-theme-0.8.90/scalable/actions/go-previous.svg +852 -0
- data/fmt/{xhtml.icons → xhtml/icons}/tango-icon-theme-0.8.90/scalable/actions/view-refresh.svg +0 -0
- data/fmt/{xhtml.icons → xhtml/icons}/tango-icon-theme-0.8.90/scalable/apps/accessories-text-editor.svg +0 -0
- data/fmt/{xhtml.icons → xhtml/icons}/tango-icon-theme-0.8.90/scalable/apps/internet-group-chat.svg +0 -0
- data/fmt/{xhtml.icons → xhtml/icons}/tango-icon-theme-0.8.90/scalable/emblems/emblem-favorite.svg +0 -0
- data/fmt/{xhtml.icons → xhtml/icons}/tango-icon-theme-0.8.90/scalable/emblems/emblem-important.svg +0 -0
- data/fmt/{xhtml.icons → xhtml/icons}/tango-icon-theme-0.8.90/scalable/mimetypes/application-certificate.svg +0 -0
- data/fmt/{xhtml.icons → xhtml/icons}/tango-icon-theme-0.8.90/scalable/places/start-here.svg +0 -0
- data/fmt/{xhtml.icons → xhtml/icons}/tango-icon-theme-0.8.90/scalable/status/dialog-error.svg +0 -0
- data/fmt/{xhtml.icons → xhtml/icons}/tango-icon-theme-0.8.90/scalable/status/dialog-information.svg +0 -0
- data/fmt/{xhtml.icons → xhtml/icons}/tango-icon-theme-0.8.90/scalable/status/dialog-warning.svg +0 -0
- data/fmt/{xhtml.icons → xhtml/icons}/tango-icon-theme-0.8.90/scalable/status/software-update-available.svg +0 -0
- data/fmt/xhtml/jquery/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/fmt/xhtml/jquery/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/fmt/xhtml/jquery/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/fmt/xhtml/jquery/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/fmt/xhtml/jquery/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/fmt/xhtml/jquery/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/fmt/xhtml/jquery/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/fmt/xhtml/jquery/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/fmt/xhtml/jquery/images/ui-icons_222222_256x240.png +0 -0
- data/fmt/xhtml/jquery/images/ui-icons_2e83ff_256x240.png +0 -0
- data/fmt/xhtml/jquery/images/ui-icons_454545_256x240.png +0 -0
- data/fmt/xhtml/jquery/images/ui-icons_888888_256x240.png +0 -0
- data/fmt/xhtml/jquery/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/fmt/{xhtml.scripts → xhtml/jquery}/jquery-1.3.2.min.js +0 -0
- data/fmt/xhtml/jquery/jquery-ui-1.7.2.custom.css +406 -0
- data/fmt/xhtml/jquery/jquery-ui-1.7.2.custom.min.js +43 -0
- data/lang/de.yaml +13 -2
- data/lang/el.yaml +13 -2
- data/lang/es.yaml +13 -2
- data/lang/fr.yaml +13 -2
- data/lang/it.yaml +13 -2
- data/lang/ja.yaml +13 -2
- data/lang/ko.yaml +13 -2
- data/lang/nl.yaml +13 -2
- data/lang/phrases.yaml +15 -4
- data/lang/pt.yaml +13 -2
- data/lang/ru.yaml +13 -2
- data/lang/zh.yaml +13 -2
- data/lang/zt.yaml +13 -2
- data/lib/erbook.rb +10 -8
- data/lib/erbook/document.rb +144 -139
- data/lib/erbook/rdoc.rb +29 -7
- data/lib/erbook/template.rb +2 -2
- data/lib/erbook/to_xhtml.rb +6 -2
- metadata +78 -45
- data/doc/api/files/ANN_eml.html +0 -276
- data/doc/api/files/ANN_html.html +0 -407
- data/doc/api/files/ANN_txt.html +0 -271
- 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/scalable/actions/go-down.svg +0 -200
- data/fmt/xhtml.icons/tango-icon-theme-0.8.90/scalable/actions/go-up.svg +0 -196
- data/fmt/xhtml.scripts/jquery.localscroll-1.2.7-min.js +0 -9
- data/fmt/xhtml.scripts/jquery.scrollTo-1.4.1-min.js +0 -11
data/CREDITS
ADDED
data/bin/erbook
CHANGED
data/doc/HelloWorld.input
CHANGED
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
<dd>
|
|
50
50
|
<ul>
|
|
51
51
|
|
|
52
|
-
<li><a href="#
|
|
52
|
+
<li><a href="#M000048">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="#M000061">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="M000048">
|
|
136
136
|
|
|
137
|
-
<a name="
|
|
137
|
+
<a name="M000048"></a><b>new</b>(format_name, input_text, input_file, options = {})
|
|
138
138
|
|
|
139
139
|
</div>
|
|
140
140
|
|
|
@@ -166,16 +166,16 @@ 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('M000048_source')" id="l_M000048_source">show</a>
|
|
170
170
|
|
|
171
|
-
| <a href="http://github.com/sunaku/erbook/blob/
|
|
171
|
+
| <a href="http://github.com/sunaku/erbook/blob/9c3f6ad5c94f67d3f20e896873dbc7b127036c44/lib/erbook/document.rb#L42" target="_blank" class="github_url">on GitHub</a>
|
|
172
172
|
|
|
173
173
|
</p>
|
|
174
|
-
<div id="
|
|
174
|
+
<div id="M000048_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>
|
|
178
|
-
|
|
178
|
+
<span class="ruby-ivar">@format_file</span> = <span class="ruby-identifier">format_name</span>.<span class="ruby-identifier">to_s</span>
|
|
179
179
|
|
|
180
180
|
<span class="ruby-constant">File</span>.<span class="ruby-identifier">file?</span> <span class="ruby-ivar">@format_file</span> <span class="ruby-keyword kw">or</span>
|
|
181
181
|
<span class="ruby-ivar">@format_file</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">ERBook</span><span class="ruby-operator">::</span><span class="ruby-constant">FORMATS_DIR</span>, <span class="ruby-ivar">@format_file</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'.yaml'</span>)
|
|
@@ -196,160 +196,163 @@ specification file.
|
|
|
196
196
|
<span class="ruby-ivar">@node_defs</span> = <span class="ruby-ivar">@format</span>[<span class="ruby-value str">'nodes'</span>]
|
|
197
197
|
|
|
198
198
|
<span class="ruby-comment cmt"># process input document</span>
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
<span class="ruby-
|
|
199
|
+
<span class="ruby-keyword kw">begin</span>
|
|
200
|
+
<span class="ruby-comment cmt"># create sandbox for input evaluation</span>
|
|
201
|
+
<span class="ruby-identifier">template</span> = <span class="ruby-constant">Template</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">input_file</span>, <span class="ruby-identifier">input_text</span>, <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:unindent</span>])
|
|
202
|
+
<span class="ruby-identifier">sandbox</span> = <span class="ruby-identifier">template</span>.<span class="ruby-identifier">sandbox</span>
|
|
203
|
+
|
|
204
|
+
<span class="ruby-ivar">@template_vars</span> = {
|
|
205
|
+
<span class="ruby-identifier">:@format</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@format</span>,
|
|
206
|
+
<span class="ruby-identifier">:@roots</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@roots</span> = [], <span class="ruby-comment cmt"># root nodes of all trees</span>
|
|
207
|
+
<span class="ruby-identifier">:@nodes</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@nodes</span> = [], <span class="ruby-comment cmt"># all nodes in the forest</span>
|
|
208
|
+
<span class="ruby-identifier">:@nodes_by_type</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@nodes_by_type</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>] = [] },
|
|
209
|
+
<span class="ruby-identifier">:@stack</span> =<span class="ruby-operator">></span> [], <span class="ruby-comment cmt"># stack for all nodes</span>
|
|
210
|
+
}.<span class="ruby-identifier">each_pair</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">sandbox</span>.<span class="ruby-identifier">instance_variable_set</span>(<span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span>) }
|
|
211
|
+
|
|
212
|
+
<span class="ruby-comment cmt">##</span>
|
|
213
|
+
<span class="ruby-comment cmt"># Handles the method call from a node</span>
|
|
214
|
+
<span class="ruby-comment cmt"># placeholder in the input document.</span>
|
|
215
|
+
<span class="ruby-comment cmt">#</span>
|
|
216
|
+
<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>
|
|
217
|
+
<span class="ruby-identifier">node</span> = <span class="ruby-constant">Node</span>.<span class="ruby-identifier">new</span>(
|
|
218
|
+
<span class="ruby-identifier">:type</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">node_type</span>,
|
|
219
|
+
<span class="ruby-identifier">:defn</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>],
|
|
220
|
+
<span class="ruby-identifier">:args</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">node_args</span>,
|
|
221
|
+
<span class="ruby-identifier">:children</span> =<span class="ruby-operator">></span> [],
|
|
222
|
+
|
|
223
|
+
<span class="ruby-comment cmt"># omit erbook internals from the stack trace</span>
|
|
224
|
+
<span class="ruby-identifier">:trace</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">caller</span>.<span class="ruby-identifier">reject</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span>
|
|
225
|
+
[<span class="ruby-identifier">$0</span>, <span class="ruby-constant">ERBook</span><span class="ruby-operator">::</span><span class="ruby-constant">INSTALL</span>].<span class="ruby-identifier">any?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">index</span>(<span class="ruby-identifier">f</span>) <span class="ruby-operator">==</span> <span class="ruby-value">0</span> }
|
|
226
|
+
}
|
|
227
|
+
)
|
|
228
|
+
<span class="ruby-ivar">@nodes</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">node</span>
|
|
229
|
+
<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>
|
|
230
|
+
|
|
231
|
+
<span class="ruby-comment cmt"># calculate occurrence number for this node</span>
|
|
232
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">defn</span>[<span class="ruby-value str">'number'</span>]
|
|
233
|
+
<span class="ruby-ivar">@count</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>] = []}
|
|
234
|
+
<span class="ruby-identifier">node</span>.<span class="ruby-identifier">number</span> = (<span class="ruby-ivar">@count</span>[<span class="ruby-identifier">node</span>.<span class="ruby-identifier">type</span>] <span class="ruby-operator"><<</span> <span class="ruby-identifier">node</span>).<span class="ruby-identifier">length</span>
|
|
235
|
+
<span class="ruby-keyword kw">end</span>
|
|
234
236
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
237
|
+
<span class="ruby-comment cmt"># assign node family</span>
|
|
238
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">parent</span> = <span class="ruby-ivar">@stack</span>.<span class="ruby-identifier">last</span>
|
|
239
|
+
<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">children</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">node</span>
|
|
240
|
+
<span class="ruby-identifier">node</span>.<span class="ruby-identifier">parent</span> = <span class="ruby-identifier">parent</span>
|
|
241
|
+
<span class="ruby-identifier">node</span>.<span class="ruby-identifier">depth</span> = <span class="ruby-identifier">parent</span>.<span class="ruby-identifier">depth</span>
|
|
242
|
+
<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">defn</span>[<span class="ruby-value str">'depth'</span>]
|
|
241
243
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
244
|
+
<span class="ruby-comment cmt"># calculate latex-style index number for this node</span>
|
|
245
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">defn</span>[<span class="ruby-value str">'index'</span>]
|
|
246
|
+
<span class="ruby-identifier">ancestry</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">defn</span>[<span class="ruby-value str">'index'</span>] }.<span class="ruby-identifier">index</span>
|
|
247
|
+
<span class="ruby-identifier">branches</span> = <span class="ruby-identifier">node</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">index</span> }
|
|
246
248
|
|
|
247
|
-
|
|
248
|
-
<span class="ruby-keyword kw">end</span>
|
|
249
|
-
<span class="ruby-keyword kw">else</span>
|
|
250
|
-
<span class="ruby-ivar">@roots</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">node</span>
|
|
251
|
-
<span class="ruby-identifier">node</span>.<span class="ruby-identifier">parent</span> = <span class="ruby-keyword kw">nil</span>
|
|
252
|
-
<span class="ruby-identifier">node</span>.<span class="ruby-identifier">depth</span> = <span class="ruby-value">0</span>
|
|
253
|
-
|
|
254
|
-
<span class="ruby-comment cmt"># calculate latex-style index number for this node</span>
|
|
255
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">defn</span>[<span class="ruby-value str">'index'</span>]
|
|
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">index</span> }
|
|
257
|
-
<span class="ruby-identifier">node</span>.<span class="ruby-identifier">index</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
|
-
<span class="ruby-keyword kw">end</span>
|
|
249
|
+
<span class="ruby-identifier">node</span>.<span class="ruby-identifier">index</span> = [<span class="ruby-identifier">ancestry</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">join</span>(<span class="ruby-value str">'.'</span>)
|
|
259
250
|
<span class="ruby-keyword kw">end</span>
|
|
260
|
-
|
|
261
|
-
<span class="ruby-
|
|
262
|
-
<span class="ruby-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
251
|
+
<span class="ruby-keyword kw">else</span>
|
|
252
|
+
<span class="ruby-ivar">@roots</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">node</span>
|
|
253
|
+
<span class="ruby-identifier">node</span>.<span class="ruby-identifier">parent</span> = <span class="ruby-keyword kw">nil</span>
|
|
254
|
+
<span class="ruby-identifier">node</span>.<span class="ruby-identifier">depth</span> = <span class="ruby-value">0</span>
|
|
255
|
+
|
|
256
|
+
<span class="ruby-comment cmt"># calculate latex-style index number for this node</span>
|
|
257
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">defn</span>[<span class="ruby-value str">'index'</span>]
|
|
258
|
+
<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">index</span> }
|
|
259
|
+
<span class="ruby-identifier">node</span>.<span class="ruby-identifier">index</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>
|
|
266
260
|
<span class="ruby-keyword kw">end</span>
|
|
267
|
-
|
|
268
|
-
<span class="ruby-ivar">@buffer</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">node</span>
|
|
269
|
-
|
|
270
|
-
<span class="ruby-keyword kw">nil</span>
|
|
271
261
|
<span class="ruby-keyword kw">end</span>
|
|
272
262
|
|
|
273
|
-
<span class="ruby-
|
|
274
|
-
|
|
275
|
-
<span class="ruby-
|
|
276
|
-
<span class="ruby-identifier">
|
|
277
|
-
|
|
278
|
-
__node_impl__ #{type.inspect}, *node_args, &node_content
|
|
279
|
-
end
|
|
280
|
-
}</span>, <span class="ruby-identifier">binding</span>, <span class="ruby-identifier">file</span>, <span class="ruby-identifier">line</span>
|
|
263
|
+
<span class="ruby-comment cmt"># assign node content</span>
|
|
264
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
|
|
265
|
+
<span class="ruby-ivar">@stack</span>.<span class="ruby-identifier">push</span> <span class="ruby-identifier">node</span>
|
|
266
|
+
<span class="ruby-identifier">node</span>.<span class="ruby-identifier">content</span> = <span class="ruby-identifier">__block_content__</span>(<span class="ruby-identifier">node</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">node_content</span>)
|
|
267
|
+
<span class="ruby-ivar">@stack</span>.<span class="ruby-identifier">pop</span>
|
|
281
268
|
<span class="ruby-keyword kw">end</span>
|
|
282
269
|
|
|
283
|
-
|
|
284
|
-
<span class="ruby-identifier">template</span>.<span class="ruby-identifier">render</span>
|
|
285
|
-
<span class="ruby-ivar">@processed_document</span> = <span class="ruby-identifier">template</span>.<span class="ruby-identifier">buffer</span>
|
|
270
|
+
<span class="ruby-ivar">@buffer</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">node</span>
|
|
286
271
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
<span class="ruby-identifier">n</span>.<span class="ruby-identifier">defn</span>[<span class="ruby-value str">'inline'</span>] }
|
|
272
|
+
<span class="ruby-keyword kw">nil</span>
|
|
273
|
+
<span class="ruby-keyword kw">end</span>
|
|
290
274
|
|
|
291
|
-
|
|
292
|
-
<span class="ruby-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
275
|
+
<span class="ruby-ivar">@node_defs</span>.<span class="ruby-identifier">each_key</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">type</span><span class="ruby-operator">|</span>
|
|
276
|
+
<span class="ruby-comment cmt"># XXX: using a string because define_method()</span>
|
|
277
|
+
<span class="ruby-comment cmt"># does not accept a block until Ruby 1.9</span>
|
|
278
|
+
<span class="ruby-identifier">file</span>, <span class="ruby-identifier">line</span> = <span class="ruby-keyword kw">__FILE__</span>, <span class="ruby-keyword kw">__LINE__</span>; <span class="ruby-identifier">eval</span> <span class="ruby-node">%{
|
|
279
|
+
def sandbox.#{type} *node_args, &node_content
|
|
280
|
+
__node_impl__ #{type.inspect}, *node_args, &node_content
|
|
281
|
+
end
|
|
282
|
+
}</span>, <span class="ruby-identifier">binding</span>, <span class="ruby-identifier">file</span>, <span class="ruby-identifier">line</span>
|
|
283
|
+
<span class="ruby-keyword kw">end</span>
|
|
296
284
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
285
|
+
<span class="ruby-comment cmt"># evaluate the input & build the document tree</span>
|
|
286
|
+
<span class="ruby-identifier">template</span>.<span class="ruby-identifier">render</span>
|
|
287
|
+
<span class="ruby-ivar">@processed_document</span> = <span class="ruby-identifier">template</span>.<span class="ruby-identifier">buffer</span>
|
|
288
|
+
|
|
289
|
+
<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">reject</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">n</span><span class="ruby-operator">|</span>
|
|
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>
|
|
293
|
+
|
|
294
|
+
<span class="ruby-identifier">require</span> <span class="ruby-value str">'enumerator'</span>
|
|
295
|
+
<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>
|
|
296
|
+
<span class="ruby-identifier">a</span>.<span class="ruby-identifier">next_node</span> = <span class="ruby-identifier">b</span>
|
|
297
|
+
<span class="ruby-identifier">b</span>.<span class="ruby-identifier">prev_node</span> = <span class="ruby-identifier">a</span>
|
|
298
|
+
<span class="ruby-keyword kw">end</span>
|
|
299
|
+
|
|
300
|
+
<span class="ruby-comment cmt"># calculate output for all nodes</span>
|
|
301
|
+
<span class="ruby-identifier">actual_output_by_node</span> = {}
|
|
302
|
+
|
|
303
|
+
<span class="ruby-identifier">visitor</span> = <span class="ruby-identifier">lambda</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">n</span><span class="ruby-operator">|</span>
|
|
304
|
+
<span class="ruby-comment cmt">#</span>
|
|
305
|
+
<span class="ruby-comment cmt"># allow child nodes to calculate their actual</span>
|
|
306
|
+
<span class="ruby-comment cmt"># output and to set their identifier as Node#output</span>
|
|
307
|
+
<span class="ruby-comment cmt">#</span>
|
|
308
|
+
<span class="ruby-comment cmt"># we do this nodes first because this node's</span>
|
|
309
|
+
<span class="ruby-comment cmt"># content contains the child nodes' output</span>
|
|
310
|
+
<span class="ruby-comment cmt">#</span>
|
|
311
|
+
<span class="ruby-identifier">n</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-identifier">visitor</span>.<span class="ruby-identifier">call</span> <span class="ruby-identifier">c</span> }
|
|
312
|
+
|
|
313
|
+
<span class="ruby-comment cmt"># calculate the output for this node</span>
|
|
314
|
+
<span class="ruby-identifier">actual_output</span> = <span class="ruby-constant">Template</span>.<span class="ruby-identifier">new</span>(
|
|
315
|
+
<span class="ruby-node">"#{@format_file}:nodes:#{n.type}:output"</span>,
|
|
316
|
+
<span class="ruby-identifier">n</span>.<span class="ruby-identifier">defn</span>[<span class="ruby-value str">'output'</span>].<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">chomp</span>
|
|
317
|
+
).<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
|
+
|
|
319
|
+
<span class="ruby-comment cmt"># reveal child nodes' actual output in this node's actual output</span>
|
|
320
|
+
<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">defn</span>[<span class="ruby-value str">'inline'</span>] <span class="ruby-operator">&&</span> <span class="ruby-operator">!</span><span class="ruby-identifier">c</span>.<span class="ruby-identifier">defn</span>[<span class="ruby-value str">'bypass'</span>]
|
|
322
|
+
<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
|
+
|
|
324
|
+
<span class="ruby-keyword kw">else</span>
|
|
325
|
+
<span class="ruby-comment cmt"># pull block-level node out of paragraph tag added by Maruku</span>
|
|
326
|
+
<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
|
+
<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>
|
|
326
328
|
<span class="ruby-keyword kw">end</span>
|
|
327
329
|
<span class="ruby-keyword kw">end</span>
|
|
328
|
-
|
|
329
|
-
<span class="ruby-identifier">actual_output_by_node</span>[<span class="ruby-identifier">n</span>] = <span class="ruby-identifier">actual_output</span>
|
|
330
|
-
|
|
331
|
-
<span class="ruby-comment cmt">#</span>
|
|
332
|
-
<span class="ruby-comment cmt"># allow the parent node to calculate its actual</span>
|
|
333
|
-
<span class="ruby-comment cmt"># output without interference from the output of</span>
|
|
334
|
-
<span class="ruby-comment cmt"># this node (Node#to_s is aliased to Node#output)</span>
|
|
335
|
-
<span class="ruby-comment cmt">#</span>
|
|
336
|
-
<span class="ruby-comment cmt"># this assumes that having this node's string</span>
|
|
337
|
-
<span class="ruby-comment cmt"># representation be a consecutive sequence of digits</span>
|
|
338
|
-
<span class="ruby-comment cmt"># will not interfere with the text-to-whatever</span>
|
|
339
|
-
<span class="ruby-comment cmt"># transformation defined by the format specification</span>
|
|
340
|
-
<span class="ruby-comment cmt">#</span>
|
|
341
|
-
<span class="ruby-identifier">n</span>.<span class="ruby-identifier">output</span> = <span class="ruby-constant">Digest</span><span class="ruby-operator">::</span><span class="ruby-constant">SHA1</span>.<span class="ruby-identifier">digest</span>(<span class="ruby-identifier">n</span>.<span class="ruby-identifier">object_id</span>.<span class="ruby-identifier">to_s</span>).<span class="ruby-identifier">unpack</span>(<span class="ruby-value str">'I*'</span>).<span class="ruby-identifier">join</span>
|
|
342
330
|
<span class="ruby-keyword kw">end</span>
|
|
343
331
|
|
|
344
|
-
<span class="ruby-
|
|
332
|
+
<span class="ruby-identifier">actual_output_by_node</span>[<span class="ruby-identifier">n</span>] = <span class="ruby-identifier">actual_output</span>
|
|
333
|
+
|
|
334
|
+
<span class="ruby-comment cmt">#</span>
|
|
335
|
+
<span class="ruby-comment cmt"># allow the parent node to calculate its actual</span>
|
|
336
|
+
<span class="ruby-comment cmt"># output without interference from the output of</span>
|
|
337
|
+
<span class="ruby-comment cmt"># this node (Node#to_s is aliased to Node#output)</span>
|
|
338
|
+
<span class="ruby-comment cmt">#</span>
|
|
339
|
+
<span class="ruby-comment cmt"># this assumes that having this node's string</span>
|
|
340
|
+
<span class="ruby-comment cmt"># representation be a consecutive sequence of digits</span>
|
|
341
|
+
<span class="ruby-comment cmt"># will not interfere with the text-to-whatever</span>
|
|
342
|
+
<span class="ruby-comment cmt"># transformation defined by the format specification</span>
|
|
343
|
+
<span class="ruby-comment cmt">#</span>
|
|
344
|
+
<span class="ruby-identifier">n</span>.<span class="ruby-identifier">output</span> = <span class="ruby-constant">Digest</span><span class="ruby-operator">::</span><span class="ruby-constant">SHA1</span>.<span class="ruby-identifier">digest</span>(<span class="ruby-identifier">n</span>.<span class="ruby-identifier">object_id</span>.<span class="ruby-identifier">to_s</span>).<span class="ruby-identifier">unpack</span>(<span class="ruby-value str">'I*'</span>).<span class="ruby-identifier">join</span>
|
|
345
|
+
<span class="ruby-keyword kw">end</span>
|
|
346
|
+
|
|
347
|
+
<span class="ruby-ivar">@roots</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">n</span><span class="ruby-operator">|</span> <span class="ruby-identifier">visitor</span>.<span class="ruby-identifier">call</span> <span class="ruby-identifier">n</span> }
|
|
345
348
|
|
|
346
|
-
|
|
347
|
-
|
|
349
|
+
<span class="ruby-comment cmt"># replace the temporary identifier with each node's actual output</span>
|
|
350
|
+
<span class="ruby-ivar">@nodes</span>.<span class="ruby-identifier">each</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">output</span> = <span class="ruby-identifier">actual_output_by_node</span>[<span class="ruby-identifier">n</span>] }
|
|
348
351
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
352
|
+
<span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span>
|
|
353
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">input_text</span> <span class="ruby-comment cmt"># so the user can debug line numbers in stack trace</span>
|
|
354
|
+
<span class="ruby-identifier">error</span> <span class="ruby-node">"Could not process input document #{input_file.inspect}"</span>
|
|
355
|
+
<span class="ruby-keyword kw">end</span>
|
|
353
356
|
<span class="ruby-keyword kw">end</span></pre>
|
|
354
357
|
</div>
|
|
355
358
|
</div>
|
|
@@ -359,9 +362,9 @@ specification file.
|
|
|
359
362
|
<div class="sectiontitle">Instance Public methods</div>
|
|
360
363
|
|
|
361
364
|
<div class="method">
|
|
362
|
-
<div class="title" id="
|
|
365
|
+
<div class="title" id="M000061">
|
|
363
366
|
|
|
364
|
-
<a name="
|
|
367
|
+
<a name="M000061"></a><b>to_s</b>()
|
|
365
368
|
|
|
366
369
|
</div>
|
|
367
370
|
|
|
@@ -377,13 +380,13 @@ Returns the output of this document.
|
|
|
377
380
|
|
|
378
381
|
<div class="sourcecode">
|
|
379
382
|
<p class="source-link">
|
|
380
|
-
Source: <a href="javascript:toggleSource('
|
|
383
|
+
Source: <a href="javascript:toggleSource('M000061_source')" id="l_M000061_source">show</a>
|
|
381
384
|
|
|
382
|
-
| <a href="http://github.com/sunaku/erbook/blob/
|
|
385
|
+
| <a href="http://github.com/sunaku/erbook/blob/9c3f6ad5c94f67d3f20e896873dbc7b127036c44/lib/erbook/document.rb#L227" target="_blank" class="github_url">on GitHub</a>
|
|
383
386
|
|
|
384
387
|
</p>
|
|
385
|
-
<div id="
|
|
386
|
-
<pre><span class="ruby-comment cmt"># File lib/erbook/document.rb, line
|
|
388
|
+
<div id="M000061_source" class="dyn-source">
|
|
389
|
+
<pre><span class="ruby-comment cmt"># File lib/erbook/document.rb, line 227</span>
|
|
387
390
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span><span class="ruby-identifier">to_s</span>
|
|
388
391
|
<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>).
|
|
389
392
|
<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>))
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
<dd>
|
|
50
50
|
<ul>
|
|
51
51
|
|
|
52
|
-
<li><a href="#
|
|
52
|
+
<li><a href="#M000062">to_s</a></li>
|
|
53
53
|
|
|
54
54
|
</ul>
|
|
55
55
|
</dd>
|
|
@@ -71,9 +71,9 @@
|
|
|
71
71
|
<div class="sectiontitle">Instance Public methods</div>
|
|
72
72
|
|
|
73
73
|
<div class="method">
|
|
74
|
-
<div class="title" id="
|
|
74
|
+
<div class="title" id="M000062">
|
|
75
75
|
|
|
76
|
-
<a name="
|
|
76
|
+
<a name="M000062"></a><b>to_s</b>()
|
|
77
77
|
|
|
78
78
|
</div>
|
|
79
79
|
|
|
@@ -89,13 +89,13 @@ Returns the output of this node.
|
|
|
89
89
|
|
|
90
90
|
<div class="sourcecode">
|
|
91
91
|
<p class="source-link">
|
|
92
|
-
Source: <a href="javascript:toggleSource('
|
|
92
|
+
Source: <a href="javascript:toggleSource('M000062_source')" id="l_M000062_source">show</a>
|
|
93
93
|
|
|
94
|
-
| <a href="http://github.com/sunaku/erbook/blob/
|
|
94
|
+
| <a href="http://github.com/sunaku/erbook/blob/9c3f6ad5c94f67d3f20e896873dbc7b127036c44/lib/erbook/document.rb#L241" target="_blank" class="github_url">on GitHub</a>
|
|
95
95
|
|
|
96
96
|
</p>
|
|
97
|
-
<div id="
|
|
98
|
-
<pre><span class="ruby-comment cmt"># File lib/erbook/document.rb, line
|
|
97
|
+
<div id="M000062_source" class="dyn-source">
|
|
98
|
+
<pre><span class="ruby-comment cmt"># File lib/erbook/document.rb, line 241</span>
|
|
99
99
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
|
|
100
100
|
<span class="ruby-identifier">defn</span>[<span class="ruby-value str">'silent'</span>] <span class="ruby-operator">?</span> <span class="ruby-value str">''</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">output</span>
|
|
101
101
|
<span class="ruby-keyword kw">end</span></pre>
|
|
@@ -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="#M000042">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="#M000038">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="#M000041">render</a>,</li>
|
|
80
80
|
|
|
81
|
-
<li><a href="#
|
|
81
|
+
<li><a href="#M000043">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="M000038">
|
|
124
124
|
|
|
125
|
-
<a name="
|
|
125
|
+
<a name="M000038"></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('M000038_source')" id="l_M000038_source">show</a>
|
|
155
155
|
|
|
156
|
-
| <a href="http://github.com/sunaku/erbook/blob/
|
|
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="M000038_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="M000042">
|
|
188
188
|
|
|
189
|
-
<a name="
|
|
189
|
+
<a name="M000042"></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('M000042_source')" id="l_M000042_source">show</a>
|
|
206
206
|
|
|
207
|
-
| <a href="http://github.com/sunaku/erbook/blob/
|
|
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="M000042_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="M000041">
|
|
222
222
|
|
|
223
|
-
<a name="
|
|
223
|
+
<a name="M000041"></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('M000041_source')" id="l_M000041_source">show</a>
|
|
243
243
|
|
|
244
|
-
| <a href="http://github.com/sunaku/erbook/blob/
|
|
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="M000041_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="M000043">
|
|
259
259
|
|
|
260
|
-
<a name="
|
|
260
|
+
<a name="M000043"></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('M000043_source')" id="l_M000043_source">show</a>
|
|
279
279
|
|
|
280
|
-
| <a href="http://github.com/sunaku/erbook/blob/
|
|
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="M000043_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>
|