erubis 2.2.0 → 2.3.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/CHANGES +120 -3
- data/README.txt +1 -1
- data/benchmark/Makefile +6 -0
- data/benchmark/bench.rb +306 -0
- data/benchmark/{erubybench.yaml → bench_context.yaml} +20 -20
- data/benchmark/templates/_footer.html +4 -0
- data/benchmark/{erubybench.rhtml → templates/_header.html} +1 -34
- data/benchmark/templates/bench_erb.rhtml +29 -0
- data/benchmark/templates/bench_erubis.rhtml +29 -0
- data/benchmark/templates/bench_eruby.rhtml +29 -0
- data/bin/erubis +2 -2
- data/contrib/erubis +3 -3114
- data/contrib/erubis-run.rb +132 -0
- data/contrib/inline-require +1 -1
- data/doc-api/classes/{ERB.html → ActionView/Base/ERB.html} +3 -3
- data/doc-api/classes/Erubis.html +8 -1
- data/doc-api/classes/Erubis/ArrayEnhancer.html +12 -12
- data/doc-api/classes/Erubis/Basic/Converter.html +24 -24
- data/doc-api/classes/Erubis/BiPatternEnhancer.html +14 -14
- data/doc-api/classes/Erubis/CGenerator.html +60 -60
- data/doc-api/classes/Erubis/Context.html +42 -42
- data/doc-api/classes/Erubis/Converter.html +27 -27
- data/doc-api/classes/Erubis/DeleteIndentEnhancer.html +150 -0
- data/doc-api/classes/Erubis/DeleteIndentEruby.html +120 -0
- data/doc-api/classes/Erubis/Engine.html +31 -31
- data/doc-api/classes/Erubis/ErboutEnhancer.html +175 -0
- data/doc-api/classes/Erubis/ErboutEruby.html +120 -0
- data/doc-api/classes/Erubis/Eruby.html +5 -0
- data/doc-api/classes/Erubis/EscapeEnhancer.html +6 -6
- data/doc-api/classes/Erubis/Evaluator.html +19 -19
- data/doc-api/classes/Erubis/FastEruby.html +131 -0
- data/doc-api/classes/Erubis/HeaderFooterEnhancer.html +14 -14
- data/doc-api/classes/Erubis/Helpers/RailsHelper.html +49 -45
- data/doc-api/classes/Erubis/InterpolationEnhancer.html +304 -0
- data/doc-api/classes/Erubis/InterpolationEruby.html +120 -0
- data/doc-api/classes/Erubis/JavaGenerator.html +54 -54
- data/doc-api/classes/Erubis/JavascriptGenerator.html +60 -60
- data/doc-api/classes/Erubis/Main.html +35 -27
- data/doc-api/classes/Erubis/NoCodeEnhancer.html +5 -5
- data/doc-api/classes/Erubis/NoTextEnhancer.html +7 -7
- data/doc-api/classes/Erubis/OptimizedEruby.html +6 -6
- data/doc-api/classes/Erubis/OptimizedGenerator.html +72 -72
- data/doc-api/classes/Erubis/OptimizedXmlEruby.html +6 -6
- data/doc-api/classes/Erubis/PI/Converter.html +18 -18
- data/doc-api/classes/Erubis/PI/Ec.html +6 -6
- data/doc-api/classes/Erubis/PI/Ejava.html +6 -6
- data/doc-api/classes/Erubis/PI/Ejavascript.html +6 -6
- data/doc-api/classes/Erubis/PI/Eperl.html +6 -6
- data/doc-api/classes/Erubis/PI/Ephp.html +6 -6
- data/doc-api/classes/Erubis/PI/Eruby.html +7 -7
- data/doc-api/classes/Erubis/PI/Escheme.html +6 -6
- data/doc-api/classes/Erubis/PI/TinyEruby.html +24 -24
- data/doc-api/classes/Erubis/PercentLineEnhancer.html +8 -8
- data/doc-api/classes/Erubis/PerlGenerator.html +54 -54
- data/doc-api/classes/Erubis/PhpGenerator.html +54 -54
- data/doc-api/classes/Erubis/PrintEnabledEnhancer.html +20 -20
- data/doc-api/classes/Erubis/PrintOutEnhancer.html +30 -30
- data/doc-api/classes/Erubis/RubyEvaluator.html +12 -12
- data/doc-api/classes/Erubis/RubyGenerator.html +48 -48
- data/doc-api/classes/Erubis/SchemeGenerator.html +60 -60
- data/doc-api/classes/Erubis/SimplifyEnhancer.html +8 -8
- data/doc-api/classes/Erubis/StdoutEnhancer.html +12 -12
- data/doc-api/classes/Erubis/StringBufferEnhancer.html +12 -12
- data/doc-api/classes/Erubis/TinyEruby.html +24 -24
- data/doc-api/classes/Erubis/XmlHelper.html +14 -14
- data/doc-api/created.rid +1 -1
- data/doc-api/files/README_txt.html +4 -4
- data/doc-api/files/erubis/context_rb.html +2 -2
- data/doc-api/files/erubis/converter_rb.html +2 -2
- data/doc-api/files/erubis/engine/ec_rb.html +2 -2
- data/doc-api/files/erubis/engine/ejava_rb.html +2 -2
- data/doc-api/files/erubis/engine/ejavascript_rb.html +2 -2
- data/doc-api/files/erubis/engine/enhanced_rb.html +2 -2
- data/doc-api/files/erubis/engine/eperl_rb.html +2 -2
- data/doc-api/files/erubis/engine/ephp_rb.html +2 -2
- data/doc-api/files/erubis/engine/eruby_rb.html +2 -2
- data/doc-api/files/erubis/engine/escheme_rb.html +2 -2
- data/doc-api/files/erubis/engine/optimized_rb.html +2 -2
- data/doc-api/files/erubis/engine_rb.html +2 -2
- data/doc-api/files/erubis/enhancer_rb.html +2 -2
- data/doc-api/files/erubis/error_rb.html +2 -2
- data/doc-api/files/erubis/evaluator_rb.html +2 -2
- data/doc-api/files/erubis/generator_rb.html +2 -2
- data/doc-api/files/erubis/helper_rb.html +2 -2
- data/doc-api/files/erubis/helpers/rails_helper_rb.html +2 -2
- data/doc-api/files/erubis/local-setting_rb.html +2 -2
- data/doc-api/files/erubis/main_rb.html +2 -2
- data/doc-api/files/erubis/tiny_rb.html +2 -2
- data/doc-api/files/erubis_rb.html +1 -1
- data/doc-api/fr_class_index.html +8 -1
- data/doc-api/fr_method_index.html +166 -158
- data/doc/users-guide.html +623 -215
- data/lib/erubis.rb +2 -2
- data/lib/erubis/context.rb +2 -2
- data/lib/erubis/converter.rb +2 -2
- data/lib/erubis/engine.rb +3 -3
- data/lib/erubis/engine/ec.rb +2 -2
- data/lib/erubis/engine/ejava.rb +2 -2
- data/lib/erubis/engine/ejavascript.rb +2 -2
- data/lib/erubis/engine/enhanced.rb +17 -2
- data/lib/erubis/engine/eperl.rb +2 -2
- data/lib/erubis/engine/ephp.rb +2 -2
- data/lib/erubis/engine/eruby.rb +10 -2
- data/lib/erubis/engine/escheme.rb +2 -2
- data/lib/erubis/engine/optimized.rb +2 -2
- data/lib/erubis/enhancer.rb +134 -25
- data/lib/erubis/error.rb +2 -2
- data/lib/erubis/evaluator.rb +2 -2
- data/lib/erubis/generator.rb +2 -2
- data/lib/erubis/helper.rb +2 -2
- data/lib/erubis/helpers/rails_helper.rb +19 -75
- data/lib/erubis/local-setting.rb +2 -2
- data/lib/erubis/main.rb +63 -36
- data/lib/erubis/tiny.rb +2 -2
- data/test/assert-text-equal.rb +2 -2
- data/test/data/users-guide/Example.ejava +55 -0
- data/test/data/users-guide/array_example.result +9 -0
- data/test/data/users-guide/arraybuffer_example.result +9 -0
- data/test/data/users-guide/bipattern-example.rhtml +4 -0
- data/test/data/users-guide/bipattern_example.result +6 -0
- data/test/data/users-guide/context.rb +6 -0
- data/test/data/users-guide/context.yaml +8 -0
- data/test/data/users-guide/escape_example.result +9 -0
- data/test/data/users-guide/example.ec +27 -0
- data/test/data/users-guide/example.ejs +20 -0
- data/test/data/users-guide/example.eperl +18 -0
- data/test/data/users-guide/example.ephp +18 -0
- data/test/data/users-guide/example.eruby +6 -0
- data/test/data/users-guide/example.escheme +28 -0
- data/test/data/users-guide/example1.eruby +6 -0
- data/test/data/users-guide/example1.rb +16 -0
- data/test/data/users-guide/example1.result +16 -0
- data/test/data/users-guide/example10.rb +4 -0
- data/test/data/users-guide/example10.result +17 -0
- data/test/data/users-guide/example10.xhtml +14 -0
- data/test/data/users-guide/example10_x.result +17 -0
- data/test/data/users-guide/example11.php +20 -0
- data/test/data/users-guide/example11.result +23 -0
- data/test/data/users-guide/example11.rhtml +21 -0
- data/test/data/users-guide/example11_C.result +10 -0
- data/test/data/users-guide/example11_N.result +16 -0
- data/test/data/users-guide/example11_U.result +16 -0
- data/test/data/users-guide/example11_php.result +15 -0
- data/test/data/users-guide/example1_x.result +9 -0
- data/test/data/users-guide/example2.eruby +7 -0
- data/test/data/users-guide/example2.rb +10 -0
- data/test/data/users-guide/example2.result +27 -0
- data/test/data/users-guide/example2_trim.result +10 -0
- data/test/data/users-guide/example2_x.result +10 -0
- data/test/data/users-guide/example3.eruby +6 -0
- data/test/data/users-guide/example3.rb +10 -0
- data/test/data/users-guide/example31.result +22 -0
- data/test/data/users-guide/example32.result +4 -0
- data/test/data/users-guide/example3_e.result +8 -0
- data/test/data/users-guide/example4.eruby +3 -0
- data/test/data/users-guide/example4.rb +11 -0
- data/test/data/users-guide/example4.result +10 -0
- data/test/data/users-guide/example4_x.result +5 -0
- data/test/data/users-guide/example5.eruby +6 -0
- data/test/data/users-guide/example5.rb +16 -0
- data/test/data/users-guide/example5.result +7 -0
- data/test/data/users-guide/example6.rb +12 -0
- data/test/data/users-guide/example6.result +7 -0
- data/test/data/users-guide/example7.eruby +8 -0
- data/test/data/users-guide/example71.result +13 -0
- data/test/data/users-guide/example72.result +13 -0
- data/test/data/users-guide/example8.eruby +6 -0
- data/test/data/users-guide/example8_ruby.result +7 -0
- data/test/data/users-guide/example8_yaml.result +7 -0
- data/test/data/users-guide/example9.eruby +3 -0
- data/test/data/users-guide/example9.rb +8 -0
- data/test/data/users-guide/example9.result +9 -0
- data/test/data/users-guide/example91.result +5 -0
- data/test/data/users-guide/example92.result +4 -0
- data/test/data/users-guide/example_c.result +29 -0
- data/test/data/users-guide/example_java.result +56 -0
- data/test/data/users-guide/example_js.result +22 -0
- data/test/data/users-guide/example_perl.result +20 -0
- data/test/data/users-guide/example_php.result +19 -0
- data/test/data/users-guide/example_scheme.result +30 -0
- data/test/data/users-guide/example_scheme_display.result +29 -0
- data/test/data/users-guide/fasteruby.rb +11 -0
- data/test/data/users-guide/fasteruby.result +38 -0
- data/test/data/users-guide/fasteruby.rhtml +15 -0
- data/test/data/users-guide/headerfooter-example.eruby +9 -0
- data/test/data/users-guide/headerfooter-example2.rb +8 -0
- data/test/data/users-guide/headerfooter-example2.rhtml +10 -0
- data/test/data/users-guide/headerfooter_example.result +11 -0
- data/test/data/users-guide/headerfooter_example2.result +13 -0
- data/test/data/users-guide/interpolation_example.result +9 -0
- data/test/data/users-guide/nocode-example.eruby +14 -0
- data/test/data/users-guide/nocode-php.result +20 -0
- data/test/data/users-guide/nocode_example.result +15 -0
- data/test/data/users-guide/normal-eruby-test.eruby +9 -0
- data/test/data/users-guide/normal_eruby_test.result +11 -0
- data/test/data/users-guide/notext-example.eruby +14 -0
- data/test/data/users-guide/notext-example.php +19 -0
- data/test/data/users-guide/notext-php.result +20 -0
- data/test/data/users-guide/notext_example.result +16 -0
- data/test/data/users-guide/percentline-example.rhtml +4 -0
- data/test/data/users-guide/percentline_example.result +7 -0
- data/test/data/users-guide/printenable_example.result +4 -0
- data/test/data/users-guide/printenabled-example.eruby +3 -0
- data/test/data/users-guide/printenabled-example.rb +8 -0
- data/test/data/users-guide/printstatement_example.result +8 -0
- data/test/data/users-guide/simplify_example.result +9 -0
- data/test/data/users-guide/stdout_exmple.result +9 -0
- data/test/data/users-guide/stringbuffer_example.result +9 -0
- data/test/test-engines.rb +2 -2
- data/test/test-enhancers.rb +569 -0
- data/test/test-erubis.rb +3 -380
- data/test/test-main.rb +39 -15
- data/test/test-users-guide.rb +56 -0
- data/test/test.rb +4 -3
- data/test/testutil.rb +2 -2
- metadata +166 -57
- data/benchmark/erubybench-lib.rb +0 -189
- data/benchmark/erubybench.rb +0 -600
- data/bin/notext +0 -154
- data/test/test-notext.rb +0 -27
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
</tr>
|
|
57
57
|
<tr class="top-aligned-row">
|
|
58
58
|
<td><strong>Last Update:</strong></td>
|
|
59
|
-
<td>
|
|
59
|
+
<td>Wed May 23 06:41:27 +0900 2007</td>
|
|
60
60
|
</tr>
|
|
61
61
|
</table>
|
|
62
62
|
</div>
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
|
|
71
71
|
<div id="description">
|
|
72
72
|
<p>
|
|
73
|
-
$Rev:
|
|
73
|
+
$Rev: 78 $ $Release: 2.3.0 $ copyright(c) 2006-2007 kuwata-lab all rights reserved.
|
|
74
74
|
</p>
|
|
75
75
|
|
|
76
76
|
</div>
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
</tr>
|
|
57
57
|
<tr class="top-aligned-row">
|
|
58
58
|
<td><strong>Last Update:</strong></td>
|
|
59
|
-
<td>Fri
|
|
59
|
+
<td>Fri May 18 16:17:19 +0900 2007</td>
|
|
60
60
|
</tr>
|
|
61
61
|
</table>
|
|
62
62
|
</div>
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
|
|
71
71
|
<div id="description">
|
|
72
72
|
<p>
|
|
73
|
-
$Rev:
|
|
73
|
+
$Rev: 77 $ $Release: 2.3.0 $ copyright(c) 2006-2007 kuwata-lab all rights reserved.
|
|
74
74
|
</p>
|
|
75
75
|
|
|
76
76
|
</div>
|
data/doc-api/fr_class_index.html
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
<div id="index">
|
|
21
21
|
<h1 class="section-bar">Classes</h1>
|
|
22
22
|
<div id="index-entries">
|
|
23
|
-
<a href="classes/ERB.html">ERB</a><br />
|
|
23
|
+
<a href="classes/ActionView/Base/ERB.html">ActionView::Base::ERB</a><br />
|
|
24
24
|
<a href="classes/Erubis.html">Erubis</a><br />
|
|
25
25
|
<a href="classes/Erubis/ArrayBufferEnhancer.html">Erubis::ArrayBufferEnhancer</a><br />
|
|
26
26
|
<a href="classes/Erubis/ArrayBufferEruby.html">Erubis::ArrayBufferEruby</a><br />
|
|
@@ -35,12 +35,16 @@
|
|
|
35
35
|
<a href="classes/Erubis/CommandOptionError.html">Erubis::CommandOptionError</a><br />
|
|
36
36
|
<a href="classes/Erubis/Context.html">Erubis::Context</a><br />
|
|
37
37
|
<a href="classes/Erubis/Converter.html">Erubis::Converter</a><br />
|
|
38
|
+
<a href="classes/Erubis/DeleteIndentEnhancer.html">Erubis::DeleteIndentEnhancer</a><br />
|
|
39
|
+
<a href="classes/Erubis/DeleteIndentEruby.html">Erubis::DeleteIndentEruby</a><br />
|
|
38
40
|
<a href="classes/Erubis/Ec.html">Erubis::Ec</a><br />
|
|
39
41
|
<a href="classes/Erubis/Ejava.html">Erubis::Ejava</a><br />
|
|
40
42
|
<a href="classes/Erubis/Ejavascript.html">Erubis::Ejavascript</a><br />
|
|
41
43
|
<a href="classes/Erubis/Engine.html">Erubis::Engine</a><br />
|
|
42
44
|
<a href="classes/Erubis/Eperl.html">Erubis::Eperl</a><br />
|
|
43
45
|
<a href="classes/Erubis/Ephp.html">Erubis::Ephp</a><br />
|
|
46
|
+
<a href="classes/Erubis/ErboutEnhancer.html">Erubis::ErboutEnhancer</a><br />
|
|
47
|
+
<a href="classes/Erubis/ErboutEruby.html">Erubis::ErboutEruby</a><br />
|
|
44
48
|
<a href="classes/Erubis/ErubisError.html">Erubis::ErubisError</a><br />
|
|
45
49
|
<a href="classes/Erubis/Eruby.html">Erubis::Eruby</a><br />
|
|
46
50
|
<a href="classes/Erubis/EscapeEnhancer.html">Erubis::EscapeEnhancer</a><br />
|
|
@@ -53,11 +57,14 @@
|
|
|
53
57
|
<a href="classes/Erubis/EscapedEscheme.html">Erubis::EscapedEscheme</a><br />
|
|
54
58
|
<a href="classes/Erubis/Escheme.html">Erubis::Escheme</a><br />
|
|
55
59
|
<a href="classes/Erubis/Evaluator.html">Erubis::Evaluator</a><br />
|
|
60
|
+
<a href="classes/Erubis/FastEruby.html">Erubis::FastEruby</a><br />
|
|
56
61
|
<a href="classes/Erubis/Generator.html">Erubis::Generator</a><br />
|
|
57
62
|
<a href="classes/Erubis/HeaderFooterEnhancer.html">Erubis::HeaderFooterEnhancer</a><br />
|
|
58
63
|
<a href="classes/Erubis/HeaderFooterEruby.html">Erubis::HeaderFooterEruby</a><br />
|
|
59
64
|
<a href="classes/Erubis/Helpers.html">Erubis::Helpers</a><br />
|
|
60
65
|
<a href="classes/Erubis/Helpers/RailsHelper.html">Erubis::Helpers::RailsHelper</a><br />
|
|
66
|
+
<a href="classes/Erubis/InterpolationEnhancer.html">Erubis::InterpolationEnhancer</a><br />
|
|
67
|
+
<a href="classes/Erubis/InterpolationEruby.html">Erubis::InterpolationEruby</a><br />
|
|
61
68
|
<a href="classes/Erubis/JavaGenerator.html">Erubis::JavaGenerator</a><br />
|
|
62
69
|
<a href="classes/Erubis/JavascriptGenerator.html">Erubis::JavascriptGenerator</a><br />
|
|
63
70
|
<a href="classes/Erubis/Main.html">Erubis::Main</a><br />
|
|
@@ -20,179 +20,187 @@
|
|
|
20
20
|
<div id="index">
|
|
21
21
|
<h1 class="section-bar">Methods</h1>
|
|
22
22
|
<div id="index-entries">
|
|
23
|
-
<a href="classes/Erubis/Context.html#
|
|
24
|
-
<a href="classes/Erubis/Context.html#
|
|
25
|
-
<a href="classes/Erubis/
|
|
23
|
+
<a href="classes/Erubis/Context.html#M000175">[] (Erubis::Context)</a><br />
|
|
24
|
+
<a href="classes/Erubis/Context.html#M000176">[]= (Erubis::Context)</a><br />
|
|
25
|
+
<a href="classes/Erubis/InterpolationEnhancer.html#M000020">_add_text_to_str (Erubis::InterpolationEnhancer)</a><br />
|
|
26
26
|
<a href="classes/Erubis/NoCodeEnhancer.html#M000004">add_expr (Erubis::NoCodeEnhancer)</a><br />
|
|
27
|
-
<a href="classes/Erubis/Basic/Converter.html#
|
|
28
|
-
<a href="classes/Erubis/
|
|
29
|
-
<a href="classes/Erubis/
|
|
30
|
-
<a href="classes/Erubis/
|
|
31
|
-
<a href="classes/Erubis/
|
|
32
|
-
<a href="classes/Erubis/
|
|
33
|
-
<a href="classes/Erubis/
|
|
34
|
-
<a href="classes/Erubis/OptimizedGenerator.html#
|
|
35
|
-
<a href="classes/Erubis/
|
|
27
|
+
<a href="classes/Erubis/Basic/Converter.html#M000059">add_expr (Erubis::Basic::Converter)</a><br />
|
|
28
|
+
<a href="classes/Erubis/EscapeEnhancer.html#M000094">add_expr (Erubis::EscapeEnhancer)</a><br />
|
|
29
|
+
<a href="classes/Erubis/OptimizedXmlEruby.html#M000181">add_expr_debug (Erubis::OptimizedXmlEruby)</a><br />
|
|
30
|
+
<a href="classes/Erubis/SchemeGenerator.html#M000032">add_expr_debug (Erubis::SchemeGenerator)</a><br />
|
|
31
|
+
<a href="classes/Erubis/RubyGenerator.html#M000041">add_expr_debug (Erubis::RubyGenerator)</a><br />
|
|
32
|
+
<a href="classes/Erubis/JavascriptGenerator.html#M000139">add_expr_debug (Erubis::JavascriptGenerator)</a><br />
|
|
33
|
+
<a href="classes/Erubis/CGenerator.html#M000124">add_expr_debug (Erubis::CGenerator)</a><br />
|
|
34
|
+
<a href="classes/Erubis/OptimizedGenerator.html#M000105">add_expr_debug (Erubis::OptimizedGenerator)</a><br />
|
|
35
|
+
<a href="classes/Erubis/JavaGenerator.html#M000148">add_expr_debug (Erubis::JavaGenerator)</a><br />
|
|
36
|
+
<a href="classes/Erubis/PerlGenerator.html#M000071">add_expr_debug (Erubis::PerlGenerator)</a><br />
|
|
36
37
|
<a href="classes/Erubis/Generator.html#M000016">add_expr_debug (Erubis::Generator)</a><br />
|
|
37
|
-
<a href="classes/Erubis/
|
|
38
|
+
<a href="classes/Erubis/PhpGenerator.html#M000113">add_expr_debug (Erubis::PhpGenerator)</a><br />
|
|
39
|
+
<a href="classes/Erubis/RubyGenerator.html#M000040">add_expr_escaped (Erubis::RubyGenerator)</a><br />
|
|
40
|
+
<a href="classes/Erubis/PhpGenerator.html#M000112">add_expr_escaped (Erubis::PhpGenerator)</a><br />
|
|
38
41
|
<a href="classes/Erubis/Generator.html#M000015">add_expr_escaped (Erubis::Generator)</a><br />
|
|
39
|
-
<a href="classes/Erubis/
|
|
40
|
-
<a href="classes/Erubis/
|
|
41
|
-
<a href="classes/Erubis/
|
|
42
|
-
<a href="classes/Erubis/
|
|
43
|
-
<a href="classes/Erubis/
|
|
44
|
-
<a href="classes/Erubis/
|
|
45
|
-
<a href="classes/Erubis/
|
|
46
|
-
<a href="classes/Erubis/
|
|
47
|
-
<a href="classes/Erubis/
|
|
48
|
-
<a href="classes/Erubis/
|
|
49
|
-
<a href="classes/Erubis/
|
|
50
|
-
<a href="classes/Erubis/CGenerator.html#
|
|
51
|
-
<a href="classes/Erubis/
|
|
52
|
-
<a href="classes/Erubis/
|
|
53
|
-
<a href="classes/Erubis/
|
|
42
|
+
<a href="classes/Erubis/PerlGenerator.html#M000070">add_expr_escaped (Erubis::PerlGenerator)</a><br />
|
|
43
|
+
<a href="classes/Erubis/InterpolationEnhancer.html#M000021">add_expr_escaped (Erubis::InterpolationEnhancer)</a><br />
|
|
44
|
+
<a href="classes/Erubis/JavascriptGenerator.html#M000138">add_expr_escaped (Erubis::JavascriptGenerator)</a><br />
|
|
45
|
+
<a href="classes/Erubis/PrintOutEnhancer.html#M000092">add_expr_escaped (Erubis::PrintOutEnhancer)</a><br />
|
|
46
|
+
<a href="classes/Erubis/JavaGenerator.html#M000147">add_expr_escaped (Erubis::JavaGenerator)</a><br />
|
|
47
|
+
<a href="classes/Erubis/SchemeGenerator.html#M000031">add_expr_escaped (Erubis::SchemeGenerator)</a><br />
|
|
48
|
+
<a href="classes/Erubis/OptimizedGenerator.html#M000104">add_expr_escaped (Erubis::OptimizedGenerator)</a><br />
|
|
49
|
+
<a href="classes/Erubis/CGenerator.html#M000123">add_expr_escaped (Erubis::CGenerator)</a><br />
|
|
50
|
+
<a href="classes/Erubis/JavaGenerator.html#M000146">add_expr_literal (Erubis::JavaGenerator)</a><br />
|
|
51
|
+
<a href="classes/Erubis/OptimizedGenerator.html#M000103">add_expr_literal (Erubis::OptimizedGenerator)</a><br />
|
|
52
|
+
<a href="classes/Erubis/SchemeGenerator.html#M000030">add_expr_literal (Erubis::SchemeGenerator)</a><br />
|
|
53
|
+
<a href="classes/Erubis/CGenerator.html#M000122">add_expr_literal (Erubis::CGenerator)</a><br />
|
|
54
|
+
<a href="classes/Erubis/RubyGenerator.html#M000039">add_expr_literal (Erubis::RubyGenerator)</a><br />
|
|
55
|
+
<a href="classes/Erubis/PrintOutEnhancer.html#M000091">add_expr_literal (Erubis::PrintOutEnhancer)</a><br />
|
|
56
|
+
<a href="classes/Erubis/InterpolationEnhancer.html#M000022">add_expr_literal (Erubis::InterpolationEnhancer)</a><br />
|
|
57
|
+
<a href="classes/Erubis/JavascriptGenerator.html#M000137">add_expr_literal (Erubis::JavascriptGenerator)</a><br />
|
|
54
58
|
<a href="classes/Erubis/Generator.html#M000014">add_expr_literal (Erubis::Generator)</a><br />
|
|
55
|
-
<a href="classes/Erubis/
|
|
56
|
-
<a href="classes/Erubis/
|
|
57
|
-
<a href="classes/Erubis/
|
|
58
|
-
<a href="classes/Erubis/
|
|
59
|
-
<a href="classes/Erubis/
|
|
60
|
-
<a href="classes/Erubis/
|
|
61
|
-
<a href="classes/Erubis/
|
|
62
|
-
<a href="classes/Erubis/
|
|
63
|
-
<a href="classes/Erubis/
|
|
64
|
-
<a href="classes/Erubis/PerlGenerator.html#M000068">add_postamble (Erubis::PerlGenerator)</a><br />
|
|
65
|
-
<a href="classes/Erubis/NoCodeEnhancer.html#M000002">add_postamble (Erubis::NoCodeEnhancer)</a><br />
|
|
66
|
-
<a href="classes/Erubis/StdoutEnhancer.html#M000059">add_postamble (Erubis::StdoutEnhancer)</a><br />
|
|
59
|
+
<a href="classes/Erubis/PhpGenerator.html#M000111">add_expr_literal (Erubis::PhpGenerator)</a><br />
|
|
60
|
+
<a href="classes/Erubis/PerlGenerator.html#M000069">add_expr_literal (Erubis::PerlGenerator)</a><br />
|
|
61
|
+
<a href="classes/Erubis/JavascriptGenerator.html#M000134">add_indent (Erubis::JavascriptGenerator)</a><br />
|
|
62
|
+
<a href="classes/Erubis/PrintOutEnhancer.html#M000093">add_postamble (Erubis::PrintOutEnhancer)</a><br />
|
|
63
|
+
<a href="classes/Erubis/SchemeGenerator.html#M000033">add_postamble (Erubis::SchemeGenerator)</a><br />
|
|
64
|
+
<a href="classes/Erubis/PerlGenerator.html#M000073">add_postamble (Erubis::PerlGenerator)</a><br />
|
|
65
|
+
<a href="classes/Erubis/CGenerator.html#M000125">add_postamble (Erubis::CGenerator)</a><br />
|
|
66
|
+
<a href="classes/Erubis/JavascriptGenerator.html#M000140">add_postamble (Erubis::JavascriptGenerator)</a><br />
|
|
67
|
+
<a href="classes/Erubis/StdoutEnhancer.html#M000064">add_postamble (Erubis::StdoutEnhancer)</a><br />
|
|
67
68
|
<a href="classes/Erubis/ArrayBufferEnhancer.html#M000007">add_postamble (Erubis::ArrayBufferEnhancer)</a><br />
|
|
68
|
-
<a href="classes/Erubis/
|
|
69
|
-
<a href="classes/Erubis/
|
|
70
|
-
<a href="classes/Erubis/
|
|
71
|
-
<a href="classes/Erubis/StringBufferEnhancer.html#
|
|
72
|
-
<a href="classes/Erubis/
|
|
69
|
+
<a href="classes/Erubis/NoCodeEnhancer.html#M000002">add_postamble (Erubis::NoCodeEnhancer)</a><br />
|
|
70
|
+
<a href="classes/Erubis/PhpGenerator.html#M000115">add_postamble (Erubis::PhpGenerator)</a><br />
|
|
71
|
+
<a href="classes/Erubis/JavaGenerator.html#M000149">add_postamble (Erubis::JavaGenerator)</a><br />
|
|
72
|
+
<a href="classes/Erubis/StringBufferEnhancer.html#M000160">add_postamble (Erubis::StringBufferEnhancer)</a><br />
|
|
73
|
+
<a href="classes/Erubis/Generator.html#M000017">add_postamble (Erubis::Generator)</a><br />
|
|
74
|
+
<a href="classes/Erubis/ErboutEnhancer.html#M000153">add_postamble (Erubis::ErboutEnhancer)</a><br />
|
|
75
|
+
<a href="classes/Erubis/OptimizedGenerator.html#M000106">add_postamble (Erubis::OptimizedGenerator)</a><br />
|
|
76
|
+
<a href="classes/Erubis/ArrayEnhancer.html#M000155">add_postamble (Erubis::ArrayEnhancer)</a><br />
|
|
77
|
+
<a href="classes/Erubis/ArrayEnhancer.html#M000154">add_preamble (Erubis::ArrayEnhancer)</a><br />
|
|
73
78
|
<a href="classes/Erubis/Generator.html#M000011">add_preamble (Erubis::Generator)</a><br />
|
|
74
|
-
<a href="classes/Erubis/OptimizedGenerator.html#
|
|
75
|
-
<a href="classes/Erubis/StringBufferEnhancer.html#
|
|
76
|
-
<a href="classes/Erubis/
|
|
77
|
-
<a href="classes/Erubis/
|
|
78
|
-
<a href="classes/Erubis/SchemeGenerator.html#
|
|
79
|
+
<a href="classes/Erubis/OptimizedGenerator.html#M000100">add_preamble (Erubis::OptimizedGenerator)</a><br />
|
|
80
|
+
<a href="classes/Erubis/StringBufferEnhancer.html#M000159">add_preamble (Erubis::StringBufferEnhancer)</a><br />
|
|
81
|
+
<a href="classes/Erubis/ErboutEnhancer.html#M000152">add_preamble (Erubis::ErboutEnhancer)</a><br />
|
|
82
|
+
<a href="classes/Erubis/CGenerator.html#M000117">add_preamble (Erubis::CGenerator)</a><br />
|
|
83
|
+
<a href="classes/Erubis/SchemeGenerator.html#M000025">add_preamble (Erubis::SchemeGenerator)</a><br />
|
|
79
84
|
<a href="classes/Erubis/ArrayBufferEnhancer.html#M000006">add_preamble (Erubis::ArrayBufferEnhancer)</a><br />
|
|
80
|
-
<a href="classes/Erubis/StdoutEnhancer.html#
|
|
81
|
-
<a href="classes/Erubis/JavaGenerator.html#
|
|
82
|
-
<a href="classes/Erubis/PrintOutEnhancer.html#
|
|
83
|
-
<a href="classes/Erubis/PerlGenerator.html#
|
|
84
|
-
<a href="classes/Erubis/
|
|
85
|
-
<a href="classes/Erubis/
|
|
86
|
-
<a href="classes/Erubis/
|
|
85
|
+
<a href="classes/Erubis/StdoutEnhancer.html#M000063">add_preamble (Erubis::StdoutEnhancer)</a><br />
|
|
86
|
+
<a href="classes/Erubis/JavaGenerator.html#M000142">add_preamble (Erubis::JavaGenerator)</a><br />
|
|
87
|
+
<a href="classes/Erubis/PrintOutEnhancer.html#M000089">add_preamble (Erubis::PrintOutEnhancer)</a><br />
|
|
88
|
+
<a href="classes/Erubis/PerlGenerator.html#M000066">add_preamble (Erubis::PerlGenerator)</a><br />
|
|
89
|
+
<a href="classes/Erubis/PrintEnabledEnhancer.html#M000128">add_preamble (Erubis::PrintEnabledEnhancer)</a><br />
|
|
90
|
+
<a href="classes/Erubis/JavascriptGenerator.html#M000132">add_preamble (Erubis::JavascriptGenerator)</a><br />
|
|
91
|
+
<a href="classes/Erubis/PhpGenerator.html#M000108">add_preamble (Erubis::PhpGenerator)</a><br />
|
|
87
92
|
<a href="classes/Erubis/NoCodeEnhancer.html#M000001">add_preamble (Erubis::NoCodeEnhancer)</a><br />
|
|
88
|
-
<a href="classes/Erubis/
|
|
89
|
-
<a href="classes/Erubis/PerlGenerator.html#
|
|
90
|
-
<a href="classes/Erubis/
|
|
93
|
+
<a href="classes/Erubis/JavascriptGenerator.html#M000136">add_stmt (Erubis::JavascriptGenerator)</a><br />
|
|
94
|
+
<a href="classes/Erubis/PerlGenerator.html#M000072">add_stmt (Erubis::PerlGenerator)</a><br />
|
|
95
|
+
<a href="classes/Erubis/OptimizedGenerator.html#M000102">add_stmt (Erubis::OptimizedGenerator)</a><br />
|
|
91
96
|
<a href="classes/Erubis/NoCodeEnhancer.html#M000005">add_stmt (Erubis::NoCodeEnhancer)</a><br />
|
|
92
|
-
<a href="classes/Erubis/
|
|
93
|
-
<a href="classes/Erubis/RubyGenerator.html#M000033">add_stmt (Erubis::RubyGenerator)</a><br />
|
|
94
|
-
<a href="classes/Erubis/SchemeGenerator.html#M000024">add_stmt (Erubis::SchemeGenerator)</a><br />
|
|
97
|
+
<a href="classes/Erubis/PhpGenerator.html#M000114">add_stmt (Erubis::PhpGenerator)</a><br />
|
|
95
98
|
<a href="classes/Erubis/Generator.html#M000013">add_stmt (Erubis::Generator)</a><br />
|
|
96
|
-
<a href="classes/Erubis/
|
|
97
|
-
<a href="classes/Erubis/
|
|
98
|
-
<a href="classes/Erubis/
|
|
99
|
-
<a href="classes/Erubis/
|
|
100
|
-
<a href="classes/Erubis/
|
|
101
|
-
<a href="classes/Erubis/
|
|
102
|
-
<a href="classes/Erubis/
|
|
103
|
-
<a href="classes/Erubis/
|
|
104
|
-
<a href="classes/Erubis/
|
|
105
|
-
<a href="classes/Erubis/
|
|
99
|
+
<a href="classes/Erubis/CGenerator.html#M000121">add_stmt (Erubis::CGenerator)</a><br />
|
|
100
|
+
<a href="classes/Erubis/RubyGenerator.html#M000038">add_stmt (Erubis::RubyGenerator)</a><br />
|
|
101
|
+
<a href="classes/Erubis/JavaGenerator.html#M000145">add_stmt (Erubis::JavaGenerator)</a><br />
|
|
102
|
+
<a href="classes/Erubis/SchemeGenerator.html#M000029">add_stmt (Erubis::SchemeGenerator)</a><br />
|
|
103
|
+
<a href="classes/Erubis/JavaGenerator.html#M000144">add_text (Erubis::JavaGenerator)</a><br />
|
|
104
|
+
<a href="classes/Erubis/SchemeGenerator.html#M000028">add_text (Erubis::SchemeGenerator)</a><br />
|
|
105
|
+
<a href="classes/Erubis/InterpolationEnhancer.html#M000019">add_text (Erubis::InterpolationEnhancer)</a><br />
|
|
106
|
+
<a href="classes/Erubis/JavascriptGenerator.html#M000135">add_text (Erubis::JavascriptGenerator)</a><br />
|
|
107
|
+
<a href="classes/Erubis/RubyGenerator.html#M000037">add_text (Erubis::RubyGenerator)</a><br />
|
|
108
|
+
<a href="classes/Erubis/PercentLineEnhancer.html#M000150">add_text (Erubis::PercentLineEnhancer)</a><br />
|
|
109
|
+
<a href="classes/Erubis/HeaderFooterEnhancer.html#M000087">add_text (Erubis::HeaderFooterEnhancer)</a><br />
|
|
110
|
+
<a href="classes/Erubis/BiPatternEnhancer.html#M000127">add_text (Erubis::BiPatternEnhancer)</a><br />
|
|
111
|
+
<a href="classes/Erubis/OptimizedGenerator.html#M000101">add_text (Erubis::OptimizedGenerator)</a><br />
|
|
112
|
+
<a href="classes/Erubis/PrintOutEnhancer.html#M000090">add_text (Erubis::PrintOutEnhancer)</a><br />
|
|
113
|
+
<a href="classes/Erubis/NoTextEnhancer.html#M000151">add_text (Erubis::NoTextEnhancer)</a><br />
|
|
114
|
+
<a href="classes/Erubis/CGenerator.html#M000120">add_text (Erubis::CGenerator)</a><br />
|
|
106
115
|
<a href="classes/Erubis/Generator.html#M000012">add_text (Erubis::Generator)</a><br />
|
|
107
|
-
<a href="classes/Erubis/
|
|
108
|
-
<a href="classes/Erubis/CGenerator.html#M000115">add_text (Erubis::CGenerator)</a><br />
|
|
116
|
+
<a href="classes/Erubis/PhpGenerator.html#M000110">add_text (Erubis::PhpGenerator)</a><br />
|
|
109
117
|
<a href="classes/Erubis/NoCodeEnhancer.html#M000003">add_text (Erubis::NoCodeEnhancer)</a><br />
|
|
110
|
-
<a href="classes/Erubis/
|
|
111
|
-
<a href="classes/Erubis/
|
|
112
|
-
<a href="classes/Erubis/
|
|
113
|
-
<a href="classes/Erubis/PI/Converter.html#
|
|
114
|
-
<a href="classes/Erubis/
|
|
115
|
-
<a href="classes/Erubis/PI/TinyEruby.html#
|
|
116
|
-
<a href="classes/Erubis/
|
|
117
|
-
<a href="classes/Erubis/
|
|
118
|
-
<a href="classes/Erubis/
|
|
119
|
-
<a href="classes/Erubis/
|
|
120
|
-
<a href="classes/Erubis/Converter.html#
|
|
121
|
-
<a href="classes/Erubis/
|
|
122
|
-
<a href="classes/Erubis/PI/Converter.html#
|
|
123
|
-
<a href="classes/Erubis/Converter.html#
|
|
124
|
-
<a href="classes/Erubis/Context.html#
|
|
125
|
-
<a href="classes/Erubis/Helpers/RailsHelper.html#
|
|
126
|
-
<a href="classes/Erubis/Helpers/RailsHelper.html#
|
|
127
|
-
<a href="classes/Erubis/
|
|
128
|
-
<a href="classes/Erubis/
|
|
129
|
-
<a href="classes/Erubis/
|
|
130
|
-
<a href="classes/Erubis/SchemeGenerator.html#M000021">escape_text (Erubis::SchemeGenerator)</a><br />
|
|
131
|
-
<a href="classes/Erubis/RubyGenerator.html#M000030">escape_text (Erubis::RubyGenerator)</a><br />
|
|
132
|
-
<a href="classes/Erubis/JavascriptGenerator.html#M000128">escape_text (Erubis::JavascriptGenerator)</a><br />
|
|
118
|
+
<a href="classes/Erubis/PerlGenerator.html#M000068">add_text (Erubis::PerlGenerator)</a><br />
|
|
119
|
+
<a href="classes/Erubis/HeaderFooterEnhancer.html#M000088">convert (Erubis::HeaderFooterEnhancer)</a><br />
|
|
120
|
+
<a href="classes/Erubis/TinyEruby.html#M000162">convert (Erubis::TinyEruby)</a><br />
|
|
121
|
+
<a href="classes/Erubis/PI/Converter.html#M000043">convert (Erubis::PI::Converter)</a><br />
|
|
122
|
+
<a href="classes/Erubis/Converter.html#M000075">convert (Erubis::Converter)</a><br />
|
|
123
|
+
<a href="classes/Erubis/PI/TinyEruby.html#M000049">convert (Erubis::PI::TinyEruby)</a><br />
|
|
124
|
+
<a href="classes/Erubis/SimplifyEnhancer.html#M000023">convert (Erubis::SimplifyEnhancer)</a><br />
|
|
125
|
+
<a href="classes/Erubis/Engine.html#M000166">convert! (Erubis::Engine)</a><br />
|
|
126
|
+
<a href="classes/Erubis/Converter.html#M000077">convert_input (Erubis::Converter)</a><br />
|
|
127
|
+
<a href="classes/Erubis/DeleteIndentEnhancer.html#M000156">convert_input (Erubis::DeleteIndentEnhancer)</a><br />
|
|
128
|
+
<a href="classes/Erubis/Basic/Converter.html#M000058">convert_input (Erubis::Basic::Converter)</a><br />
|
|
129
|
+
<a href="classes/Erubis/InterpolationEnhancer.html#M000018">convert_input (Erubis::InterpolationEnhancer)</a><br />
|
|
130
|
+
<a href="classes/Erubis/PI/Converter.html#M000044">convert_input (Erubis::PI::Converter)</a><br />
|
|
131
|
+
<a href="classes/Erubis/Converter.html#M000076">detect_spaces_at_bol (Erubis::Converter)</a><br />
|
|
132
|
+
<a href="classes/Erubis/Context.html#M000178">each (Erubis::Context)</a><br />
|
|
133
|
+
<a href="classes/Erubis/Helpers/RailsHelper.html#M000078">engine_class (Erubis::Helpers::RailsHelper)</a><br />
|
|
134
|
+
<a href="classes/Erubis/Helpers/RailsHelper.html#M000079">engine_class= (Erubis::Helpers::RailsHelper)</a><br />
|
|
135
|
+
<a href="classes/Erubis/JavascriptGenerator.html#M000133">escape_text (Erubis::JavascriptGenerator)</a><br />
|
|
136
|
+
<a href="classes/Erubis/PerlGenerator.html#M000067">escape_text (Erubis::PerlGenerator)</a><br />
|
|
137
|
+
<a href="classes/Erubis/OptimizedGenerator.html#M000096">escape_text (Erubis::OptimizedGenerator)</a><br />
|
|
133
138
|
<a href="classes/Erubis/Generator.html#M000009">escape_text (Erubis::Generator)</a><br />
|
|
134
|
-
<a href="classes/Erubis/
|
|
135
|
-
<a href="classes/Erubis/
|
|
136
|
-
<a href="classes/Erubis/
|
|
137
|
-
<a href="classes/Erubis/
|
|
138
|
-
<a href="classes/Erubis/
|
|
139
|
-
<a href="classes/Erubis/
|
|
139
|
+
<a href="classes/Erubis/RubyGenerator.html#M000035">escape_text (Erubis::RubyGenerator)</a><br />
|
|
140
|
+
<a href="classes/Erubis/CGenerator.html#M000118">escape_text (Erubis::CGenerator)</a><br />
|
|
141
|
+
<a href="classes/Erubis/SchemeGenerator.html#M000026">escape_text (Erubis::SchemeGenerator)</a><br />
|
|
142
|
+
<a href="classes/Erubis/PhpGenerator.html#M000109">escape_text (Erubis::PhpGenerator)</a><br />
|
|
143
|
+
<a href="classes/Erubis/JavaGenerator.html#M000143">escape_text (Erubis::JavaGenerator)</a><br />
|
|
144
|
+
<a href="classes/Erubis/XmlHelper.html#M000084">escape_xml (Erubis::XmlHelper)</a><br />
|
|
145
|
+
<a href="classes/Erubis/CGenerator.html#M000119">escaped_expr (Erubis::CGenerator)</a><br />
|
|
146
|
+
<a href="classes/Erubis/RubyGenerator.html#M000036">escaped_expr (Erubis::RubyGenerator)</a><br />
|
|
147
|
+
<a href="classes/Erubis/SchemeGenerator.html#M000027">escaped_expr (Erubis::SchemeGenerator)</a><br />
|
|
148
|
+
<a href="classes/Erubis/OptimizedGenerator.html#M000097">escaped_expr (Erubis::OptimizedGenerator)</a><br />
|
|
140
149
|
<a href="classes/Erubis/Generator.html#M000010">escaped_expr (Erubis::Generator)</a><br />
|
|
141
|
-
<a href="classes/Erubis/
|
|
142
|
-
<a href="classes/Erubis/RubyEvaluator.html#
|
|
143
|
-
<a href="classes/Erubis/
|
|
144
|
-
<a href="classes/Erubis/
|
|
145
|
-
<a href="classes/Erubis/
|
|
146
|
-
<a href="classes/Erubis/
|
|
147
|
-
<a href="classes/Erubis/
|
|
148
|
-
<a href="classes/Erubis/XmlHelper.html#
|
|
149
|
-
<a href="classes/Erubis/
|
|
150
|
-
<a href="classes/Erubis/PI/
|
|
151
|
-
<a href="classes/Erubis/
|
|
152
|
-
<a href="classes/Erubis/
|
|
153
|
-
<a href="classes/Erubis/
|
|
154
|
-
<a href="classes/Erubis/
|
|
155
|
-
<a href="classes/Erubis/PI/
|
|
156
|
-
<a href="classes/Erubis/
|
|
157
|
-
<a href="classes/Erubis/
|
|
158
|
-
<a href="classes/Erubis/PI/
|
|
159
|
-
<a href="classes/Erubis/PI/
|
|
160
|
-
<a href="classes/Erubis/
|
|
161
|
-
<a href="classes/Erubis/
|
|
162
|
-
<a href="classes/Erubis/
|
|
150
|
+
<a href="classes/Erubis/TinyEruby.html#M000164">evaluate (Erubis::TinyEruby)</a><br />
|
|
151
|
+
<a href="classes/Erubis/RubyEvaluator.html#M000158">evaluate (Erubis::RubyEvaluator)</a><br />
|
|
152
|
+
<a href="classes/Erubis/PrintEnabledEnhancer.html#M000130">evaluate (Erubis::PrintEnabledEnhancer)</a><br />
|
|
153
|
+
<a href="classes/Erubis/PI/TinyEruby.html#M000051">evaluate (Erubis::PI::TinyEruby)</a><br />
|
|
154
|
+
<a href="classes/Erubis/Evaluator.html#M000062">evaluate (Erubis::Evaluator)</a><br />
|
|
155
|
+
<a href="classes/Erubis/Main.html#M000173">execute (Erubis::Main)</a><br />
|
|
156
|
+
<a href="classes/Erubis/XmlHelper.html#M000085">h (Erubis::XmlHelper)</a><br />
|
|
157
|
+
<a href="classes/Erubis/XmlHelper.html#M000086">html_escape (Erubis::XmlHelper)</a><br />
|
|
158
|
+
<a href="classes/Erubis/PI/Ephp.html#M000047">init_converter (Erubis::PI::Ephp)</a><br />
|
|
159
|
+
<a href="classes/Erubis/PI/Ejava.html#M000046">init_converter (Erubis::PI::Ejava)</a><br />
|
|
160
|
+
<a href="classes/Erubis/Basic/Converter.html#M000056">init_converter (Erubis::Basic::Converter)</a><br />
|
|
161
|
+
<a href="classes/Erubis/PI/Escheme.html#M000055">init_converter (Erubis::PI::Escheme)</a><br />
|
|
162
|
+
<a href="classes/Erubis/OptimizedEruby.html#M000170">init_converter (Erubis::OptimizedEruby)</a><br />
|
|
163
|
+
<a href="classes/Erubis/PI/Eruby.html#M000054">init_converter (Erubis::PI::Eruby)</a><br />
|
|
164
|
+
<a href="classes/Erubis/PI/Ec.html#M000053">init_converter (Erubis::PI::Ec)</a><br />
|
|
165
|
+
<a href="classes/Erubis/PI/Ejavascript.html#M000045">init_converter (Erubis::PI::Ejavascript)</a><br />
|
|
166
|
+
<a href="classes/Erubis/Converter.html#M000074">init_converter (Erubis::Converter)</a><br />
|
|
167
|
+
<a href="classes/Erubis/PI/Converter.html#M000042">init_converter (Erubis::PI::Converter)</a><br />
|
|
168
|
+
<a href="classes/Erubis/PI/Eperl.html#M000052">init_converter (Erubis::PI::Eperl)</a><br />
|
|
169
|
+
<a href="classes/Erubis/Evaluator.html#M000060">init_evaluator (Erubis::Evaluator)</a><br />
|
|
170
|
+
<a href="classes/Erubis/PhpGenerator.html#M000107">init_generator (Erubis::PhpGenerator)</a><br />
|
|
171
|
+
<a href="classes/Erubis/SchemeGenerator.html#M000024">init_generator (Erubis::SchemeGenerator)</a><br />
|
|
172
|
+
<a href="classes/Erubis/JavaGenerator.html#M000141">init_generator (Erubis::JavaGenerator)</a><br />
|
|
173
|
+
<a href="classes/Erubis/CGenerator.html#M000116">init_generator (Erubis::CGenerator)</a><br />
|
|
174
|
+
<a href="classes/Erubis/RubyGenerator.html#M000034">init_generator (Erubis::RubyGenerator)</a><br />
|
|
175
|
+
<a href="classes/Erubis/OptimizedGenerator.html#M000095">init_generator (Erubis::OptimizedGenerator)</a><br />
|
|
176
|
+
<a href="classes/Erubis/JavascriptGenerator.html#M000131">init_generator (Erubis::JavascriptGenerator)</a><br />
|
|
177
|
+
<a href="classes/Erubis/PerlGenerator.html#M000065">init_generator (Erubis::PerlGenerator)</a><br />
|
|
163
178
|
<a href="classes/Erubis/Generator.html#M000008">init_generator (Erubis::Generator)</a><br />
|
|
164
|
-
<a href="classes/Erubis/
|
|
165
|
-
<a href="classes/Erubis/
|
|
166
|
-
<a href="classes/Erubis/
|
|
167
|
-
<a href="classes/Erubis/
|
|
168
|
-
<a href="classes/Erubis/
|
|
169
|
-
<a href="classes/Erubis/
|
|
170
|
-
<a href="classes/Erubis/
|
|
171
|
-
<a href="classes/Erubis/
|
|
172
|
-
<a href="classes/Erubis/
|
|
173
|
-
<a href="classes/Erubis/
|
|
174
|
-
<a href="classes/Erubis/
|
|
175
|
-
<a href="classes/Erubis/
|
|
176
|
-
<a href="classes/Erubis/
|
|
177
|
-
<a href="classes/Erubis/
|
|
178
|
-
<a href="classes/Erubis/
|
|
179
|
-
<a href="classes/Erubis/
|
|
180
|
-
<a href="classes/Erubis/
|
|
181
|
-
<a href="classes/Erubis/
|
|
182
|
-
<a href="classes/Erubis/
|
|
183
|
-
<a href="classes/Erubis/
|
|
184
|
-
<a href="classes/Erubis/
|
|
185
|
-
<a href="classes/Erubis/
|
|
186
|
-
<a href="classes/Erubis/
|
|
187
|
-
<a href="classes/Erubis/
|
|
188
|
-
<a href="classes/Erubis/
|
|
189
|
-
<a href="classes/Erubis/Evaluator.html#M000056">result (Erubis::Evaluator)</a><br />
|
|
190
|
-
<a href="classes/Erubis/Helpers/RailsHelper.html#M000077">show_src (Erubis::Helpers::RailsHelper)</a><br />
|
|
191
|
-
<a href="classes/Erubis/Helpers/RailsHelper.html#M000078">show_src= (Erubis::Helpers::RailsHelper)</a><br />
|
|
192
|
-
<a href="classes/Erubis/OptimizedGenerator.html#M000093">switch_to_expr (Erubis::OptimizedGenerator)</a><br />
|
|
193
|
-
<a href="classes/Erubis/OptimizedGenerator.html#M000094">switch_to_stmt (Erubis::OptimizedGenerator)</a><br />
|
|
194
|
-
<a href="classes/Erubis/Context.html#M000171">to_hash (Erubis::Context)</a><br />
|
|
195
|
-
<a href="classes/Erubis/Context.html#M000172">update (Erubis::Context)</a><br />
|
|
179
|
+
<a href="classes/Erubis/Helpers/RailsHelper.html#M000080">init_properties (Erubis::Helpers::RailsHelper)</a><br />
|
|
180
|
+
<a href="classes/Erubis/Helpers/RailsHelper.html#M000081">init_properties= (Erubis::Helpers::RailsHelper)</a><br />
|
|
181
|
+
<a href="classes/Erubis/Context.html#M000177">keys (Erubis::Context)</a><br />
|
|
182
|
+
<a href="classes/Erubis/Engine.html#M000167">load_file (Erubis::Engine)</a><br />
|
|
183
|
+
<a href="classes/Erubis/Main.html#M000171">main (Erubis::Main)</a><br />
|
|
184
|
+
<a href="classes/Erubis/BiPatternEnhancer.html#M000126">new (Erubis::BiPatternEnhancer)</a><br />
|
|
185
|
+
<a href="classes/Erubis/Context.html#M000174">new (Erubis::Context)</a><br />
|
|
186
|
+
<a href="classes/Erubis/TinyEruby.html#M000161">new (Erubis::TinyEruby)</a><br />
|
|
187
|
+
<a href="classes/Erubis/Engine.html#M000165">new (Erubis::Engine)</a><br />
|
|
188
|
+
<a href="classes/Erubis/Main.html#M000172">new (Erubis::Main)</a><br />
|
|
189
|
+
<a href="classes/Erubis/PI/TinyEruby.html#M000048">new (Erubis::PI::TinyEruby)</a><br />
|
|
190
|
+
<a href="classes/Erubis/Basic/Converter.html#M000057">pattern_regexp (Erubis::Basic::Converter)</a><br />
|
|
191
|
+
<a href="classes/Erubis/PrintEnabledEnhancer.html#M000129">print (Erubis::PrintEnabledEnhancer)</a><br />
|
|
192
|
+
<a href="classes/Erubis/Engine.html#M000168">process (Erubis::Engine)</a><br />
|
|
193
|
+
<a href="classes/Erubis/Engine.html#M000169">process_proc (Erubis::Engine)</a><br />
|
|
194
|
+
<a href="classes/Erubis/Evaluator.html#M000061">result (Erubis::Evaluator)</a><br />
|
|
195
|
+
<a href="classes/Erubis/PI/TinyEruby.html#M000050">result (Erubis::PI::TinyEruby)</a><br />
|
|
196
|
+
<a href="classes/Erubis/TinyEruby.html#M000163">result (Erubis::TinyEruby)</a><br />
|
|
197
|
+
<a href="classes/Erubis/RubyEvaluator.html#M000157">result (Erubis::RubyEvaluator)</a><br />
|
|
198
|
+
<a href="classes/Erubis/Helpers/RailsHelper.html#M000082">show_src (Erubis::Helpers::RailsHelper)</a><br />
|
|
199
|
+
<a href="classes/Erubis/Helpers/RailsHelper.html#M000083">show_src= (Erubis::Helpers::RailsHelper)</a><br />
|
|
200
|
+
<a href="classes/Erubis/OptimizedGenerator.html#M000098">switch_to_expr (Erubis::OptimizedGenerator)</a><br />
|
|
201
|
+
<a href="classes/Erubis/OptimizedGenerator.html#M000099">switch_to_stmt (Erubis::OptimizedGenerator)</a><br />
|
|
202
|
+
<a href="classes/Erubis/Context.html#M000179">to_hash (Erubis::Context)</a><br />
|
|
203
|
+
<a href="classes/Erubis/Context.html#M000180">update (Erubis::Context)</a><br />
|
|
196
204
|
</div>
|
|
197
205
|
</div>
|
|
198
206
|
</body>
|
data/doc/users-guide.html
CHANGED
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
|
|
15
15
|
<div align="left"><h1>Erubis Users' Guide</h1></div>
|
|
16
16
|
<div align="left">
|
|
17
|
-
last update: $Date: 2007-
|
|
17
|
+
last update: $Date: 2007-05-23 09:23:38 +0900 (Wed, 23 May 2007) $<br>
|
|
18
18
|
</div>
|
|
19
19
|
|
|
20
|
-
<p>release: 2.
|
|
20
|
+
<p>release: 2.3.0
|
|
21
21
|
</p>
|
|
22
22
|
<a name="preface"></a>
|
|
23
23
|
<h2 class="section1">Preface</h2>
|
|
@@ -25,28 +25,30 @@
|
|
|
25
25
|
It has the following features.
|
|
26
26
|
</p>
|
|
27
27
|
<ul type="disc">
|
|
28
|
-
<li>Very fast
|
|
28
|
+
<li><a href="#topics-benchmark">Very fast</a>, almost three times faster than ERB and about ten percent faster than eruby (implemented in C)
|
|
29
29
|
</li>
|
|
30
|
-
<li>File caching of converted Ruby script support
|
|
30
|
+
<li><a href="#topics-caching">File caching of converted Ruby script support</a>
|
|
31
31
|
</li>
|
|
32
|
-
<li>Auto escaping support
|
|
32
|
+
<li><a href="#tut-escape">Auto escaping support</a>
|
|
33
33
|
</li>
|
|
34
|
-
<li>Auto trimming spaces around '<% %>'
|
|
34
|
+
<li><a href="#tut-trim">Auto trimming spaces around '<% %>'</a>
|
|
35
35
|
</li>
|
|
36
|
-
<li>Embedded pattern changeable (default '<% %>')
|
|
36
|
+
<li><a href="#tut-pattern">Embedded pattern changeable</a> (default '<% %>')
|
|
37
37
|
</li>
|
|
38
|
-
<li>Enable to handle Processing Instructions (PI) as embedded pattern (ex. '<?rb ... ?>')
|
|
38
|
+
<li><a href="#tut-pi">Enable to handle Processing Instructions (PI) as embedded pattern</a> (ex. '<?rb ... ?>')
|
|
39
39
|
</li>
|
|
40
|
-
<li>Multi-language support (Ruby/PHP/C/Java/Scheme/Perl/Javascript)
|
|
40
|
+
<li><a href="#lang">Multi-language support</a> (Ruby/PHP/C/Java/Scheme/Perl/Javascript)
|
|
41
41
|
</li>
|
|
42
|
-
<li>Context object available and easy to combine eRuby template with YAML datafile
|
|
42
|
+
<li><a href="#tut-context">Context object available</a> and <a href="#tut-datafile">easy to combine eRuby template with YAML datafile</a>
|
|
43
43
|
</li>
|
|
44
|
-
<li>Print statement available
|
|
44
|
+
<li><a href="#printenabled-enhancer">Print statement available</a>
|
|
45
45
|
</li>
|
|
46
|
-
<li>Easy to expand and customize in subclass
|
|
46
|
+
<li><a href="#enhancer">Easy to expand and customize in subclass</a>
|
|
47
47
|
</li>
|
|
48
48
|
<li><a href="#topics-rails">Ruby on Rails support</a>
|
|
49
49
|
</li>
|
|
50
|
+
<li><a href="#topcs-modruby">mod_ruby support</a>
|
|
51
|
+
</li>
|
|
50
52
|
</ul>
|
|
51
53
|
<p>Erubis is implemented in pure Ruby. It requires Ruby 1.8 or higher.
|
|
52
54
|
</p>
|
|
@@ -81,6 +83,8 @@ It has the following features.
|
|
|
81
83
|
</li>
|
|
82
84
|
<li><a href="#tut-pi">Processing Instruction (PI) Converter</a>
|
|
83
85
|
</li>
|
|
86
|
+
<li><a href="#tut-notext">Retrieve Ruby Code</a>
|
|
87
|
+
</li>
|
|
84
88
|
</ul>
|
|
85
89
|
</li>
|
|
86
90
|
<li><a href="#enhancer">Enhancer</a>
|
|
@@ -99,6 +103,8 @@ It has the following features.
|
|
|
99
103
|
</li>
|
|
100
104
|
<li><a href="#stringbuffer-enhancer">StringBufferEnhancer</a>
|
|
101
105
|
</li>
|
|
106
|
+
<li><a href="#erbout-enhancer">ErboutEnhancer</a>
|
|
107
|
+
</li>
|
|
102
108
|
<li><a href="#notext-enhancer">NoTextEnhancer</a>
|
|
103
109
|
</li>
|
|
104
110
|
<li><a href="#nocode-enhancer">NoCodeEnhancer</a>
|
|
@@ -111,9 +117,13 @@ It has the following features.
|
|
|
111
117
|
</li>
|
|
112
118
|
<li><a href="#headerfooter-enhancer">HeaderFooterEnhancer</a>
|
|
113
119
|
</li>
|
|
120
|
+
<li><a href="#interpolation-enhancer">InterpolationEnhancer</a>
|
|
121
|
+
</li>
|
|
122
|
+
<li><a href="#deleteindent-enhancer">DeleteIndentEnhancer</a>
|
|
123
|
+
</li>
|
|
114
124
|
</ul>
|
|
115
125
|
</li>
|
|
116
|
-
<li><a href="#lang">Multi-Language</a>
|
|
126
|
+
<li><a href="#lang">Multi-Language Support</a>
|
|
117
127
|
<ul>
|
|
118
128
|
<li><a href="#lang-php">PHP</a>
|
|
119
129
|
</li>
|
|
@@ -131,6 +141,8 @@ It has the following features.
|
|
|
131
141
|
</li>
|
|
132
142
|
<li><a href="#topics">Other Topics</a>
|
|
133
143
|
<ul>
|
|
144
|
+
<li><a href="#topics-fasteruby">Class Erubis::FastEruby</a>
|
|
145
|
+
</li>
|
|
134
146
|
<li><a href="#topics-syntax">Syntax Checking</a>
|
|
135
147
|
</li>
|
|
136
148
|
<li><a href="#topics-caching">File Caching</a>
|
|
@@ -141,7 +153,7 @@ It has the following features.
|
|
|
141
153
|
</li>
|
|
142
154
|
<li><a href="#topics-php">NoTextEnhancer and NoCodeEnhancer in PHP</a>
|
|
143
155
|
</li>
|
|
144
|
-
<li><a href="#
|
|
156
|
+
<li><a href="#topcs-modruby">Helper Class for mod_ruby</a>
|
|
145
157
|
</li>
|
|
146
158
|
<li><a href="#topics-benchmark">Benchmark</a>
|
|
147
159
|
</li>
|
|
@@ -233,6 +245,7 @@ puts <strong>eruby.result(binding())</strong> # get result
|
|
|
233
245
|
## src = eruby.convert(input)
|
|
234
246
|
## eval src
|
|
235
247
|
</pre>
|
|
248
|
+
<a name="example1.result"></a>
|
|
236
249
|
<div class="terminal_caption">
|
|
237
250
|
output</div>
|
|
238
251
|
<pre class="terminal">$ ruby example1.rb
|
|
@@ -254,6 +267,7 @@ _buf.to_s
|
|
|
254
267
|
</pre>
|
|
255
268
|
<p>Erubis has command 'erubis'. Command-line option '-x' shows the compiled source code of eRuby script.
|
|
256
269
|
</p>
|
|
270
|
+
<a name="example1_x.result"></a>
|
|
257
271
|
<div class="terminal_caption">
|
|
258
272
|
example of command-line option '-x'</div>
|
|
259
273
|
<pre class="terminal">$ erubis <strong>-x</strong> example1.eruby
|
|
@@ -273,7 +287,7 @@ _buf.to_s
|
|
|
273
287
|
<h3 class="section2">Trimming Spaces</h3>
|
|
274
288
|
<p>Erubis deletes spaces around '<% %>' automatically, while it leaves spaces around '<%= %>'.
|
|
275
289
|
</p>
|
|
276
|
-
<a name="example2.eruby"></a>
|
|
290
|
+
<a name="example2.eruby.comment_filter"></a>
|
|
277
291
|
<div class="program_caption">
|
|
278
292
|
example2.eruby</div>
|
|
279
293
|
<pre class="program"><ul>
|
|
@@ -284,6 +298,7 @@ example2.eruby</div>
|
|
|
284
298
|
<% end %> # trimmed
|
|
285
299
|
</ul>
|
|
286
300
|
</pre>
|
|
301
|
+
<a name="example2_x.result"></a>
|
|
287
302
|
<div class="terminal_caption">
|
|
288
303
|
compiled source code</div>
|
|
289
304
|
<pre class="terminal">$ erubis -x example2.eruby
|
|
@@ -299,6 +314,7 @@ _buf.to_s
|
|
|
299
314
|
</pre>
|
|
300
315
|
<p>If you want leave spaces around '<% %>', add command-line property '--trim=false'.
|
|
301
316
|
</p>
|
|
317
|
+
<a name="example2_trim.result"></a>
|
|
302
318
|
<div class="terminal_caption">
|
|
303
319
|
compiled source code with command-line property '--trim=false'</div>
|
|
304
320
|
<pre class="terminal">$ erubis -x <strong>--trim=false</strong> example2.eruby
|
|
@@ -321,27 +337,28 @@ example2.rb</div>
|
|
|
321
337
|
input = File.read('example2.eruby')
|
|
322
338
|
eruby = Erubis::Eruby.new(input<strong>, :trim=>false</strong>)
|
|
323
339
|
|
|
324
|
-
puts "
|
|
340
|
+
puts "----- script source ---"
|
|
325
341
|
puts eruby.src # print script source
|
|
326
342
|
|
|
327
|
-
puts "
|
|
343
|
+
puts "----- result ----------"
|
|
328
344
|
list = ['aaa', 'bbb', 'ccc']
|
|
329
345
|
puts eruby.result(binding()) # get result
|
|
330
346
|
</pre>
|
|
347
|
+
<a name="example2.result"></a>
|
|
331
348
|
<div class="terminal_caption">
|
|
332
349
|
output</div>
|
|
333
350
|
<pre class="terminal">$ ruby example2.rb
|
|
334
|
-
|
|
351
|
+
----- script source ---
|
|
335
352
|
_buf = ''; _buf << '<ul>
|
|
336
|
-
'; _buf << ' '
|
|
353
|
+
'; <strong>_buf << ' ';</strong> for item in list ; _buf << '
|
|
337
354
|
'; _buf << ' <li>
|
|
338
355
|
'; _buf << ( item ).to_s; _buf << '
|
|
339
356
|
'; _buf << ' </li>
|
|
340
|
-
'; _buf << ' '
|
|
357
|
+
'; <strong>_buf << ' ';</strong> end ; _buf << '
|
|
341
358
|
'; _buf << '</ul>
|
|
342
359
|
';
|
|
343
360
|
_buf.to_s
|
|
344
|
-
|
|
361
|
+
----- result ----------
|
|
345
362
|
<ul>
|
|
346
363
|
|
|
347
364
|
<li>
|
|
@@ -397,34 +414,35 @@ example3.rb</div>
|
|
|
397
414
|
input = File.read('example3.eruby')
|
|
398
415
|
eruby = Erubis::<strong>EscapedEruby</strong>.new(input) # or Erubis::XmlEruby
|
|
399
416
|
|
|
400
|
-
puts "
|
|
417
|
+
puts "----- script source ---"
|
|
401
418
|
puts eruby.src # print script source
|
|
402
419
|
|
|
403
|
-
puts "
|
|
420
|
+
puts "----- result ----------"
|
|
404
421
|
<strong>list = ['<aaa>', 'b&b', '"ccc"']</strong>
|
|
405
422
|
puts eruby.result(binding()) # get result
|
|
406
423
|
</pre>
|
|
424
|
+
<a name="example3.result.split_filter"></a>
|
|
407
425
|
<div class="terminal_caption">
|
|
408
426
|
output</div>
|
|
409
427
|
<pre class="terminal">$ ruby example3.rb 2> stderr.log
|
|
410
|
-
|
|
428
|
+
----- script source ---
|
|
411
429
|
_buf = ''; for item in list
|
|
412
|
-
_buf << ' <p>'; <strong>_buf << Erubis::XmlHelper.escape_xml( item )
|
|
413
|
-
<p>'; <strong>_buf << ( item ).to_s
|
|
414
|
-
<p>'; <strong>$stderr.puts("*** debug: item=#{(item).inspect}")
|
|
430
|
+
_buf << ' <p>'; <strong>_buf << Erubis::XmlHelper.escape_xml( item )</strong>; _buf << '</p>
|
|
431
|
+
<p>'; <strong>_buf << ( item ).to_s</strong>; _buf << '</p>
|
|
432
|
+
<p>'; <strong>$stderr.puts("*** debug: item=#{(item).inspect}")</strong>; _buf << '</p>
|
|
415
433
|
|
|
416
434
|
'; end
|
|
417
435
|
_buf.to_s
|
|
418
|
-
|
|
419
|
-
<p>
|
|
436
|
+
----- result ----------
|
|
437
|
+
<p><strong>&lt;aaa&gt;</strong></p>
|
|
420
438
|
<p><aaa></p>
|
|
421
439
|
<p></p>
|
|
422
440
|
|
|
423
|
-
<p>
|
|
441
|
+
<p><strong>b&amp;b</strong></p>
|
|
424
442
|
<p>b&b</p>
|
|
425
443
|
<p></p>
|
|
426
444
|
|
|
427
|
-
<p>
|
|
445
|
+
<p><strong>&quot;ccc&quot;</strong></p>
|
|
428
446
|
<p>"ccc"</p>
|
|
429
447
|
<p></p>
|
|
430
448
|
|
|
@@ -436,6 +454,7 @@ $ cat stderr.log
|
|
|
436
454
|
<p>The command-line option '-e' will do the same action as Erubis::EscapedEruby.
|
|
437
455
|
This option is available for any language.
|
|
438
456
|
</p>
|
|
457
|
+
<a name="example3_e.result"></a>
|
|
439
458
|
<pre class="terminal">$ erubis -l ruby <strong>-e</strong> example3.eruby
|
|
440
459
|
_buf = ''; for item in list
|
|
441
460
|
_buf << ' <p>'; _buf << Erubis::XmlHelper.escape_xml( item ); _buf << '</p>
|
|
@@ -482,6 +501,7 @@ example4.eruby</div>
|
|
|
482
501
|
<p><strong><!--%=</strong> item <strong>%--></strong></p>
|
|
483
502
|
<strong><!--%</strong> end <strong>%--></strong>
|
|
484
503
|
</pre>
|
|
504
|
+
<a name="example4_x.result"></a>
|
|
485
505
|
<div class="terminal_caption">
|
|
486
506
|
compiled source code with command-line option '-p'</div>
|
|
487
507
|
<pre class="terminal">$ erubis -x <strong>-p '<!--% %-->'</strong> example4.eruby
|
|
@@ -505,6 +525,7 @@ puts "---------- result ----------"
|
|
|
505
525
|
list = ['aaa', 'bbb', 'ccc']
|
|
506
526
|
puts eruby.result(binding()) # get result
|
|
507
527
|
</pre>
|
|
528
|
+
<a name="example4.result"></a>
|
|
508
529
|
<div class="terminal_caption">
|
|
509
530
|
output</div>
|
|
510
531
|
<pre class="terminal">$ ruby example4.rb
|
|
@@ -563,6 +584,7 @@ eruby = Erubis::Eruby.new(input) # create Eruby object
|
|
|
563
584
|
|
|
564
585
|
puts <strong>eruby.evaluate(context)</strong> # get result
|
|
565
586
|
</pre>
|
|
587
|
+
<a name="example5.result"></a>
|
|
566
588
|
<div class="terminal_caption">
|
|
567
589
|
output</div>
|
|
568
590
|
<pre class="terminal">$ ruby example5.rb
|
|
@@ -618,6 +640,7 @@ require 'erubis'
|
|
|
618
640
|
eruby = Erubis::Eruby.new(File.read('example5.eruby'))
|
|
619
641
|
puts eruby.evaluate(<strong>mydata</strong>)
|
|
620
642
|
</pre>
|
|
643
|
+
<a name="example6.result"></a>
|
|
621
644
|
<div class="terminal_caption">
|
|
622
645
|
output</div>
|
|
623
646
|
<pre class="terminal">$ ruby example6.rb
|
|
@@ -671,6 +694,7 @@ context.rb</div>
|
|
|
671
694
|
{ 'name'=>'baz', 'mail'=>'baz@mail.org' },
|
|
672
695
|
]
|
|
673
696
|
</pre>
|
|
697
|
+
<a name="example7.result.split_filter"></a>
|
|
674
698
|
<div class="terminal_caption">
|
|
675
699
|
example of command-line option '-f'</div>
|
|
676
700
|
<pre class="terminal">$ erubis <strong>-f context.yaml</strong> example7.eruby
|
|
@@ -709,7 +733,7 @@ Command-line option '-B' invokes 'Erubis::Eruby#result(binding())' instead of 'E
|
|
|
709
733
|
<a name="tut-datastr"></a>
|
|
710
734
|
<h3 class="section2">Context Data String</h3>
|
|
711
735
|
<p>Command-line option '-c <em>str</em>' enables you to specify context data in command-line.
|
|
712
|
-
<em>str</em> can be YAML
|
|
736
|
+
<em>str</em> can be YAML flow-style or Ruby code.
|
|
713
737
|
</p>
|
|
714
738
|
<a name="example8.eruby"></a>
|
|
715
739
|
<div class="program_caption">
|
|
@@ -721,18 +745,21 @@ example8.eruby</div>
|
|
|
721
745
|
<% end %>
|
|
722
746
|
</ul>
|
|
723
747
|
</pre>
|
|
748
|
+
<a name="example8_yaml.result"></a>
|
|
724
749
|
<div class="terminal_caption">
|
|
725
|
-
example of
|
|
726
|
-
<pre class="terminal"
|
|
727
|
-
$ erubis <strong>-c '{title: Example, list: [AAA, BBB, CCC]}'</strong> example8.eruby
|
|
750
|
+
example of YAML flow style</div>
|
|
751
|
+
<pre class="terminal">$ erubis <strong>-c '{title: Example, list: [AAA, BBB, CCC]}'</strong> example8.eruby
|
|
728
752
|
<h1>Example</h1>
|
|
729
753
|
<ul>
|
|
730
754
|
<li>AAA</li>
|
|
731
755
|
<li>BBB</li>
|
|
732
756
|
<li>CCC</li>
|
|
733
757
|
</ul>
|
|
734
|
-
|
|
735
|
-
|
|
758
|
+
</pre>
|
|
759
|
+
<a name="example8_ruby.result"></a>
|
|
760
|
+
<div class="terminal_caption">
|
|
761
|
+
example of Ruby code</div>
|
|
762
|
+
<pre class="terminal">$ erubis <strong>-c '@title="Example"; @list=%w[AAA BBB CCC]'</strong> example8.eruby
|
|
736
763
|
<h1>Example</h1>
|
|
737
764
|
<ul>
|
|
738
765
|
<li>AAA</li>
|
|
@@ -757,16 +784,14 @@ example9.eruby</div>
|
|
|
757
784
|
<b><%= item %></b>
|
|
758
785
|
<% end %>
|
|
759
786
|
</pre>
|
|
787
|
+
<a name="example9.result.split_filter"></a>
|
|
760
788
|
<div class="terminal_caption">
|
|
761
789
|
compiled source code with and without command-line option '-b'</div>
|
|
762
|
-
<pre class="terminal"
|
|
763
|
-
$ erubis -x example9.eruby
|
|
790
|
+
<pre class="terminal">$ erubis -x example9.eruby
|
|
764
791
|
<strong>_buf = '';</strong> for item in @list
|
|
765
792
|
_buf << ' <b>'; _buf << ( item ).to_s; _buf << '</b>
|
|
766
793
|
'; end
|
|
767
794
|
<strong>_buf.to_s</strong>
|
|
768
|
-
|
|
769
|
-
## with '-b'
|
|
770
795
|
$ erubis -x <strong>-b</strong> example9.eruby
|
|
771
796
|
for item in @list
|
|
772
797
|
_buf << ' <b>'; _buf << ( item ).to_s; _buf << '</b>
|
|
@@ -786,6 +811,7 @@ puts eruby1.src # print preamble and postamble
|
|
|
786
811
|
puts "--------------"
|
|
787
812
|
puts eruby2.src # don't print preamble and postamble
|
|
788
813
|
</pre>
|
|
814
|
+
<a name="example9.result"></a>
|
|
789
815
|
<div class="terminal_caption">
|
|
790
816
|
output</div>
|
|
791
817
|
<pre class="terminal">$ ruby example9.rb
|
|
@@ -873,6 +899,7 @@ If <em>name</em> is omitted then the following name is used according to '-l <em
|
|
|
873
899
|
</tr>
|
|
874
900
|
</table>
|
|
875
901
|
</div>
|
|
902
|
+
<a name="example10_x.result"></a>
|
|
876
903
|
<div class="terminal_caption">
|
|
877
904
|
output</div>
|
|
878
905
|
<pre class="terminal">$ erubis -x <strong>--pi</strong> example10.xhtml
|
|
@@ -905,6 +932,7 @@ input = File.read('example10.xhtml')
|
|
|
905
932
|
eruby = Erubis::PI::Eruby.new(input)
|
|
906
933
|
print eruby.src
|
|
907
934
|
</pre>
|
|
935
|
+
<a name="example10.result"></a>
|
|
908
936
|
<div class="terminal_caption">
|
|
909
937
|
output</div>
|
|
910
938
|
<pre class="terminal">$ ruby example10.rb
|
|
@@ -945,6 +973,178 @@ example of Rails view template</div>
|
|
|
945
973
|
<br>
|
|
946
974
|
|
|
947
975
|
|
|
976
|
+
<a name="tut-notext"></a>
|
|
977
|
+
<h3 class="section2">Retrieve Ruby Code</h3>
|
|
978
|
+
<p>Similar to '-x', ommand-line option '-X' shows converted Ruby source code.
|
|
979
|
+
The difference between '-x' and 'X' is that the former converts text part but the latter ignores it.
|
|
980
|
+
It means that you can retrieve Ruby code from eRuby script by '-X' option.
|
|
981
|
+
</p>
|
|
982
|
+
<p>For example, see the following eRuby script.
|
|
983
|
+
This is some complex, so it is difficult to grasp the program code.
|
|
984
|
+
</p>
|
|
985
|
+
<a name="example11.rhtml"></a>
|
|
986
|
+
<div class="program_caption">
|
|
987
|
+
example11.rhtml</div>
|
|
988
|
+
<pre class="program"><?xml version="1.0" encoding="UTF-8"?>
|
|
989
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
|
990
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
991
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
992
|
+
<body>
|
|
993
|
+
<h3>List</h3>
|
|
994
|
+
<% if @list.nil? || @list.empty? %>
|
|
995
|
+
<p>not found.</p>
|
|
996
|
+
<% else %>
|
|
997
|
+
<table>
|
|
998
|
+
<tbody>
|
|
999
|
+
<% @list.each_with_index do |item, i| %>
|
|
1000
|
+
<tr bgcolor="<%= i % 2 == 0 ? '#FCC' : '#CCF' %>">
|
|
1001
|
+
<td><%= item %></td>
|
|
1002
|
+
</tr>
|
|
1003
|
+
<% end %>
|
|
1004
|
+
</tbody>
|
|
1005
|
+
</table>
|
|
1006
|
+
<% end %>
|
|
1007
|
+
</body>
|
|
1008
|
+
</html>
|
|
1009
|
+
</pre>
|
|
1010
|
+
<p>Command-line option '-X' extracts only the ruby code from eRuby script.
|
|
1011
|
+
</p>
|
|
1012
|
+
<a name="example11.result"></a>
|
|
1013
|
+
<div class="terminal_caption">
|
|
1014
|
+
result</div>
|
|
1015
|
+
<pre class="terminal">$ erubis <strong>-X</strong> example11.rhtml
|
|
1016
|
+
_buf = '';
|
|
1017
|
+
|
|
1018
|
+
|
|
1019
|
+
|
|
1020
|
+
|
|
1021
|
+
|
|
1022
|
+
if @list.nil? || @list.empty?
|
|
1023
|
+
|
|
1024
|
+
else
|
|
1025
|
+
|
|
1026
|
+
|
|
1027
|
+
@list.each_with_index do |item, i|
|
|
1028
|
+
_buf << ( i % 2 == 0 ? '#FCC' : '#CCF' ).to_s;
|
|
1029
|
+
_buf << ( item ).to_s;
|
|
1030
|
+
|
|
1031
|
+
end
|
|
1032
|
+
|
|
1033
|
+
|
|
1034
|
+
end
|
|
1035
|
+
|
|
1036
|
+
|
|
1037
|
+
_buf.to_s
|
|
1038
|
+
</pre>
|
|
1039
|
+
<p>Command-line option '-C' (<strong>c</strong>mpact) deletes empty lines.
|
|
1040
|
+
</p>
|
|
1041
|
+
<a name="example11_C.result"></a>
|
|
1042
|
+
<div class="terminal_caption">
|
|
1043
|
+
result</div>
|
|
1044
|
+
<pre class="terminal">$ erubis <strong>-XC</strong> example11.rhtml
|
|
1045
|
+
_buf = '';
|
|
1046
|
+
if @list.nil? || @list.empty?
|
|
1047
|
+
else
|
|
1048
|
+
@list.each_with_index do |item, i|
|
|
1049
|
+
_buf << ( i % 2 == 0 ? '#FCC' : '#CCF' ).to_s;
|
|
1050
|
+
_buf << ( item ).to_s;
|
|
1051
|
+
end
|
|
1052
|
+
end
|
|
1053
|
+
_buf.to_s
|
|
1054
|
+
</pre>
|
|
1055
|
+
<p>Option '-U' (<strong>u</strong>nique) converts empty lines into a line.
|
|
1056
|
+
</p>
|
|
1057
|
+
<a name="example11_U.result"></a>
|
|
1058
|
+
<div class="terminal_caption">
|
|
1059
|
+
result</div>
|
|
1060
|
+
<pre class="terminal">$ erubis <strong>-XU</strong> example11.rhtml
|
|
1061
|
+
_buf = '';
|
|
1062
|
+
|
|
1063
|
+
if @list.nil? || @list.empty?
|
|
1064
|
+
|
|
1065
|
+
else
|
|
1066
|
+
|
|
1067
|
+
@list.each_with_index do |item, i|
|
|
1068
|
+
_buf << ( i % 2 == 0 ? '#FCC' : '#CCF' ).to_s;
|
|
1069
|
+
_buf << ( item ).to_s;
|
|
1070
|
+
|
|
1071
|
+
end
|
|
1072
|
+
|
|
1073
|
+
end
|
|
1074
|
+
|
|
1075
|
+
_buf.to_s
|
|
1076
|
+
</pre>
|
|
1077
|
+
<p>Option '-N' (<strong>n</strong>umber) adds line number.
|
|
1078
|
+
It is available with '-C' or '-U'.
|
|
1079
|
+
</p>
|
|
1080
|
+
<a name="example11_N.result"></a>
|
|
1081
|
+
<div class="terminal_caption">
|
|
1082
|
+
result</div>
|
|
1083
|
+
<pre class="terminal">$ erubis <strong>-XNU</strong> example11.rhtml
|
|
1084
|
+
1: _buf = '';
|
|
1085
|
+
|
|
1086
|
+
7: if @list.nil? || @list.empty?
|
|
1087
|
+
|
|
1088
|
+
9: else
|
|
1089
|
+
|
|
1090
|
+
12: @list.each_with_index do |item, i|
|
|
1091
|
+
13: _buf << ( i % 2 == 0 ? '#FCC' : '#CCF' ).to_s;
|
|
1092
|
+
14: _buf << ( item ).to_s;
|
|
1093
|
+
|
|
1094
|
+
16: end
|
|
1095
|
+
|
|
1096
|
+
19: end
|
|
1097
|
+
|
|
1098
|
+
22: _buf.to_s
|
|
1099
|
+
</pre>
|
|
1100
|
+
<p>Command-line option '-X' is available with PHP script.
|
|
1101
|
+
</p>
|
|
1102
|
+
<a name="example11.php"></a>
|
|
1103
|
+
<div class="program_caption">
|
|
1104
|
+
example11.php</div>
|
|
1105
|
+
<pre class="program"><?xml version="1.0"?>
|
|
1106
|
+
<html>
|
|
1107
|
+
<body>
|
|
1108
|
+
<h3>List</h3>
|
|
1109
|
+
<?php if (!$list) { ?>
|
|
1110
|
+
<p>not found.</p>
|
|
1111
|
+
<?php } else { ?>
|
|
1112
|
+
<table>
|
|
1113
|
+
<tbody>
|
|
1114
|
+
<?php $i = 0; ?>
|
|
1115
|
+
<?php foreach ($list as $item) { ?>
|
|
1116
|
+
<tr bgcolor="<?php echo ++$i % 2 == 1 ? '#FCC' : '#CCF'; ?>">
|
|
1117
|
+
<td><?php echo $item; ?></td>
|
|
1118
|
+
</tr>
|
|
1119
|
+
<?php } ?>
|
|
1120
|
+
</tbody>
|
|
1121
|
+
</table>
|
|
1122
|
+
<?php } ?>
|
|
1123
|
+
</body>
|
|
1124
|
+
</html>
|
|
1125
|
+
</pre>
|
|
1126
|
+
<a name="example11_php.result"></a>
|
|
1127
|
+
<div class="terminal_caption">
|
|
1128
|
+
result</div>
|
|
1129
|
+
<pre class="terminal">$ erubis -XNU <strong>-l php</strong> <strong>--pi=php</strong> --trim=false example11.php
|
|
1130
|
+
|
|
1131
|
+
5: <?php if (!$list) { ?>
|
|
1132
|
+
|
|
1133
|
+
7: <?php } else { ?>
|
|
1134
|
+
|
|
1135
|
+
10: <?php $i = 0; ?>
|
|
1136
|
+
11: <?php foreach ($list as $item) { ?>
|
|
1137
|
+
12: <?php echo ++$i % 2 == 1 ? '#FCC' : '#CCF'; ?>
|
|
1138
|
+
13: <?php echo $item; ?>
|
|
1139
|
+
|
|
1140
|
+
15: <?php } ?>
|
|
1141
|
+
|
|
1142
|
+
18: <?php } ?>
|
|
1143
|
+
|
|
1144
|
+
</pre>
|
|
1145
|
+
<br>
|
|
1146
|
+
|
|
1147
|
+
|
|
948
1148
|
<br>
|
|
949
1149
|
|
|
950
1150
|
|
|
@@ -998,12 +1198,17 @@ The following is an example to use some enhancers in command-line.
|
|
|
998
1198
|
<dt class="dt1">
|
|
999
1199
|
<a href="#arraybuffer-enhancer">ArrayBufferEnhancer</a> (only for Eruby)</dt>
|
|
1000
1200
|
<dd class="dd1">
|
|
1001
|
-
Use array buffer.
|
|
1201
|
+
Use array buffer. It is a little slower than StringBufferEnhancer.
|
|
1002
1202
|
</dd>
|
|
1003
1203
|
<dt class="dt1">
|
|
1004
1204
|
<a href="#stringbuffer-enhancer">StringBufferEnhancer</a> (only for Eruby)</dt>
|
|
1005
1205
|
<dd class="dd1">
|
|
1006
|
-
Use string buffer.
|
|
1206
|
+
Use string buffer. This is included in Erubis::Eruby by default.
|
|
1207
|
+
</dd>
|
|
1208
|
+
<dt class="dt1">
|
|
1209
|
+
<a href="#erbout-enhancer">ErboutEnhancer</a> (only for Eruby)</dt>
|
|
1210
|
+
<dd class="dd1">
|
|
1211
|
+
Set '_erbout = _buf = "";' to be compatible with ERB.
|
|
1007
1212
|
</dd>
|
|
1008
1213
|
<dt class="dt1">
|
|
1009
1214
|
<a href="#notext-enhancer">NoTextEnhancer</a> (language-independent)</dt>
|
|
@@ -1035,6 +1240,16 @@ The following is an example to use some enhancers in command-line.
|
|
|
1035
1240
|
<dd class="dd1">
|
|
1036
1241
|
[experimental] Enable you to add header and footer in eRuby script.
|
|
1037
1242
|
</dd>
|
|
1243
|
+
<dt class="dt1">
|
|
1244
|
+
<a href="#interpolation-enhancer">InterpolationEnhancer</a> (only for Eruby)</dt>
|
|
1245
|
+
<dd class="dd1">
|
|
1246
|
+
[experimental] convert '<p><%= text %></p>' into '_buf << %Q`<p>#{text}</p>`'.
|
|
1247
|
+
</dd>
|
|
1248
|
+
<dt class="dt1">
|
|
1249
|
+
<a href="#deleteindent-enhancer">DeleteIndentEnhancer</a> (language-independent)</dt>
|
|
1250
|
+
<dd class="dd1">
|
|
1251
|
+
[experimental] delete indentation of HTML file and eliminate page size.
|
|
1252
|
+
</dd>
|
|
1038
1253
|
</dl>
|
|
1039
1254
|
<p>If you required 'erubis/engine/enhanced', Eruby subclasses which include each enhancers are defined.
|
|
1040
1255
|
For example, class BiPatternEruby includes BiPatternEnhancer.
|
|
@@ -1053,6 +1268,7 @@ example.eruby</div>
|
|
|
1053
1268
|
<% end %>
|
|
1054
1269
|
</div>
|
|
1055
1270
|
</pre>
|
|
1271
|
+
<a name="escape_example.result"></a>
|
|
1056
1272
|
<div class="terminal_caption">
|
|
1057
1273
|
compiled source code</div>
|
|
1058
1274
|
<pre class="terminal">$ erubis -xE Escape example.eruby
|
|
@@ -1075,6 +1291,7 @@ _buf.to_s
|
|
|
1075
1291
|
<p>StdoutEnhancer use $sdtdout instead of array buffer.
|
|
1076
1292
|
Therefore, you can use 'print' statement in embedded ruby code.
|
|
1077
1293
|
</p>
|
|
1294
|
+
<a name="stdout_exmple.result"></a>
|
|
1078
1295
|
<div class="terminal_caption">
|
|
1079
1296
|
compiled source code</div>
|
|
1080
1297
|
<pre class="terminal">$ erubis -xE Stdout example.eruby
|
|
@@ -1085,7 +1302,7 @@ compiled source code</div>
|
|
|
1085
1302
|
'; end
|
|
1086
1303
|
_buf << '</div>
|
|
1087
1304
|
';
|
|
1088
|
-
''
|
|
1305
|
+
<strong>''</strong>
|
|
1089
1306
|
</pre>
|
|
1090
1307
|
<p>StdoutEnhancer is only for Eruby.
|
|
1091
1308
|
</p>
|
|
@@ -1096,6 +1313,7 @@ compiled source code</div>
|
|
|
1096
1313
|
<h3 class="section2">PrintOutEnhancer</h3>
|
|
1097
1314
|
<p>PrintOutEnhancer makes compiled source code to use 'print(...)' instead of '_buf << ...'.
|
|
1098
1315
|
</p>
|
|
1316
|
+
<a name="printstatement_example.result"></a>
|
|
1099
1317
|
<div class="terminal_caption">
|
|
1100
1318
|
compiled source code</div>
|
|
1101
1319
|
<pre class="terminal">$ erubis -xE PrintOut example.eruby
|
|
@@ -1135,6 +1353,7 @@ eruby = PrintEnabledEruby.new(input)
|
|
|
1135
1353
|
list = ['aaa', 'bbb', 'ccc']
|
|
1136
1354
|
print eruby.evaluate(:list=>list)
|
|
1137
1355
|
</pre>
|
|
1356
|
+
<a name="printenable_example.result"></a>
|
|
1138
1357
|
<div class="terminal_caption">
|
|
1139
1358
|
output result</div>
|
|
1140
1359
|
<pre class="terminal">$ ruby printenabled-example.rb
|
|
@@ -1154,9 +1373,11 @@ because print() method in '<% ... %>' invokes not Kernel#print() but Print
|
|
|
1154
1373
|
<h3 class="section2">ArrayEnhancer</h3>
|
|
1155
1374
|
<p>ArrayEnhancer makes Eruby to return an array of strings.
|
|
1156
1375
|
</p>
|
|
1376
|
+
<a name="array_example.result"></a>
|
|
1157
1377
|
<div class="terminal_caption">
|
|
1158
1378
|
compiled source code</div>
|
|
1159
|
-
<pre class="terminal"
|
|
1379
|
+
<pre class="terminal">$ erubis -xE Array example.eruby
|
|
1380
|
+
<strong>_buf = [];</strong> _buf << '<div>
|
|
1160
1381
|
'; for item in list
|
|
1161
1382
|
_buf << ' <p>'; _buf << ( item ).to_s; _buf << '</p>
|
|
1162
1383
|
<p>'; _buf << Erubis::XmlHelper.escape_xml( item ); _buf << '</p>
|
|
@@ -1177,6 +1398,9 @@ Array buffer is a litte slower than String buffer.
|
|
|
1177
1398
|
</p>
|
|
1178
1399
|
<p>ArrayBufferEnhancer is only for Eruby.
|
|
1179
1400
|
</p>
|
|
1401
|
+
<a name="arraybuffer_example.result"></a>
|
|
1402
|
+
<div class="terminal_caption">
|
|
1403
|
+
compiled source code</div>
|
|
1180
1404
|
<pre class="terminal">$ erubis -xE ArrayBuffer example.eruby
|
|
1181
1405
|
<strong>_buf = [];</strong> _buf << '<div>
|
|
1182
1406
|
'; for item in list
|
|
@@ -1185,7 +1409,7 @@ Array buffer is a litte slower than String buffer.
|
|
|
1185
1409
|
'; end
|
|
1186
1410
|
_buf << '</div>
|
|
1187
1411
|
';
|
|
1188
|
-
<strong>_buf</strong
|
|
1412
|
+
<strong>_buf.join</strong>
|
|
1189
1413
|
</pre>
|
|
1190
1414
|
<br>
|
|
1191
1415
|
|
|
@@ -1196,11 +1420,46 @@ Array buffer is a litte slower than String buffer.
|
|
|
1196
1420
|
String buffer is a little faster than array buffer.
|
|
1197
1421
|
Erubis::Eruby includes this enhancer by default.
|
|
1198
1422
|
</p>
|
|
1423
|
+
<a name="stringbuffer_example.result"></a>
|
|
1424
|
+
<div class="terminal_caption">
|
|
1425
|
+
compiled source code</div>
|
|
1426
|
+
<pre class="terminal">$ erubis -xE StringBuffer example.eruby
|
|
1427
|
+
<strong>_buf = '';</strong> _buf << '<div>
|
|
1428
|
+
'; for item in list
|
|
1429
|
+
_buf << ' <p>'; _buf << ( item ).to_s; _buf << '</p>
|
|
1430
|
+
<p>'; _buf << Erubis::XmlHelper.escape_xml( item ); _buf << '</p>
|
|
1431
|
+
'; end
|
|
1432
|
+
_buf << '</div>
|
|
1433
|
+
';
|
|
1434
|
+
<strong>_buf.to_s</strong>
|
|
1435
|
+
</pre>
|
|
1199
1436
|
<p>StringBufferEnhancer is only for Eruby.
|
|
1200
1437
|
</p>
|
|
1201
1438
|
<br>
|
|
1202
1439
|
|
|
1203
1440
|
|
|
1441
|
+
<a name="erbout-enhancer"></a>
|
|
1442
|
+
<h3 class="section2">ErboutEnhancer</h3>
|
|
1443
|
+
<p>ErboutEnhancer makes Eruby to be compatible with ERB.
|
|
1444
|
+
This is useful especially for Ruby on Rails.
|
|
1445
|
+
</p>
|
|
1446
|
+
<div class="terminal_caption">
|
|
1447
|
+
compiled source code</div>
|
|
1448
|
+
<pre class="terminal">$ erubis -xE Erbout example.eruby
|
|
1449
|
+
<strong>_erbout = _buf = '';</strong> _buf << '<div>
|
|
1450
|
+
'; for item in list
|
|
1451
|
+
_buf << ' <p>'; _buf << ( item ).to_s; _buf << '</p>
|
|
1452
|
+
<p>'; _buf << Erubis::XmlHelper.escape_xml( item ); _buf << '</p>
|
|
1453
|
+
'; end
|
|
1454
|
+
_buf << '</div>
|
|
1455
|
+
';
|
|
1456
|
+
_buf.to_s
|
|
1457
|
+
</pre>
|
|
1458
|
+
<p>ErboutEnhancer is only for Eruby.
|
|
1459
|
+
</p>
|
|
1460
|
+
<br>
|
|
1461
|
+
|
|
1462
|
+
|
|
1204
1463
|
<a name="notext-enhancer"></a>
|
|
1205
1464
|
<h3 class="section2">NoTextEnhancer</h3>
|
|
1206
1465
|
<p>NoTextEnhancer suppress output of text and prints only embedded code.
|
|
@@ -1224,6 +1483,7 @@ notext-example.eruby</div>
|
|
|
1224
1483
|
</table>
|
|
1225
1484
|
<% end %>
|
|
1226
1485
|
</pre>
|
|
1486
|
+
<a name="notext_example.result"></a>
|
|
1227
1487
|
<div class="terminal_caption">
|
|
1228
1488
|
output example of NoTextEnhancer</div>
|
|
1229
1489
|
<pre class="terminal">$ erubis -xE NoText notext-example.eruby
|
|
@@ -1271,6 +1531,7 @@ nocode-example.eruby</div>
|
|
|
1271
1531
|
</table>
|
|
1272
1532
|
<% end %>
|
|
1273
1533
|
</pre>
|
|
1534
|
+
<a name="nocode_example.result"></a>
|
|
1274
1535
|
<div class="terminal_caption">
|
|
1275
1536
|
output example of NoCodeEnhancer</div>
|
|
1276
1537
|
<pre class="terminal">$ erubis -xE NoCode notext-example.eruby
|
|
@@ -1298,9 +1559,10 @@ output example of NoCodeEnhancer</div>
|
|
|
1298
1559
|
<h3 class="section2">SimplifyEnhancer</h3>
|
|
1299
1560
|
<p>SimplifyEnhancer makes compiling a little faster but don't trim spaces around '<% %>'.
|
|
1300
1561
|
</p>
|
|
1562
|
+
<a name="simplify_example.result"></a>
|
|
1301
1563
|
<div class="terminal_caption">
|
|
1302
1564
|
compiled source code</div>
|
|
1303
|
-
<pre class="terminal">$ erubis -xE Simplify example.
|
|
1565
|
+
<pre class="terminal">$ erubis -xE Simplify example.eruby
|
|
1304
1566
|
_buf = ''; _buf << '<div>
|
|
1305
1567
|
'; for item in list ; _buf << '
|
|
1306
1568
|
<p>'; _buf << ( item ).to_s; _buf << '</p>
|
|
@@ -1329,6 +1591,7 @@ bipattern-example.rhtml</div>
|
|
|
1329
1591
|
<b><strong>[== item =]</strong></b>
|
|
1330
1592
|
<% end %>
|
|
1331
1593
|
</pre>
|
|
1594
|
+
<a name="bipattern_example.result"></a>
|
|
1332
1595
|
<div class="terminal_caption">
|
|
1333
1596
|
compiled source code</div>
|
|
1334
1597
|
<pre class="terminal">$ erubis -xE BiPattern bipattern-example.rhtml
|
|
@@ -1356,6 +1619,7 @@ percentline-example.rhtml</div>
|
|
|
1356
1619
|
<strong>% end</strong>
|
|
1357
1620
|
%% lines with '%%'
|
|
1358
1621
|
</pre>
|
|
1622
|
+
<a name="percentline_example.result"></a>
|
|
1359
1623
|
<div class="terminal_caption">
|
|
1360
1624
|
compiled source code</div>
|
|
1361
1625
|
<pre class="terminal">$ erubis -xE PercentLine percentline-example.rhtml
|
|
@@ -1390,6 +1654,7 @@ headerfooter-example.eruby</div>
|
|
|
1390
1654
|
<strong>end</strong>
|
|
1391
1655
|
<strong>#--></strong>
|
|
1392
1656
|
</pre>
|
|
1657
|
+
<a name="headerfooter_example.result"></a>
|
|
1393
1658
|
<div class="terminal_caption">
|
|
1394
1659
|
compiled source code</div>
|
|
1395
1660
|
<pre class="terminal">$ erubis -xE HeaderFooter headerfooter-example.eruby
|
|
@@ -1419,6 +1684,7 @@ normal-eruby-test.eruby</div>
|
|
|
1419
1684
|
<strong>end</strong>
|
|
1420
1685
|
<strong>%></strong>
|
|
1421
1686
|
</pre>
|
|
1687
|
+
<a name="normal_eruby_test.result"></a>
|
|
1422
1688
|
<div class="terminal_caption">
|
|
1423
1689
|
compiled source code</div>
|
|
1424
1690
|
<pre class="terminal">$ erubis -x normal-eruby-test.eruby
|
|
@@ -1450,6 +1716,7 @@ headerfooter-example2.rhtml</div>
|
|
|
1450
1716
|
<strong>#--></strong>
|
|
1451
1717
|
</html>
|
|
1452
1718
|
</pre>
|
|
1719
|
+
<a name="headerfooter_example2.result"></a>
|
|
1453
1720
|
<div class="terminal_caption">
|
|
1454
1721
|
compiled source code</div>
|
|
1455
1722
|
<pre class="terminal">$ erubis -xE HeaderFooter headerfooter-example2.rhtml
|
|
@@ -1471,11 +1738,75 @@ _buf.to_s
|
|
|
1471
1738
|
<br>
|
|
1472
1739
|
|
|
1473
1740
|
|
|
1741
|
+
<a name="interpolation-enhancer"></a>
|
|
1742
|
+
<h3 class="section2">InterpolationEnhancer</h3>
|
|
1743
|
+
<p>[experimental]
|
|
1744
|
+
</p>
|
|
1745
|
+
<p>InterpolationEnhancer converts "<h1><%= title %></h1>" into
|
|
1746
|
+
"_buf << %Q`<h1>#{ title }</h1>`".
|
|
1747
|
+
This makes Eruby a litter faster because method call of String#<< are eliminated
|
|
1748
|
+
by expression interpolations.
|
|
1749
|
+
</p>
|
|
1750
|
+
<div class="program_caption">
|
|
1751
|
+
InterpolationEnhancer elmininates method call of String#<<.</div>
|
|
1752
|
+
<pre class="program">## Assume that input is '<a href="<%=url%>"><%=name%></a>'.
|
|
1753
|
+
## Eruby convert input into the following code. String#<< is called 5 times.
|
|
1754
|
+
_buf << '<a href="'; _buf << (url).to_s; _buf << '">'; _buf << (name).to_s; _buf << '</a>';
|
|
1755
|
+
|
|
1756
|
+
## If InterpolationEnhancer is used, String#<< is called only once.
|
|
1757
|
+
_buf << %Q`<a href="#{url}">#{name}</a>`;
|
|
1758
|
+
</pre>
|
|
1759
|
+
<a name="interpolation_example.result"></a>
|
|
1760
|
+
<div class="terminal_caption">
|
|
1761
|
+
compiled source code</div>
|
|
1762
|
+
<pre class="terminal">$ erubis -xE Interpolation example.eruby
|
|
1763
|
+
_buf = ''; _buf << <strong>%Q`</strong><div>\n<strong>`</strong>
|
|
1764
|
+
for item in list
|
|
1765
|
+
_buf << <strong>%Q`</strong> <p><strong>#{ item }</strong></p>
|
|
1766
|
+
<p><strong>#{Erubis::XmlHelper.escape_xml( item )}</strong></p>\n<strong>`</strong>
|
|
1767
|
+
end
|
|
1768
|
+
_buf << <strong>%Q`</strong></div>\n<strong>`</strong>
|
|
1769
|
+
_buf.to_s
|
|
1770
|
+
</pre>
|
|
1771
|
+
<p>Erubis provides Erubis::FastEruby class which includes InterpolationEnhancer.
|
|
1772
|
+
You can use Erubis::FastEruby class instead of Erubis::Eruby class.
|
|
1773
|
+
</p>
|
|
1774
|
+
<p>InterpolationEnhancer is only for Eruby.
|
|
1775
|
+
</p>
|
|
1776
|
+
<br>
|
|
1777
|
+
|
|
1778
|
+
|
|
1779
|
+
<a name="deleteindent-enhancer"></a>
|
|
1780
|
+
<h3 class="section2">DeleteIndentEnhancer</h3>
|
|
1781
|
+
<p>[experimental]
|
|
1782
|
+
DeleteIndentEnhancer deletes indentation of HTML file.
|
|
1783
|
+
</p>
|
|
1784
|
+
<a name="interpolation_example.result"></a>
|
|
1785
|
+
<div class="terminal_caption">
|
|
1786
|
+
compiled source code</div>
|
|
1787
|
+
<pre class="terminal">$ erubis -xE DeleteIndent example.eruby
|
|
1788
|
+
_buf = ''; _buf << '<div>
|
|
1789
|
+
'; for item in list
|
|
1790
|
+
_buf << '<p>'; _buf << ( item ).to_s; _buf << '</p>
|
|
1791
|
+
<p>'; _buf << Erubis::XmlHelper.escape_xml( item ); _buf << '</p>
|
|
1792
|
+
'; end
|
|
1793
|
+
_buf << '</div>
|
|
1794
|
+
';
|
|
1795
|
+
_buf.to_s
|
|
1796
|
+
</pre>
|
|
1797
|
+
<p>Notice that DeleteIndentEnhancer isn't intelligent.
|
|
1798
|
+
It deletes indentations even if they are in <PRE></PRE>.
|
|
1799
|
+
</p>
|
|
1800
|
+
<p>DeleteIndentEnhancer is language-independent.
|
|
1801
|
+
</p>
|
|
1802
|
+
<br>
|
|
1803
|
+
|
|
1804
|
+
|
|
1474
1805
|
<br>
|
|
1475
1806
|
|
|
1476
1807
|
|
|
1477
1808
|
<a name="lang"></a>
|
|
1478
|
-
<h2 class="section1">Multi-Language</h2>
|
|
1809
|
+
<h2 class="section1">Multi-Language Support</h2>
|
|
1479
1810
|
<p>Erubis supports the following language currently:
|
|
1480
1811
|
</p>
|
|
1481
1812
|
<ul type="disc">
|
|
@@ -1518,6 +1849,7 @@ example.ephp</div>
|
|
|
1518
1849
|
</body>
|
|
1519
1850
|
</html>
|
|
1520
1851
|
</pre>
|
|
1852
|
+
<a name="example_php.result"></a>
|
|
1521
1853
|
<div class="terminal_caption">
|
|
1522
1854
|
compiled source code</div>
|
|
1523
1855
|
<pre class="terminal">$ erubis -l php example.ephp
|
|
@@ -1576,6 +1908,7 @@ int main(int argc, char *argv[])
|
|
|
1576
1908
|
}
|
|
1577
1909
|
%></strong>
|
|
1578
1910
|
</pre>
|
|
1911
|
+
<a name="example_c.result"></a>
|
|
1579
1912
|
<div class="terminal_caption">
|
|
1580
1913
|
compiled source code</div>
|
|
1581
1914
|
<pre class="terminal">$ erubis -l c example.ec
|
|
@@ -1672,10 +2005,11 @@ public class Example {
|
|
|
1672
2005
|
}
|
|
1673
2006
|
%></strong>
|
|
1674
2007
|
</pre>
|
|
2008
|
+
<a name="example_java.result"></a>
|
|
1675
2009
|
<div class="terminal_caption">
|
|
1676
2010
|
compiled source code</div>
|
|
1677
2011
|
<pre class="terminal">$ erubis -b -l java example.ejava
|
|
1678
|
-
|
|
2012
|
+
|
|
1679
2013
|
import java.util.*;
|
|
1680
2014
|
|
|
1681
2015
|
public class Example {
|
|
@@ -1730,7 +2064,6 @@ _buf.append(" </tbody>\n"
|
|
|
1730
2064
|
}
|
|
1731
2065
|
}
|
|
1732
2066
|
|
|
1733
|
-
return _buf.toString();
|
|
1734
2067
|
</pre>
|
|
1735
2068
|
<br>
|
|
1736
2069
|
|
|
@@ -1769,6 +2102,7 @@ example.escheme</div>
|
|
|
1769
2102
|
</body>
|
|
1770
2103
|
</html>
|
|
1771
2104
|
</pre>
|
|
2105
|
+
<a name="example_scheme.result"></a>
|
|
1772
2106
|
<div class="terminal_caption">
|
|
1773
2107
|
compiled source code</div>
|
|
1774
2108
|
<pre class="terminal">$ erubis -l scheme example.escheme
|
|
@@ -1802,6 +2136,7 @@ compiled source code</div>
|
|
|
1802
2136
|
</html>\n")
|
|
1803
2137
|
(reverse _buf))
|
|
1804
2138
|
</pre>
|
|
2139
|
+
<a name="example_scheme_display.result"></a>
|
|
1805
2140
|
<div class="terminal_caption">
|
|
1806
2141
|
compiled source code (with --func=display property)</div>
|
|
1807
2142
|
<pre class="terminal">$ erubis -l scheme --func=display example.escheme
|
|
@@ -1861,6 +2196,7 @@ example.eprl</div>
|
|
|
1861
2196
|
</body>
|
|
1862
2197
|
</html>
|
|
1863
2198
|
</pre>
|
|
2199
|
+
<a name="example_perl.result"></a>
|
|
1864
2200
|
<div class="terminal_caption">
|
|
1865
2201
|
compiled source code</div>
|
|
1866
2202
|
<pre class="terminal">$ erubis -l perl example.eperl
|
|
@@ -1913,6 +2249,7 @@ example.ejs</div>
|
|
|
1913
2249
|
</body>
|
|
1914
2250
|
</html>
|
|
1915
2251
|
</pre>
|
|
2252
|
+
<a name="example_js.result"></a>
|
|
1916
2253
|
<div class="terminal_caption">
|
|
1917
2254
|
compiled source code</div>
|
|
1918
2255
|
<pre class="terminal">$ erubis -l js example.ejs
|
|
@@ -1946,6 +2283,92 @@ document.write(_buf.join(""));
|
|
|
1946
2283
|
|
|
1947
2284
|
<a name="topics"></a>
|
|
1948
2285
|
<h2 class="section1">Other Topics</h2>
|
|
2286
|
+
<a name="topics-fasteruby"></a>
|
|
2287
|
+
<h3 class="section2">Class Erubis::FastEruby</h3>
|
|
2288
|
+
<p>[experimental]
|
|
2289
|
+
</p>
|
|
2290
|
+
<p>Erubis provides Erubis::FastEruby class which includes <a href="#interpolation-enhancer">InterpolationEnhancer</a> and <a href="#topics-benchmark">works faster than Erubis::Eruby class</a>.
|
|
2291
|
+
If you desire more speed, try Erubis::FastEruby class.
|
|
2292
|
+
</p>
|
|
2293
|
+
<a name="fasteruby.rhtml"></a>
|
|
2294
|
+
<div class="program_caption">
|
|
2295
|
+
File 'fasteruby.rhtml':</div>
|
|
2296
|
+
<pre class="program"><html>
|
|
2297
|
+
<body>
|
|
2298
|
+
<h1><%== @title %></h1>
|
|
2299
|
+
<table>
|
|
2300
|
+
<% i = 0 %>
|
|
2301
|
+
<% for item in @list %>
|
|
2302
|
+
<% i += 1 %>
|
|
2303
|
+
<tr>
|
|
2304
|
+
<td><%= i %></td>
|
|
2305
|
+
<td><%== item %></td>
|
|
2306
|
+
</tr>
|
|
2307
|
+
<% end %>
|
|
2308
|
+
</table>
|
|
2309
|
+
</body>
|
|
2310
|
+
</html>
|
|
2311
|
+
</pre>
|
|
2312
|
+
<a name="fasteruby.rb"></a>
|
|
2313
|
+
<div class="program_caption">
|
|
2314
|
+
File 'fasteruby.rb':</div>
|
|
2315
|
+
<pre class="program">require 'erubis'
|
|
2316
|
+
input = File.read('fasteruby.rhtml')
|
|
2317
|
+
eruby = <strong>Erubis::FastEruby.new(input)</strong> # create Eruby object
|
|
2318
|
+
|
|
2319
|
+
puts "---------- script source ---"
|
|
2320
|
+
puts eruby.src
|
|
2321
|
+
|
|
2322
|
+
puts "---------- result ----------"
|
|
2323
|
+
context = { :title=>'Example', :list=>['aaa', 'bbb', 'ccc'] }
|
|
2324
|
+
output = eruby.evaluate(context)
|
|
2325
|
+
print output
|
|
2326
|
+
</pre>
|
|
2327
|
+
<a name="fasteruby.result"></a>
|
|
2328
|
+
<div class="terminal_caption">
|
|
2329
|
+
output</div>
|
|
2330
|
+
<pre class="terminal">$ ruby fasteruby.rb
|
|
2331
|
+
---------- script source ---
|
|
2332
|
+
_buf = ''; _buf << <strong>%Q`</strong><html>
|
|
2333
|
+
<body>
|
|
2334
|
+
<h1><strong>#{Erubis::XmlHelper.escape_xml( @title )}</strong></h1>
|
|
2335
|
+
<table>\n<strong>`</strong>
|
|
2336
|
+
i = 0
|
|
2337
|
+
for item in @list
|
|
2338
|
+
i += 1
|
|
2339
|
+
_buf << <strong>%Q`</strong> <tr>
|
|
2340
|
+
<td><strong>#{ i }</strong></td>
|
|
2341
|
+
<td><strong>#{Erubis::XmlHelper.escape_xml( item )}</strong></td>
|
|
2342
|
+
</tr>\n<strong>`</strong>
|
|
2343
|
+
end
|
|
2344
|
+
_buf << <strong>%Q`</strong> </table>
|
|
2345
|
+
</body>
|
|
2346
|
+
</html>\n<strong>`</strong>
|
|
2347
|
+
_buf.to_s
|
|
2348
|
+
---------- result ----------
|
|
2349
|
+
<html>
|
|
2350
|
+
<body>
|
|
2351
|
+
<h1>Example</h1>
|
|
2352
|
+
<table>
|
|
2353
|
+
<tr>
|
|
2354
|
+
<td>1</td>
|
|
2355
|
+
<td>aaa</td>
|
|
2356
|
+
</tr>
|
|
2357
|
+
<tr>
|
|
2358
|
+
<td>2</td>
|
|
2359
|
+
<td>bbb</td>
|
|
2360
|
+
</tr>
|
|
2361
|
+
<tr>
|
|
2362
|
+
<td>3</td>
|
|
2363
|
+
<td>ccc</td>
|
|
2364
|
+
</tr>
|
|
2365
|
+
</table>
|
|
2366
|
+
</body>
|
|
2367
|
+
</html>
|
|
2368
|
+
</pre>
|
|
2369
|
+
<br>
|
|
2370
|
+
|
|
2371
|
+
|
|
1949
2372
|
<a name="topics-syntax"></a>
|
|
1950
2373
|
<h3 class="section2">Syntax Checking</h3>
|
|
1951
2374
|
<p>Command-line option '-z' checks syntax. It is similar to 'erubis -x file.rhtml | ruby -wc', but it can take several file names.
|
|
@@ -1960,15 +2383,15 @@ Syntax OK
|
|
|
1960
2383
|
|
|
1961
2384
|
<a name="topics-caching"></a>
|
|
1962
2385
|
<h3 class="section2">File Caching</h3>
|
|
1963
|
-
<p>Erubis::Eruby.
|
|
2386
|
+
<p>Erubis::Eruby.load_file(filename) convert file into Ruby script and return Eruby object.
|
|
1964
2387
|
In addition, it caches converted Ruby script into cache file (filename + '.cache') if cache file is old or not exist.
|
|
1965
|
-
If cache file exists and is newer than eruby file, Erubis::Eruby.
|
|
2388
|
+
If cache file exists and is newer than eruby file, Erubis::Eruby.load_file() loads cache file.
|
|
1966
2389
|
</p>
|
|
1967
2390
|
<div class="program_caption">
|
|
1968
|
-
example of Erubis::Eruby.
|
|
2391
|
+
example of Erubis::Eruby.load_file()</div>
|
|
1969
2392
|
<pre class="program">require 'erubis'
|
|
1970
2393
|
filename = 'example.rhtml'
|
|
1971
|
-
eruby = <strong>Erubis::Eruby.
|
|
2394
|
+
eruby = <strong>Erubis::Eruby.load_file(filename)</strong>
|
|
1972
2395
|
cachename = filename + '.cache'
|
|
1973
2396
|
if test(?f, cachename)
|
|
1974
2397
|
puts "*** cache file '#{cachename}' created."
|
|
@@ -1998,7 +2421,7 @@ try Erubis::TinyEruby class.
|
|
|
1998
2421
|
<div class="program_caption">
|
|
1999
2422
|
config/environment.rb</div>
|
|
2000
2423
|
<pre class="program">require 'erubis/helpers/rails_helper'
|
|
2001
|
-
#Erubis::Helpers::RailsHelper.engine_class = Erubis::Eruby
|
|
2424
|
+
#Erubis::Helpers::RailsHelper.engine_class = Erubis::Eruby # or Erubis::FastEruby
|
|
2002
2425
|
#Erubis::Helpers::RailsHelper.init_properties = {}
|
|
2003
2426
|
#Erubis::Helpers::RailsHelper.show_src = false
|
|
2004
2427
|
</pre>
|
|
@@ -2090,176 +2513,138 @@ notext-example.php</div>
|
|
|
2090
2513
|
<p>This is complex because PHP code and HTML document are mixed.
|
|
2091
2514
|
NoTextEnhancer can separate PHP code from HTML document.
|
|
2092
2515
|
</p>
|
|
2516
|
+
<a name="notext-php.result"></a>
|
|
2093
2517
|
<div class="terminal_caption">
|
|
2094
2518
|
example of using NoTextEnhancer with PHP file</div>
|
|
2095
|
-
<pre class="terminal">$ erubis -l php -E NoText
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2519
|
+
<pre class="terminal">$ erubis -l php --pi=php -N -E NoText --trim=false notext-example.php
|
|
2520
|
+
1:
|
|
2521
|
+
2:
|
|
2522
|
+
3:
|
|
2523
|
+
4: <?php if (!$list || count($list) == 0) { ?>
|
|
2524
|
+
5:
|
|
2525
|
+
6: <?php } else { ?>
|
|
2526
|
+
7:
|
|
2527
|
+
8:
|
|
2528
|
+
9: <?php $i = 0; ?>
|
|
2529
|
+
10: <?php foreach ($list as $item) { ?>
|
|
2530
|
+
11: <?php echo ++$i % 2 == 1 ? '#FFCCCC' : '#CCCCFF'; ?>
|
|
2531
|
+
12: <?php echo $item; ?>
|
|
2532
|
+
13:
|
|
2533
|
+
14: <?php } ?>
|
|
2534
|
+
15:
|
|
2535
|
+
16:
|
|
2536
|
+
17: <?php } ?>
|
|
2537
|
+
18:
|
|
2538
|
+
19:
|
|
2115
2539
|
</pre>
|
|
2116
2540
|
<p>In the same way, NoCodeEnhancer can extract HTML tags.
|
|
2117
2541
|
</p>
|
|
2542
|
+
<a name="nocode-php.result"></a>
|
|
2118
2543
|
<div class="terminal_caption">
|
|
2119
2544
|
example of using NoCodeEnhancer with PHP file</div>
|
|
2120
|
-
<pre class="terminal">$ erubis -l php -E NoCode
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2545
|
+
<pre class="terminal">$ erubis -l php --pi=php -N -E NoCode --trim=false notext-example.php
|
|
2546
|
+
1: <html>
|
|
2547
|
+
2: <body>
|
|
2548
|
+
3: <h3>List</h3>
|
|
2549
|
+
4:
|
|
2550
|
+
5: <p>not found.</p>
|
|
2551
|
+
6:
|
|
2552
|
+
7: <table>
|
|
2553
|
+
8: <tbody>
|
|
2554
|
+
9:
|
|
2555
|
+
10:
|
|
2556
|
+
11: <tr bgcolor="">
|
|
2557
|
+
12: <td></td>
|
|
2558
|
+
13: </tr>
|
|
2559
|
+
14:
|
|
2560
|
+
15: </tbody>
|
|
2561
|
+
16: </table>
|
|
2562
|
+
17:
|
|
2563
|
+
18: </body>
|
|
2564
|
+
19: </html>
|
|
2140
2565
|
</pre>
|
|
2141
2566
|
<br>
|
|
2142
2567
|
|
|
2143
2568
|
|
|
2144
|
-
<a name="
|
|
2145
|
-
<h3 class="section2">
|
|
2146
|
-
<p>
|
|
2147
|
-
This is very useful when debugging eRuby script.
|
|
2569
|
+
<a name="topcs-modruby"></a>
|
|
2570
|
+
<h3 class="section2">Helper Class for mod_ruby</h3>
|
|
2571
|
+
<p>Thanks Andrew R Jackson, he developed 'erubis-run.rb' which enables you to use Erubis with mod_ruby.
|
|
2148
2572
|
</p>
|
|
2149
|
-
<
|
|
2150
|
-
|
|
2573
|
+
<ol type="1">
|
|
2574
|
+
<li>Copy 'erubis-2.3.0/contrib/erubis-run.rb' to the 'RUBYLIBDIR/apache' directory (for example '/usr/local/lib/ruby/1.8/apache') which contains 'ruby-run.rb', 'eruby-run.rb', and so on.
|
|
2575
|
+
<pre class="terminal">$ cd erubis-2.3.0/
|
|
2576
|
+
$ sudo copy contrib/erubis-run.rb /usr/local/lib/ruby/1.8/apache/
|
|
2577
|
+
</pre>
|
|
2578
|
+
</li>
|
|
2579
|
+
<li>Add the following example to your 'httpd.conf' (for example '/usr/local/apache2/conf/httpd.conf')
|
|
2580
|
+
<pre class="program">LoadModule ruby_module modules/mod_ruby.so
|
|
2581
|
+
<IfModule mod_ruby.c>
|
|
2582
|
+
RubyRequire apache/ruby-run
|
|
2583
|
+
RubyRequire apache/eruby-run
|
|
2584
|
+
RubyRequire apache/erubis-run
|
|
2585
|
+
<Location /erubis>
|
|
2586
|
+
SetHandler ruby-object
|
|
2587
|
+
RubyHandler Apache::ErubisRun.instance
|
|
2588
|
+
</Location>
|
|
2589
|
+
<Files *.rhtml>
|
|
2590
|
+
SetHandler ruby-object
|
|
2591
|
+
RubyHandler Apache::ErubisRun.instance
|
|
2592
|
+
</Files>
|
|
2593
|
+
</IfModule>
|
|
2594
|
+
</pre>
|
|
2595
|
+
</li>
|
|
2596
|
+
<li>Restart Apache web server.
|
|
2597
|
+
<pre class="terminal">$ sudo /usr/local/apache2/bin/apachectl stop
|
|
2598
|
+
$ sudo /usr/local/apache2/bin/apachectl start
|
|
2599
|
+
</pre>
|
|
2600
|
+
</li>
|
|
2601
|
+
<li>Create *.rhtml file, for example:
|
|
2151
2602
|
<pre class="program"><html>
|
|
2152
|
-
<head>
|
|
2153
|
-
<title>notext example</title>
|
|
2154
|
-
</head>
|
|
2155
2603
|
<body>
|
|
2156
|
-
<
|
|
2157
|
-
|
|
2158
|
-
<% klass = i % 2 == 0 ? 'odd' : 'even' %>
|
|
2159
|
-
<tr class="<%= klass %>">
|
|
2160
|
-
<td><%== item %></td>
|
|
2161
|
-
</tr>
|
|
2162
|
-
<% end %>
|
|
2163
|
-
</table>
|
|
2604
|
+
Now is <%= Time.now %>
|
|
2605
|
+
Erubis version is <%= Erubis::VERSION %>
|
|
2164
2606
|
</body>
|
|
2165
2607
|
</html>
|
|
2166
2608
|
</pre>
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
<pre class="terminal">$
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
@list.each_with_index do |item, i| ;
|
|
2177
|
-
klass = i % 2 == 0 ? 'odd' : 'even' ;
|
|
2178
|
-
_buf << ( klass ).to_s;
|
|
2179
|
-
_buf << Erubis::XmlHelper.escape_xml( item );
|
|
2180
|
-
|
|
2181
|
-
end ;
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
_buf.to_s
|
|
2185
|
-
</pre>
|
|
2186
|
-
<p>Command-line option '-u' deletes continuous empty lines to one empty line.
|
|
2187
|
-
</p>
|
|
2188
|
-
<div class="terminal_caption">
|
|
2189
|
-
command-line example</div>
|
|
2190
|
-
<pre class="terminal">$ notext <strong>-u</strong> notext-ex.rhtml
|
|
2191
|
-
_buf = '';
|
|
2192
|
-
|
|
2193
|
-
@list.each_with_index do |item, i| ;
|
|
2194
|
-
klass = i % 2 == 0 ? 'odd' : 'even' ;
|
|
2195
|
-
_buf << ( klass ).to_s;
|
|
2196
|
-
_buf << Erubis::XmlHelper.escape_xml( item );
|
|
2197
|
-
|
|
2198
|
-
end ;
|
|
2199
|
-
|
|
2200
|
-
_buf.to_s
|
|
2201
|
-
</pre>
|
|
2202
|
-
<p>Command-line option '-c' deletes all empty lines.
|
|
2203
|
-
</p>
|
|
2204
|
-
<div class="terminal_caption">
|
|
2205
|
-
command-line example</div>
|
|
2206
|
-
<pre class="terminal">$ notext <strong>-c</strong> notext-ex.rhtml
|
|
2207
|
-
_buf = '';
|
|
2208
|
-
@list.each_with_index do |item, i| ;
|
|
2209
|
-
klass = i % 2 == 0 ? 'odd' : 'even' ;
|
|
2210
|
-
_buf << ( klass ).to_s;
|
|
2211
|
-
_buf << Erubis::XmlHelper.escape_xml( item );
|
|
2212
|
-
end ;
|
|
2213
|
-
_buf.to_s
|
|
2214
|
-
</pre>
|
|
2215
|
-
<p>Command-line option '-n' shows line numbers. It can work with '-c' or '-u'.
|
|
2216
|
-
</p>
|
|
2217
|
-
<pre class="terminal">$ notext <strong>-nu</strong> example2.rhtml
|
|
2218
|
-
1: _buf = '';
|
|
2219
|
-
|
|
2220
|
-
7: @list.each_with_index do |item, i| ;
|
|
2221
|
-
8: klass = i % 2 == 0 ? 'odd' : 'even' ;
|
|
2222
|
-
9: _buf << ( klass ).to_s;
|
|
2223
|
-
10: _buf << Erubis::XmlHelper.escape_xml( item );
|
|
2224
|
-
|
|
2225
|
-
12: end ;
|
|
2226
|
-
|
|
2227
|
-
16: _buf.to_s
|
|
2228
|
-
$ notext <strong>-nc</strong> example2.rhtml
|
|
2229
|
-
1: _buf = '';
|
|
2230
|
-
7: @list.each_with_index do |item, i| ;
|
|
2231
|
-
8: klass = i % 2 == 0 ? 'odd' : 'even' ;
|
|
2232
|
-
9: _buf << ( klass ).to_s;
|
|
2233
|
-
10: _buf << Erubis::XmlHelper.escape_xml( item );
|
|
2234
|
-
12: end ;
|
|
2235
|
-
16: _buf.to_s
|
|
2609
|
+
</li>
|
|
2610
|
+
<li>Change mode of your directory to be writable by web server process.
|
|
2611
|
+
<pre class="terminal">$ cd /usr/local/apache2/htdocs/erubis
|
|
2612
|
+
$ sudo chgrp daemon .
|
|
2613
|
+
$ sudo chmod 775 .
|
|
2236
2614
|
</pre>
|
|
2237
|
-
|
|
2615
|
+
</li>
|
|
2616
|
+
<li>Access the *.rhtml file and you'll get the web page.
|
|
2617
|
+
</li>
|
|
2618
|
+
</ol>
|
|
2619
|
+
<p>You must set your directories to be writable by web server process, because
|
|
2620
|
+
Apache::ErubisRun calls Erubis::Eruby.load_file() internally which creates cache files
|
|
2621
|
+
in the same directory as '*.rhtml' file.
|
|
2238
2622
|
</p>
|
|
2239
2623
|
<br>
|
|
2240
2624
|
|
|
2241
2625
|
|
|
2242
2626
|
<a name="topics-benchmark"></a>
|
|
2243
2627
|
<h3 class="section2">Benchmark</h3>
|
|
2244
|
-
<p>A benchmark script is included in Erubis package at 'erubis-
|
|
2628
|
+
<p>A benchmark script is included in Erubis package at 'erubis-2.3.0/benchark/' directory.
|
|
2245
2629
|
Here is an example result of benchmark.
|
|
2246
2630
|
</p>
|
|
2247
2631
|
<div class="terminal_caption">
|
|
2248
|
-
MacOS X 10.4 Tiger, Intel CoreDuo 1.83GHz, Ruby1.8.
|
|
2249
|
-
<pre class="terminal">$ cd erubis-2.
|
|
2250
|
-
$ ruby
|
|
2251
|
-
|
|
2632
|
+
MacOS X 10.4 Tiger, Intel CoreDuo 1.83GHz, Ruby1.8.6, eruby1.0.5, gcc4.0.1</div>
|
|
2633
|
+
<pre class="terminal">$ cd erubis-2.3.0/benchmark/
|
|
2634
|
+
$ ruby bench.rb -n 10000 -m execute
|
|
2635
|
+
*** ntimes=10000, testmode=execute
|
|
2252
2636
|
user system total real
|
|
2253
|
-
eruby 12.
|
|
2254
|
-
ERB
|
|
2255
|
-
|
|
2256
|
-
Erubis::Eruby
|
|
2257
|
-
Erubis::
|
|
2258
|
-
Erubis::
|
|
2259
|
-
Erubis::
|
|
2260
|
-
Erubis::
|
|
2261
|
-
Erubis::
|
|
2262
|
-
Erubis::
|
|
2637
|
+
eruby 12.720000 0.240000 <strong>12.960000</strong> ( 12.971888)
|
|
2638
|
+
ERB 36.760000 0.350000 <strong>37.110000</strong> ( 37.112019)
|
|
2639
|
+
ERB(cached) 11.990000 0.440000 <strong>12.430000</strong> ( 12.430375)
|
|
2640
|
+
Erubis::Eruby 10.840000 0.300000 <strong>11.140000</strong> ( 11.144426)
|
|
2641
|
+
Erubis::Eruby(cached) 7.540000 0.410000 <strong>7.950000</strong> ( 7.969305)
|
|
2642
|
+
Erubis::FastEruby 10.440000 0.300000 <strong>10.740000</strong> ( 10.737808)
|
|
2643
|
+
Erubis::FastEruby(cached) 6.940000 0.410000 <strong>7.350000</strong> ( 7.353666)
|
|
2644
|
+
Erubis::TinyEruby 9.550000 0.290000 9.840000 ( 9.851729)
|
|
2645
|
+
Erubis::ArrayBufferEruby 11.010000 0.300000 11.310000 ( 11.314339)
|
|
2646
|
+
Erubis::PrintOutEruby 11.640000 0.290000 11.930000 ( 11.942141)
|
|
2647
|
+
Erubis::StdoutEruby 11.590000 0.300000 11.890000 ( 11.886512)
|
|
2263
2648
|
</pre>
|
|
2264
2649
|
<p>This shows that...
|
|
2265
2650
|
</p>
|
|
@@ -2270,6 +2655,8 @@ Erubis::PI::Eruby 12.010000 0.340000 12.350000 ( 13.104801)
|
|
|
2270
2655
|
</li>
|
|
2271
2656
|
<li>Caching (by Erubis::Eruby.load_file()) makes Erubis about 40-50 percent faster.
|
|
2272
2657
|
</li>
|
|
2658
|
+
<li>Erubis::FastEruby is a litte faster than Erubis::Eruby.
|
|
2659
|
+
</li>
|
|
2273
2660
|
<li>Array buffer (ArrayBufferEnhancer) is a little slower than string buffer (StringBufferEnhancer which Erubis::Eruby includes)
|
|
2274
2661
|
</li>
|
|
2275
2662
|
<li>$stdout and print() make Erubis a little slower.
|
|
@@ -2279,23 +2666,23 @@ Erubis::PI::Eruby 12.010000 0.340000 12.350000 ( 13.104801)
|
|
|
2279
2666
|
</ul>
|
|
2280
2667
|
<p>Escaping HTML characters (such as '< > & "') makes Erubis more faster than eruby and ERB,
|
|
2281
2668
|
because Erubis::XmlHelper#escape_xml() works faster than CGI.escapeHTML() and ERB::Util#h().
|
|
2282
|
-
The following shows that Erubis runs more than
|
|
2669
|
+
The following shows that Erubis runs more than 40 percent (when no-cached) or 90 percent (when cached) faster than eruby if HTML characters are escaped.
|
|
2283
2670
|
</p>
|
|
2284
2671
|
<div class="terminal_caption">
|
|
2285
2672
|
When escaping HTML characters with option '-e'</div>
|
|
2286
|
-
<pre class="terminal">$ ruby
|
|
2287
|
-
|
|
2673
|
+
<pre class="terminal">$ ruby bench.rb -n 10000 -m execute -ep
|
|
2674
|
+
*** ntimes=10000, testmode=execute
|
|
2288
2675
|
user system total real
|
|
2289
|
-
eruby
|
|
2290
|
-
ERB
|
|
2291
|
-
|
|
2292
|
-
Erubis::Eruby
|
|
2293
|
-
Erubis::
|
|
2294
|
-
Erubis::
|
|
2295
|
-
Erubis::
|
|
2296
|
-
Erubis::
|
|
2297
|
-
Erubis::
|
|
2298
|
-
Erubis::
|
|
2676
|
+
eruby 21.700000 0.290000 <strong>21.990000</strong> ( 22.050687)
|
|
2677
|
+
ERB 45.140000 0.390000 <strong>45.530000</strong> ( 45.536976)
|
|
2678
|
+
ERB(cached) 20.340000 0.470000 <strong>20.810000</strong> ( 20.822653)
|
|
2679
|
+
Erubis::Eruby 14.830000 0.310000 <strong>15.140000</strong> ( 15.147930)
|
|
2680
|
+
Erubis::Eruby(cached) 11.090000 0.420000 <strong>11.510000</strong> ( 11.514954)
|
|
2681
|
+
Erubis::FastEruby 14.850000 0.310000 <strong>15.160000</strong> ( 15.172499)
|
|
2682
|
+
Erubis::FastEruby(cached) 10.970000 0.430000 <strong>11.400000</strong> ( 11.399605)
|
|
2683
|
+
Erubis::ArrayBufferEruby 14.970000 0.300000 15.270000 ( 15.281061)
|
|
2684
|
+
Erubis::PrintOutEruby 15.780000 0.300000 16.080000 ( 16.088289)
|
|
2685
|
+
Erubis::StdoutEruby 15.840000 0.310000 16.150000 ( 16.235338)
|
|
2299
2686
|
</pre>
|
|
2300
2687
|
<br>
|
|
2301
2688
|
|
|
@@ -2331,17 +2718,38 @@ Erubis::PI::Eruby 17.210000 0.360000 17.570000 ( 18.836510)
|
|
|
2331
2718
|
Show compiled source.
|
|
2332
2719
|
</dd>
|
|
2333
2720
|
<dt class="dt3"><b>
|
|
2334
|
-
-
|
|
2721
|
+
-X </b></dt>
|
|
2335
2722
|
<dd class="dd3">
|
|
2336
|
-
|
|
2723
|
+
Show compiled source but only Ruby code.
|
|
2724
|
+
This is equivarent to '-E NoText'.
|
|
2725
|
+
</dd>
|
|
2726
|
+
<dt class="dt3"><b>
|
|
2727
|
+
-N </b></dt>
|
|
2728
|
+
<dd class="dd3">
|
|
2729
|
+
Numbering: add line numbers. (for '-x/-X')
|
|
2730
|
+
</dd>
|
|
2731
|
+
<dt class="dt3"><b>
|
|
2732
|
+
-U </b></dt>
|
|
2733
|
+
<dd class="dd3">
|
|
2734
|
+
Unique mode: zip empty lines into a line. (for '-x/-X')
|
|
2735
|
+
</dd>
|
|
2736
|
+
<dt class="dt3"><b>
|
|
2737
|
+
-C </b></dt>
|
|
2738
|
+
<dd class="dd3">
|
|
2739
|
+
Compact: remove empty lines. (for '-x/-X')
|
|
2337
2740
|
</dd>
|
|
2338
2741
|
<dt class="dt3"><b>
|
|
2339
2742
|
-b </b></dt>
|
|
2340
2743
|
<dd class="dd3">
|
|
2341
|
-
Body only
|
|
2744
|
+
Body only: no preamble nor postamble. (for '-x/-X')
|
|
2342
2745
|
This is equivarent to '--preamble=false --postamble=false'.
|
|
2343
2746
|
</dd>
|
|
2344
2747
|
<dt class="dt3"><b>
|
|
2748
|
+
-z </b></dt>
|
|
2749
|
+
<dd class="dd3">
|
|
2750
|
+
Syntax checking.
|
|
2751
|
+
</dd>
|
|
2752
|
+
<dt class="dt3"><b>
|
|
2345
2753
|
-e </b></dt>
|
|
2346
2754
|
<dd class="dd3">
|
|
2347
2755
|
Escape. This is equivarent to '-E Escape'.
|
|
@@ -2391,9 +2799,9 @@ Erubis::PI::Eruby 17.210000 0.360000 17.570000 ( 18.836510)
|
|
|
2391
2799
|
Context data string in YAML inline style or Ruby code.
|
|
2392
2800
|
</dd>
|
|
2393
2801
|
<dt class="dt3"><b>
|
|
2394
|
-
-
|
|
2802
|
+
-T </b></dt>
|
|
2395
2803
|
<dd class="dd3">
|
|
2396
|
-
|
|
2804
|
+
Don't expand tab characters in YAML file.
|
|
2397
2805
|
</dd>
|
|
2398
2806
|
<dt class="dt3"><b>
|
|
2399
2807
|
-S </b></dt>
|