erubis 2.1.0 → 2.2.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/{ChangeLog → CHANGES} +139 -6
- data/MIT-LICENSE +20 -0
- data/README.txt +20 -5
- data/benchmark/erubybench.rb +465 -229
- data/benchmark/erubybench.rhtml +39 -15
- data/benchmark/erubybench.yaml +126 -46
- data/bin/erubis +2 -2
- data/bin/notext +3 -3
- data/contrib/action_view_base_rb.patch +23 -0
- data/contrib/erubis +466 -308
- data/contrib/inline-require +2 -2
- data/doc-api/classes/ERB.html +101 -0
- data/doc-api/classes/Erubis.html +59 -6
- data/doc-api/classes/Erubis/ArrayEnhancer.html +12 -12
- data/doc-api/classes/Erubis/Basic/Converter.html +61 -57
- 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 +125 -29
- data/doc-api/classes/Erubis/Converter.html +73 -22
- data/doc-api/classes/Erubis/Engine.html +55 -39
- data/doc-api/classes/Erubis/EscapeEnhancer.html +6 -6
- data/doc-api/classes/Erubis/Evaluator.html +19 -19
- data/doc-api/classes/Erubis/Generator.html +16 -10
- data/doc-api/classes/Erubis/HeaderFooterEnhancer.html +14 -14
- data/doc-api/classes/Erubis/{Helper.html → Helpers.html} +5 -6
- data/doc-api/classes/Erubis/Helpers/RailsHelper.html +296 -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 +42 -30
- 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 +28 -81
- 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 +66 -79
- 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 +21 -21
- 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 +9 -9
- data/doc-api/classes/Erubis/SimplifyEnhancer.html +7 -6
- data/doc-api/classes/Erubis/StdoutEnhancer.html +12 -12
- data/doc-api/classes/Erubis/StringBufferEnhancer.html +13 -13
- data/doc-api/classes/Erubis/TinyEruby.html +56 -68
- data/doc-api/classes/Erubis/XmlHelper.html +20 -23
- data/doc-api/created.rid +1 -1
- data/doc-api/files/{__/README_txt.html → README_txt.html} +35 -20
- 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 -3
- 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/{helper/rails_rb.html → helpers/rails_helper_rb.html} +6 -31
- data/doc-api/files/erubis/local-setting_rb.html +2 -2
- data/doc-api/files/erubis/main_rb.html +4 -2
- data/doc-api/files/erubis/tiny_rb.html +2 -2
- data/doc-api/files/erubis_rb.html +2 -2
- data/doc-api/fr_class_index.html +3 -3
- data/doc-api/fr_file_index.html +2 -2
- data/doc-api/fr_method_index.html +142 -147
- data/doc-api/index.html +1 -1
- data/doc/users-guide.html +387 -218
- data/lib/erubis.rb +21 -25
- data/lib/erubis/context.rb +34 -4
- data/lib/erubis/converter.rb +159 -115
- data/lib/erubis/engine.rb +29 -12
- 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 +2 -2
- data/lib/erubis/engine/eperl.rb +2 -2
- data/lib/erubis/engine/ephp.rb +2 -2
- data/lib/erubis/engine/eruby.rb +5 -6
- data/lib/erubis/engine/escheme.rb +2 -2
- data/lib/erubis/engine/optimized.rb +2 -2
- data/lib/erubis/enhancer.rb +33 -7
- data/lib/erubis/error.rb +2 -2
- data/lib/erubis/evaluator.rb +2 -2
- data/lib/erubis/generator.rb +6 -3
- data/lib/erubis/helper.rb +6 -23
- data/lib/erubis/helpers/rails_helper.rb +202 -0
- data/lib/erubis/local-setting.rb +4 -4
- data/lib/erubis/main.rb +90 -35
- data/lib/erubis/tiny.rb +57 -52
- data/test/assert-text-equal.rb +2 -2
- data/test/test-engines.rb +5 -5
- data/test/test-erubis.rb +173 -63
- data/test/test-main.rb +135 -27
- data/test/test-notext.rb +2 -2
- data/test/test.rb +2 -2
- data/test/testutil.rb +2 -2
- metadata +16 -16
- data/LGPL +0 -504
- data/doc-api/classes/Erubis/Helper/CachedRailsTemplate.html +0 -198
- data/doc-api/classes/Erubis/Helper/RailsTemplate.html +0 -366
- data/lib/erubis/helper/rails.rb +0 -159
|
@@ -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>Sun Feb 04 20:35:06 +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: 59 $ $Release: 2.2.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,6 +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
24
|
<a href="classes/Erubis.html">Erubis</a><br />
|
|
24
25
|
<a href="classes/Erubis/ArrayBufferEnhancer.html">Erubis::ArrayBufferEnhancer</a><br />
|
|
25
26
|
<a href="classes/Erubis/ArrayBufferEruby.html">Erubis::ArrayBufferEruby</a><br />
|
|
@@ -55,9 +56,8 @@
|
|
|
55
56
|
<a href="classes/Erubis/Generator.html">Erubis::Generator</a><br />
|
|
56
57
|
<a href="classes/Erubis/HeaderFooterEnhancer.html">Erubis::HeaderFooterEnhancer</a><br />
|
|
57
58
|
<a href="classes/Erubis/HeaderFooterEruby.html">Erubis::HeaderFooterEruby</a><br />
|
|
58
|
-
<a href="classes/Erubis/
|
|
59
|
-
<a href="classes/Erubis/
|
|
60
|
-
<a href="classes/Erubis/Helper/RailsTemplate.html">Erubis::Helper::RailsTemplate</a><br />
|
|
59
|
+
<a href="classes/Erubis/Helpers.html">Erubis::Helpers</a><br />
|
|
60
|
+
<a href="classes/Erubis/Helpers/RailsHelper.html">Erubis::Helpers::RailsHelper</a><br />
|
|
61
61
|
<a href="classes/Erubis/JavaGenerator.html">Erubis::JavaGenerator</a><br />
|
|
62
62
|
<a href="classes/Erubis/JavascriptGenerator.html">Erubis::JavascriptGenerator</a><br />
|
|
63
63
|
<a href="classes/Erubis/Main.html">Erubis::Main</a><br />
|
data/doc-api/fr_file_index.html
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
<div id="index">
|
|
21
21
|
<h1 class="section-bar">Files</h1>
|
|
22
22
|
<div id="index-entries">
|
|
23
|
-
<a href="files/
|
|
23
|
+
<a href="files/README_txt.html">README.txt</a><br />
|
|
24
24
|
<a href="files/erubis_rb.html">erubis.rb</a><br />
|
|
25
25
|
<a href="files/erubis/context_rb.html">erubis/context.rb</a><br />
|
|
26
26
|
<a href="files/erubis/converter_rb.html">erubis/converter.rb</a><br />
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
<a href="files/erubis/evaluator_rb.html">erubis/evaluator.rb</a><br />
|
|
40
40
|
<a href="files/erubis/generator_rb.html">erubis/generator.rb</a><br />
|
|
41
41
|
<a href="files/erubis/helper_rb.html">erubis/helper.rb</a><br />
|
|
42
|
-
<a href="files/erubis/
|
|
42
|
+
<a href="files/erubis/helpers/rails_helper_rb.html">erubis/helpers/rails_helper.rb</a><br />
|
|
43
43
|
<a href="files/erubis/local-setting_rb.html">erubis/local-setting.rb</a><br />
|
|
44
44
|
<a href="files/erubis/main_rb.html">erubis/main.rb</a><br />
|
|
45
45
|
<a href="files/erubis/tiny_rb.html">erubis/tiny.rb</a><br />
|
|
@@ -20,184 +20,179 @@
|
|
|
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/
|
|
26
|
-
<a href="classes/Erubis/Helper/RailsTemplate.html#M000151">_evaluate_string (Erubis::Helper::RailsTemplate)</a><br />
|
|
27
|
-
<a href="classes/Erubis/Helper/RailsTemplate.html#M000150">_localvar_code (Erubis::Helper::RailsTemplate)</a><br />
|
|
23
|
+
<a href="classes/Erubis/Context.html#M000167">[] (Erubis::Context)</a><br />
|
|
24
|
+
<a href="classes/Erubis/Context.html#M000168">[]= (Erubis::Context)</a><br />
|
|
25
|
+
<a href="classes/Erubis/EscapeEnhancer.html#M000089">add_expr (Erubis::EscapeEnhancer)</a><br />
|
|
28
26
|
<a href="classes/Erubis/NoCodeEnhancer.html#M000004">add_expr (Erubis::NoCodeEnhancer)</a><br />
|
|
29
|
-
<a href="classes/Erubis/
|
|
30
|
-
<a href="classes/Erubis/
|
|
31
|
-
<a href="classes/Erubis/
|
|
32
|
-
<a href="classes/Erubis/PhpGenerator.html#M000104">add_expr_debug (Erubis::PhpGenerator)</a><br />
|
|
33
|
-
<a href="classes/Erubis/SchemeGenerator.html#M000027">add_expr_debug (Erubis::SchemeGenerator)</a><br />
|
|
34
|
-
<a href="classes/Erubis/OptimizedGenerator.html#M000096">add_expr_debug (Erubis::OptimizedGenerator)</a><br />
|
|
27
|
+
<a href="classes/Erubis/Basic/Converter.html#M000054">add_expr (Erubis::Basic::Converter)</a><br />
|
|
28
|
+
<a href="classes/Erubis/OptimizedXmlEruby.html#M000173">add_expr_debug (Erubis::OptimizedXmlEruby)</a><br />
|
|
29
|
+
<a href="classes/Erubis/CGenerator.html#M000119">add_expr_debug (Erubis::CGenerator)</a><br />
|
|
35
30
|
<a href="classes/Erubis/RubyGenerator.html#M000036">add_expr_debug (Erubis::RubyGenerator)</a><br />
|
|
36
|
-
<a href="classes/Erubis/
|
|
37
|
-
<a href="classes/Erubis/
|
|
31
|
+
<a href="classes/Erubis/PerlGenerator.html#M000066">add_expr_debug (Erubis::PerlGenerator)</a><br />
|
|
32
|
+
<a href="classes/Erubis/SchemeGenerator.html#M000027">add_expr_debug (Erubis::SchemeGenerator)</a><br />
|
|
33
|
+
<a href="classes/Erubis/JavascriptGenerator.html#M000134">add_expr_debug (Erubis::JavascriptGenerator)</a><br />
|
|
34
|
+
<a href="classes/Erubis/OptimizedGenerator.html#M000100">add_expr_debug (Erubis::OptimizedGenerator)</a><br />
|
|
35
|
+
<a href="classes/Erubis/PhpGenerator.html#M000108">add_expr_debug (Erubis::PhpGenerator)</a><br />
|
|
38
36
|
<a href="classes/Erubis/Generator.html#M000016">add_expr_debug (Erubis::Generator)</a><br />
|
|
39
|
-
<a href="classes/Erubis/
|
|
40
|
-
<a href="classes/Erubis/PerlGenerator.html#M000069">add_expr_debug (Erubis::PerlGenerator)</a><br />
|
|
41
|
-
<a href="classes/Erubis/PrintOutEnhancer.html#M000083">add_expr_escaped (Erubis::PrintOutEnhancer)</a><br />
|
|
42
|
-
<a href="classes/Erubis/JavascriptGenerator.html#M000129">add_expr_escaped (Erubis::JavascriptGenerator)</a><br />
|
|
43
|
-
<a href="classes/Erubis/PhpGenerator.html#M000103">add_expr_escaped (Erubis::PhpGenerator)</a><br />
|
|
37
|
+
<a href="classes/Erubis/JavaGenerator.html#M000143">add_expr_debug (Erubis::JavaGenerator)</a><br />
|
|
44
38
|
<a href="classes/Erubis/Generator.html#M000015">add_expr_escaped (Erubis::Generator)</a><br />
|
|
45
|
-
<a href="classes/Erubis/JavaGenerator.html#M000138">add_expr_escaped (Erubis::JavaGenerator)</a><br />
|
|
46
39
|
<a href="classes/Erubis/RubyGenerator.html#M000035">add_expr_escaped (Erubis::RubyGenerator)</a><br />
|
|
47
|
-
<a href="classes/Erubis/
|
|
40
|
+
<a href="classes/Erubis/PrintOutEnhancer.html#M000087">add_expr_escaped (Erubis::PrintOutEnhancer)</a><br />
|
|
41
|
+
<a href="classes/Erubis/JavaGenerator.html#M000142">add_expr_escaped (Erubis::JavaGenerator)</a><br />
|
|
42
|
+
<a href="classes/Erubis/PhpGenerator.html#M000107">add_expr_escaped (Erubis::PhpGenerator)</a><br />
|
|
43
|
+
<a href="classes/Erubis/PerlGenerator.html#M000065">add_expr_escaped (Erubis::PerlGenerator)</a><br />
|
|
44
|
+
<a href="classes/Erubis/JavascriptGenerator.html#M000133">add_expr_escaped (Erubis::JavascriptGenerator)</a><br />
|
|
45
|
+
<a href="classes/Erubis/CGenerator.html#M000118">add_expr_escaped (Erubis::CGenerator)</a><br />
|
|
46
|
+
<a href="classes/Erubis/OptimizedGenerator.html#M000099">add_expr_escaped (Erubis::OptimizedGenerator)</a><br />
|
|
48
47
|
<a href="classes/Erubis/SchemeGenerator.html#M000026">add_expr_escaped (Erubis::SchemeGenerator)</a><br />
|
|
49
|
-
<a href="classes/Erubis/OptimizedGenerator.html#M000095">add_expr_escaped (Erubis::OptimizedGenerator)</a><br />
|
|
50
|
-
<a href="classes/Erubis/CGenerator.html#M000114">add_expr_escaped (Erubis::CGenerator)</a><br />
|
|
51
|
-
<a href="classes/Erubis/JavaGenerator.html#M000137">add_expr_literal (Erubis::JavaGenerator)</a><br />
|
|
52
|
-
<a href="classes/Erubis/CGenerator.html#M000113">add_expr_literal (Erubis::CGenerator)</a><br />
|
|
53
48
|
<a href="classes/Erubis/SchemeGenerator.html#M000025">add_expr_literal (Erubis::SchemeGenerator)</a><br />
|
|
54
|
-
<a href="classes/Erubis/
|
|
55
|
-
<a href="classes/Erubis/
|
|
56
|
-
<a href="classes/Erubis/
|
|
49
|
+
<a href="classes/Erubis/OptimizedGenerator.html#M000098">add_expr_literal (Erubis::OptimizedGenerator)</a><br />
|
|
50
|
+
<a href="classes/Erubis/CGenerator.html#M000117">add_expr_literal (Erubis::CGenerator)</a><br />
|
|
51
|
+
<a href="classes/Erubis/PhpGenerator.html#M000106">add_expr_literal (Erubis::PhpGenerator)</a><br />
|
|
52
|
+
<a href="classes/Erubis/JavascriptGenerator.html#M000132">add_expr_literal (Erubis::JavascriptGenerator)</a><br />
|
|
53
|
+
<a href="classes/Erubis/JavaGenerator.html#M000141">add_expr_literal (Erubis::JavaGenerator)</a><br />
|
|
57
54
|
<a href="classes/Erubis/Generator.html#M000014">add_expr_literal (Erubis::Generator)</a><br />
|
|
58
|
-
<a href="classes/Erubis/PrintOutEnhancer.html#
|
|
59
|
-
<a href="classes/Erubis/
|
|
60
|
-
<a href="classes/Erubis/PerlGenerator.html#
|
|
61
|
-
<a href="classes/Erubis/JavascriptGenerator.html#
|
|
62
|
-
<a href="classes/Erubis/PhpGenerator.html#
|
|
63
|
-
<a href="classes/Erubis/
|
|
55
|
+
<a href="classes/Erubis/PrintOutEnhancer.html#M000086">add_expr_literal (Erubis::PrintOutEnhancer)</a><br />
|
|
56
|
+
<a href="classes/Erubis/RubyGenerator.html#M000034">add_expr_literal (Erubis::RubyGenerator)</a><br />
|
|
57
|
+
<a href="classes/Erubis/PerlGenerator.html#M000064">add_expr_literal (Erubis::PerlGenerator)</a><br />
|
|
58
|
+
<a href="classes/Erubis/JavascriptGenerator.html#M000129">add_indent (Erubis::JavascriptGenerator)</a><br />
|
|
59
|
+
<a href="classes/Erubis/PhpGenerator.html#M000110">add_postamble (Erubis::PhpGenerator)</a><br />
|
|
60
|
+
<a href="classes/Erubis/CGenerator.html#M000120">add_postamble (Erubis::CGenerator)</a><br />
|
|
64
61
|
<a href="classes/Erubis/Generator.html#M000017">add_postamble (Erubis::Generator)</a><br />
|
|
65
|
-
<a href="classes/Erubis/JavascriptGenerator.html#M000131">add_postamble (Erubis::JavascriptGenerator)</a><br />
|
|
66
|
-
<a href="classes/Erubis/PerlGenerator.html#M000071">add_postamble (Erubis::PerlGenerator)</a><br />
|
|
67
|
-
<a href="classes/Erubis/StdoutEnhancer.html#M000062">add_postamble (Erubis::StdoutEnhancer)</a><br />
|
|
68
|
-
<a href="classes/Erubis/CGenerator.html#M000116">add_postamble (Erubis::CGenerator)</a><br />
|
|
69
62
|
<a href="classes/Erubis/SchemeGenerator.html#M000028">add_postamble (Erubis::SchemeGenerator)</a><br />
|
|
70
|
-
<a href="classes/Erubis/
|
|
63
|
+
<a href="classes/Erubis/JavascriptGenerator.html#M000135">add_postamble (Erubis::JavascriptGenerator)</a><br />
|
|
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 />
|
|
71
67
|
<a href="classes/Erubis/ArrayBufferEnhancer.html#M000007">add_postamble (Erubis::ArrayBufferEnhancer)</a><br />
|
|
72
|
-
<a href="classes/Erubis/
|
|
73
|
-
<a href="classes/Erubis/
|
|
74
|
-
<a href="classes/Erubis/
|
|
75
|
-
<a href="classes/Erubis/
|
|
68
|
+
<a href="classes/Erubis/JavaGenerator.html#M000144">add_postamble (Erubis::JavaGenerator)</a><br />
|
|
69
|
+
<a href="classes/Erubis/PrintOutEnhancer.html#M000088">add_postamble (Erubis::PrintOutEnhancer)</a><br />
|
|
70
|
+
<a href="classes/Erubis/OptimizedGenerator.html#M000101">add_postamble (Erubis::OptimizedGenerator)</a><br />
|
|
71
|
+
<a href="classes/Erubis/StringBufferEnhancer.html#M000152">add_postamble (Erubis::StringBufferEnhancer)</a><br />
|
|
72
|
+
<a href="classes/Erubis/ArrayEnhancer.html#M000148">add_postamble (Erubis::ArrayEnhancer)</a><br />
|
|
76
73
|
<a href="classes/Erubis/Generator.html#M000011">add_preamble (Erubis::Generator)</a><br />
|
|
77
|
-
<a href="classes/Erubis/OptimizedGenerator.html#
|
|
78
|
-
<a href="classes/Erubis/StringBufferEnhancer.html#
|
|
79
|
-
<a href="classes/Erubis/ArrayEnhancer.html#
|
|
80
|
-
<a href="classes/Erubis/PhpGenerator.html#
|
|
74
|
+
<a href="classes/Erubis/OptimizedGenerator.html#M000095">add_preamble (Erubis::OptimizedGenerator)</a><br />
|
|
75
|
+
<a href="classes/Erubis/StringBufferEnhancer.html#M000151">add_preamble (Erubis::StringBufferEnhancer)</a><br />
|
|
76
|
+
<a href="classes/Erubis/ArrayEnhancer.html#M000147">add_preamble (Erubis::ArrayEnhancer)</a><br />
|
|
77
|
+
<a href="classes/Erubis/PhpGenerator.html#M000103">add_preamble (Erubis::PhpGenerator)</a><br />
|
|
81
78
|
<a href="classes/Erubis/SchemeGenerator.html#M000020">add_preamble (Erubis::SchemeGenerator)</a><br />
|
|
82
79
|
<a href="classes/Erubis/ArrayBufferEnhancer.html#M000006">add_preamble (Erubis::ArrayBufferEnhancer)</a><br />
|
|
83
|
-
<a href="classes/Erubis/StdoutEnhancer.html#
|
|
84
|
-
<a href="classes/Erubis/JavaGenerator.html#
|
|
85
|
-
<a href="classes/Erubis/PrintOutEnhancer.html#
|
|
86
|
-
<a href="classes/Erubis/PerlGenerator.html#
|
|
87
|
-
<a href="classes/Erubis/CGenerator.html#
|
|
88
|
-
<a href="classes/Erubis/
|
|
89
|
-
<a href="classes/Erubis/
|
|
80
|
+
<a href="classes/Erubis/StdoutEnhancer.html#M000058">add_preamble (Erubis::StdoutEnhancer)</a><br />
|
|
81
|
+
<a href="classes/Erubis/JavaGenerator.html#M000137">add_preamble (Erubis::JavaGenerator)</a><br />
|
|
82
|
+
<a href="classes/Erubis/PrintOutEnhancer.html#M000084">add_preamble (Erubis::PrintOutEnhancer)</a><br />
|
|
83
|
+
<a href="classes/Erubis/PerlGenerator.html#M000061">add_preamble (Erubis::PerlGenerator)</a><br />
|
|
84
|
+
<a href="classes/Erubis/CGenerator.html#M000112">add_preamble (Erubis::CGenerator)</a><br />
|
|
85
|
+
<a href="classes/Erubis/PrintEnabledEnhancer.html#M000123">add_preamble (Erubis::PrintEnabledEnhancer)</a><br />
|
|
86
|
+
<a href="classes/Erubis/JavascriptGenerator.html#M000127">add_preamble (Erubis::JavascriptGenerator)</a><br />
|
|
90
87
|
<a href="classes/Erubis/NoCodeEnhancer.html#M000001">add_preamble (Erubis::NoCodeEnhancer)</a><br />
|
|
91
|
-
<a href="classes/Erubis/
|
|
92
|
-
<a href="classes/Erubis/
|
|
88
|
+
<a href="classes/Erubis/OptimizedGenerator.html#M000097">add_stmt (Erubis::OptimizedGenerator)</a><br />
|
|
89
|
+
<a href="classes/Erubis/PerlGenerator.html#M000067">add_stmt (Erubis::PerlGenerator)</a><br />
|
|
90
|
+
<a href="classes/Erubis/PhpGenerator.html#M000109">add_stmt (Erubis::PhpGenerator)</a><br />
|
|
91
|
+
<a href="classes/Erubis/NoCodeEnhancer.html#M000005">add_stmt (Erubis::NoCodeEnhancer)</a><br />
|
|
92
|
+
<a href="classes/Erubis/CGenerator.html#M000116">add_stmt (Erubis::CGenerator)</a><br />
|
|
93
|
+
<a href="classes/Erubis/RubyGenerator.html#M000033">add_stmt (Erubis::RubyGenerator)</a><br />
|
|
93
94
|
<a href="classes/Erubis/SchemeGenerator.html#M000024">add_stmt (Erubis::SchemeGenerator)</a><br />
|
|
94
95
|
<a href="classes/Erubis/Generator.html#M000013">add_stmt (Erubis::Generator)</a><br />
|
|
95
|
-
<a href="classes/Erubis/
|
|
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/PhpGenerator.html#M000105">add_stmt (Erubis::PhpGenerator)</a><br />
|
|
101
|
-
<a href="classes/Erubis/PrintOutEnhancer.html#M000081">add_text (Erubis::PrintOutEnhancer)</a><br />
|
|
102
|
-
<a href="classes/Erubis/HeaderFooterEnhancer.html#M000078">add_text (Erubis::HeaderFooterEnhancer)</a><br />
|
|
96
|
+
<a href="classes/Erubis/JavaGenerator.html#M000140">add_stmt (Erubis::JavaGenerator)</a><br />
|
|
97
|
+
<a href="classes/Erubis/JavascriptGenerator.html#M000131">add_stmt (Erubis::JavascriptGenerator)</a><br />
|
|
98
|
+
<a href="classes/Erubis/SchemeGenerator.html#M000023">add_text (Erubis::SchemeGenerator)</a><br />
|
|
99
|
+
<a href="classes/Erubis/JavaGenerator.html#M000139">add_text (Erubis::JavaGenerator)</a><br />
|
|
100
|
+
<a href="classes/Erubis/PercentLineEnhancer.html#M000145">add_text (Erubis::PercentLineEnhancer)</a><br />
|
|
103
101
|
<a href="classes/Erubis/RubyGenerator.html#M000032">add_text (Erubis::RubyGenerator)</a><br />
|
|
104
|
-
<a href="classes/Erubis/
|
|
102
|
+
<a href="classes/Erubis/NoTextEnhancer.html#M000146">add_text (Erubis::NoTextEnhancer)</a><br />
|
|
103
|
+
<a href="classes/Erubis/BiPatternEnhancer.html#M000122">add_text (Erubis::BiPatternEnhancer)</a><br />
|
|
104
|
+
<a href="classes/Erubis/HeaderFooterEnhancer.html#M000082">add_text (Erubis::HeaderFooterEnhancer)</a><br />
|
|
105
|
+
<a href="classes/Erubis/OptimizedGenerator.html#M000096">add_text (Erubis::OptimizedGenerator)</a><br />
|
|
105
106
|
<a href="classes/Erubis/Generator.html#M000012">add_text (Erubis::Generator)</a><br />
|
|
106
|
-
<a href="classes/Erubis/
|
|
107
|
-
<a href="classes/Erubis/CGenerator.html#
|
|
108
|
-
<a href="classes/Erubis/PercentLineEnhancer.html#M000152">add_text (Erubis::PercentLineEnhancer)</a><br />
|
|
109
|
-
<a href="classes/Erubis/PhpGenerator.html#M000101">add_text (Erubis::PhpGenerator)</a><br />
|
|
107
|
+
<a href="classes/Erubis/PrintOutEnhancer.html#M000085">add_text (Erubis::PrintOutEnhancer)</a><br />
|
|
108
|
+
<a href="classes/Erubis/CGenerator.html#M000115">add_text (Erubis::CGenerator)</a><br />
|
|
110
109
|
<a href="classes/Erubis/NoCodeEnhancer.html#M000003">add_text (Erubis::NoCodeEnhancer)</a><br />
|
|
111
|
-
<a href="classes/Erubis/
|
|
112
|
-
<a href="classes/Erubis/
|
|
113
|
-
<a href="classes/Erubis/
|
|
114
|
-
<a href="classes/Erubis/OptimizedGenerator.html#M000092">add_text (Erubis::OptimizedGenerator)</a><br />
|
|
115
|
-
<a href="classes/Erubis/BiPatternEnhancer.html#M000118">add_text (Erubis::BiPatternEnhancer)</a><br />
|
|
116
|
-
<a href="classes/Erubis/PI/TinyEruby.html#M000046">convert (Erubis::PI::TinyEruby)</a><br />
|
|
110
|
+
<a href="classes/Erubis/PhpGenerator.html#M000105">add_text (Erubis::PhpGenerator)</a><br />
|
|
111
|
+
<a href="classes/Erubis/PerlGenerator.html#M000063">add_text (Erubis::PerlGenerator)</a><br />
|
|
112
|
+
<a href="classes/Erubis/JavascriptGenerator.html#M000130">add_text (Erubis::JavascriptGenerator)</a><br />
|
|
117
113
|
<a href="classes/Erubis/PI/Converter.html#M000038">convert (Erubis::PI::Converter)</a><br />
|
|
118
|
-
<a href="classes/Erubis/
|
|
119
|
-
<a href="classes/Erubis/
|
|
120
|
-
<a href="classes/Erubis/
|
|
121
|
-
<a href="classes/Erubis/HeaderFooterEnhancer.html#M000079">convert (Erubis::HeaderFooterEnhancer)</a><br />
|
|
114
|
+
<a href="classes/Erubis/HeaderFooterEnhancer.html#M000083">convert (Erubis::HeaderFooterEnhancer)</a><br />
|
|
115
|
+
<a href="classes/Erubis/PI/TinyEruby.html#M000044">convert (Erubis::PI::TinyEruby)</a><br />
|
|
116
|
+
<a href="classes/Erubis/Converter.html#M000070">convert (Erubis::Converter)</a><br />
|
|
122
117
|
<a href="classes/Erubis/SimplifyEnhancer.html#M000018">convert (Erubis::SimplifyEnhancer)</a><br />
|
|
123
|
-
<a href="classes/Erubis/
|
|
124
|
-
<a href="classes/Erubis/
|
|
125
|
-
<a href="classes/Erubis/
|
|
118
|
+
<a href="classes/Erubis/TinyEruby.html#M000154">convert (Erubis::TinyEruby)</a><br />
|
|
119
|
+
<a href="classes/Erubis/Engine.html#M000158">convert! (Erubis::Engine)</a><br />
|
|
120
|
+
<a href="classes/Erubis/Converter.html#M000072">convert_input (Erubis::Converter)</a><br />
|
|
121
|
+
<a href="classes/Erubis/Basic/Converter.html#M000053">convert_input (Erubis::Basic::Converter)</a><br />
|
|
126
122
|
<a href="classes/Erubis/PI/Converter.html#M000039">convert_input (Erubis::PI::Converter)</a><br />
|
|
127
|
-
<a href="classes/Erubis/
|
|
128
|
-
<a href="classes/Erubis/
|
|
129
|
-
<a href="classes/Erubis/
|
|
130
|
-
<a href="classes/Erubis/
|
|
131
|
-
<a href="classes/Erubis/
|
|
132
|
-
<a href="classes/Erubis/
|
|
133
|
-
<a href="classes/Erubis/
|
|
134
|
-
<a href="classes/Erubis/CGenerator.html#M000109">escape_text (Erubis::CGenerator)</a><br />
|
|
135
|
-
<a href="classes/Erubis/PhpGenerator.html#M000100">escape_text (Erubis::PhpGenerator)</a><br />
|
|
123
|
+
<a href="classes/Erubis/Converter.html#M000071">detect_spaces_at_bol (Erubis::Converter)</a><br />
|
|
124
|
+
<a href="classes/Erubis/Context.html#M000170">each (Erubis::Context)</a><br />
|
|
125
|
+
<a href="classes/Erubis/Helpers/RailsHelper.html#M000073">engine_class (Erubis::Helpers::RailsHelper)</a><br />
|
|
126
|
+
<a href="classes/Erubis/Helpers/RailsHelper.html#M000074">engine_class= (Erubis::Helpers::RailsHelper)</a><br />
|
|
127
|
+
<a href="classes/Erubis/PerlGenerator.html#M000062">escape_text (Erubis::PerlGenerator)</a><br />
|
|
128
|
+
<a href="classes/Erubis/PhpGenerator.html#M000104">escape_text (Erubis::PhpGenerator)</a><br />
|
|
129
|
+
<a href="classes/Erubis/CGenerator.html#M000113">escape_text (Erubis::CGenerator)</a><br />
|
|
136
130
|
<a href="classes/Erubis/SchemeGenerator.html#M000021">escape_text (Erubis::SchemeGenerator)</a><br />
|
|
137
|
-
<a href="classes/Erubis/PerlGenerator.html#M000065">escape_text (Erubis::PerlGenerator)</a><br />
|
|
138
131
|
<a href="classes/Erubis/RubyGenerator.html#M000030">escape_text (Erubis::RubyGenerator)</a><br />
|
|
139
|
-
<a href="classes/Erubis/
|
|
140
|
-
<a href="classes/Erubis/
|
|
141
|
-
<a href="classes/Erubis/
|
|
142
|
-
<a href="classes/Erubis/
|
|
143
|
-
<a href="classes/Erubis/
|
|
132
|
+
<a href="classes/Erubis/JavascriptGenerator.html#M000128">escape_text (Erubis::JavascriptGenerator)</a><br />
|
|
133
|
+
<a href="classes/Erubis/Generator.html#M000009">escape_text (Erubis::Generator)</a><br />
|
|
134
|
+
<a href="classes/Erubis/JavaGenerator.html#M000138">escape_text (Erubis::JavaGenerator)</a><br />
|
|
135
|
+
<a href="classes/Erubis/OptimizedGenerator.html#M000091">escape_text (Erubis::OptimizedGenerator)</a><br />
|
|
136
|
+
<a href="classes/Erubis/XmlHelper.html#M000079">escape_xml (Erubis::XmlHelper)</a><br />
|
|
144
137
|
<a href="classes/Erubis/SchemeGenerator.html#M000022">escaped_expr (Erubis::SchemeGenerator)</a><br />
|
|
145
|
-
<a href="classes/Erubis/
|
|
138
|
+
<a href="classes/Erubis/OptimizedGenerator.html#M000092">escaped_expr (Erubis::OptimizedGenerator)</a><br />
|
|
139
|
+
<a href="classes/Erubis/CGenerator.html#M000114">escaped_expr (Erubis::CGenerator)</a><br />
|
|
140
|
+
<a href="classes/Erubis/Generator.html#M000010">escaped_expr (Erubis::Generator)</a><br />
|
|
146
141
|
<a href="classes/Erubis/RubyGenerator.html#M000031">escaped_expr (Erubis::RubyGenerator)</a><br />
|
|
147
|
-
<a href="classes/Erubis/
|
|
148
|
-
<a href="classes/Erubis/
|
|
149
|
-
<a href="classes/Erubis/PrintEnabledEnhancer.html#
|
|
150
|
-
<a href="classes/Erubis/
|
|
151
|
-
<a href="classes/Erubis/
|
|
152
|
-
<a href="classes/Erubis/
|
|
153
|
-
<a href="classes/Erubis/
|
|
154
|
-
<a href="classes/Erubis/XmlHelper.html#
|
|
155
|
-
<a href="classes/Erubis/
|
|
156
|
-
<a href="classes/Erubis/OptimizedEruby.html#M000170">init_converter (Erubis::OptimizedEruby)</a><br />
|
|
157
|
-
<a href="classes/Erubis/PI/Ephp.html#M000044">init_converter (Erubis::PI::Ephp)</a><br />
|
|
142
|
+
<a href="classes/Erubis/RubyEvaluator.html#M000150">evaluate (Erubis::RubyEvaluator)</a><br />
|
|
143
|
+
<a href="classes/Erubis/Evaluator.html#M000057">evaluate (Erubis::Evaluator)</a><br />
|
|
144
|
+
<a href="classes/Erubis/PrintEnabledEnhancer.html#M000125">evaluate (Erubis::PrintEnabledEnhancer)</a><br />
|
|
145
|
+
<a href="classes/Erubis/TinyEruby.html#M000156">evaluate (Erubis::TinyEruby)</a><br />
|
|
146
|
+
<a href="classes/Erubis/PI/TinyEruby.html#M000046">evaluate (Erubis::PI::TinyEruby)</a><br />
|
|
147
|
+
<a href="classes/Erubis/Main.html#M000165">execute (Erubis::Main)</a><br />
|
|
148
|
+
<a href="classes/Erubis/XmlHelper.html#M000080">h (Erubis::XmlHelper)</a><br />
|
|
149
|
+
<a href="classes/Erubis/XmlHelper.html#M000081">html_escape (Erubis::XmlHelper)</a><br />
|
|
150
|
+
<a href="classes/Erubis/PI/Ejavascript.html#M000040">init_converter (Erubis::PI::Ejavascript)</a><br />
|
|
158
151
|
<a href="classes/Erubis/PI/Converter.html#M000037">init_converter (Erubis::PI::Converter)</a><br />
|
|
159
|
-
<a href="classes/Erubis/
|
|
160
|
-
<a href="classes/Erubis/PI/
|
|
161
|
-
<a href="classes/Erubis/
|
|
162
|
-
<a href="classes/Erubis/PI/
|
|
163
|
-
<a href="classes/Erubis/
|
|
164
|
-
<a href="classes/Erubis/
|
|
165
|
-
<a href="classes/Erubis/PI/
|
|
166
|
-
<a href="classes/Erubis/PI/
|
|
167
|
-
<a href="classes/Erubis/
|
|
168
|
-
<a href="classes/Erubis/
|
|
152
|
+
<a href="classes/Erubis/Converter.html#M000069">init_converter (Erubis::Converter)</a><br />
|
|
153
|
+
<a href="classes/Erubis/PI/Ephp.html#M000042">init_converter (Erubis::PI::Ephp)</a><br />
|
|
154
|
+
<a href="classes/Erubis/Basic/Converter.html#M000051">init_converter (Erubis::Basic::Converter)</a><br />
|
|
155
|
+
<a href="classes/Erubis/PI/Escheme.html#M000050">init_converter (Erubis::PI::Escheme)</a><br />
|
|
156
|
+
<a href="classes/Erubis/OptimizedEruby.html#M000162">init_converter (Erubis::OptimizedEruby)</a><br />
|
|
157
|
+
<a href="classes/Erubis/PI/Ec.html#M000048">init_converter (Erubis::PI::Ec)</a><br />
|
|
158
|
+
<a href="classes/Erubis/PI/Eperl.html#M000047">init_converter (Erubis::PI::Eperl)</a><br />
|
|
159
|
+
<a href="classes/Erubis/PI/Ejava.html#M000041">init_converter (Erubis::PI::Ejava)</a><br />
|
|
160
|
+
<a href="classes/Erubis/PI/Eruby.html#M000049">init_converter (Erubis::PI::Eruby)</a><br />
|
|
161
|
+
<a href="classes/Erubis/Evaluator.html#M000055">init_evaluator (Erubis::Evaluator)</a><br />
|
|
162
|
+
<a href="classes/Erubis/PhpGenerator.html#M000102">init_generator (Erubis::PhpGenerator)</a><br />
|
|
169
163
|
<a href="classes/Erubis/Generator.html#M000008">init_generator (Erubis::Generator)</a><br />
|
|
170
|
-
<a href="classes/Erubis/PhpGenerator.html#M000098">init_generator (Erubis::PhpGenerator)</a><br />
|
|
171
|
-
<a href="classes/Erubis/PerlGenerator.html#M000063">init_generator (Erubis::PerlGenerator)</a><br />
|
|
172
|
-
<a href="classes/Erubis/JavascriptGenerator.html#M000122">init_generator (Erubis::JavascriptGenerator)</a><br />
|
|
173
|
-
<a href="classes/Erubis/JavaGenerator.html#M000132">init_generator (Erubis::JavaGenerator)</a><br />
|
|
174
|
-
<a href="classes/Erubis/OptimizedGenerator.html#M000086">init_generator (Erubis::OptimizedGenerator)</a><br />
|
|
175
164
|
<a href="classes/Erubis/SchemeGenerator.html#M000019">init_generator (Erubis::SchemeGenerator)</a><br />
|
|
165
|
+
<a href="classes/Erubis/JavaGenerator.html#M000136">init_generator (Erubis::JavaGenerator)</a><br />
|
|
166
|
+
<a href="classes/Erubis/OptimizedGenerator.html#M000090">init_generator (Erubis::OptimizedGenerator)</a><br />
|
|
167
|
+
<a href="classes/Erubis/JavascriptGenerator.html#M000126">init_generator (Erubis::JavascriptGenerator)</a><br />
|
|
168
|
+
<a href="classes/Erubis/PerlGenerator.html#M000060">init_generator (Erubis::PerlGenerator)</a><br />
|
|
169
|
+
<a href="classes/Erubis/CGenerator.html#M000111">init_generator (Erubis::CGenerator)</a><br />
|
|
176
170
|
<a href="classes/Erubis/RubyGenerator.html#M000029">init_generator (Erubis::RubyGenerator)</a><br />
|
|
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/
|
|
190
|
-
<a href="classes/Erubis/
|
|
191
|
-
<a href="classes/Erubis/Engine.html#
|
|
192
|
-
<a href="classes/Erubis/
|
|
193
|
-
<a href="classes/Erubis/
|
|
194
|
-
<a href="classes/Erubis/
|
|
195
|
-
<a href="classes/Erubis/Evaluator.html#
|
|
196
|
-
<a href="classes/Erubis/
|
|
197
|
-
<a href="classes/Erubis/
|
|
198
|
-
<a href="classes/Erubis/
|
|
199
|
-
<a href="classes/Erubis/OptimizedGenerator.html#
|
|
200
|
-
<a href="classes/Erubis/
|
|
171
|
+
<a href="classes/Erubis/Helpers/RailsHelper.html#M000075">init_properties (Erubis::Helpers::RailsHelper)</a><br />
|
|
172
|
+
<a href="classes/Erubis/Helpers/RailsHelper.html#M000076">init_properties= (Erubis::Helpers::RailsHelper)</a><br />
|
|
173
|
+
<a href="classes/Erubis/Context.html#M000169">keys (Erubis::Context)</a><br />
|
|
174
|
+
<a href="classes/Erubis/Engine.html#M000159">load_file (Erubis::Engine)</a><br />
|
|
175
|
+
<a href="classes/Erubis/Main.html#M000163">main (Erubis::Main)</a><br />
|
|
176
|
+
<a href="classes/Erubis/BiPatternEnhancer.html#M000121">new (Erubis::BiPatternEnhancer)</a><br />
|
|
177
|
+
<a href="classes/Erubis/Main.html#M000164">new (Erubis::Main)</a><br />
|
|
178
|
+
<a href="classes/Erubis/TinyEruby.html#M000153">new (Erubis::TinyEruby)</a><br />
|
|
179
|
+
<a href="classes/Erubis/PI/TinyEruby.html#M000043">new (Erubis::PI::TinyEruby)</a><br />
|
|
180
|
+
<a href="classes/Erubis/Context.html#M000166">new (Erubis::Context)</a><br />
|
|
181
|
+
<a href="classes/Erubis/Engine.html#M000157">new (Erubis::Engine)</a><br />
|
|
182
|
+
<a href="classes/Erubis/Basic/Converter.html#M000052">pattern_regexp (Erubis::Basic::Converter)</a><br />
|
|
183
|
+
<a href="classes/Erubis/PrintEnabledEnhancer.html#M000124">print (Erubis::PrintEnabledEnhancer)</a><br />
|
|
184
|
+
<a href="classes/Erubis/Engine.html#M000160">process (Erubis::Engine)</a><br />
|
|
185
|
+
<a href="classes/Erubis/Engine.html#M000161">process_proc (Erubis::Engine)</a><br />
|
|
186
|
+
<a href="classes/Erubis/RubyEvaluator.html#M000149">result (Erubis::RubyEvaluator)</a><br />
|
|
187
|
+
<a href="classes/Erubis/PI/TinyEruby.html#M000045">result (Erubis::PI::TinyEruby)</a><br />
|
|
188
|
+
<a href="classes/Erubis/TinyEruby.html#M000155">result (Erubis::TinyEruby)</a><br />
|
|
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 />
|
|
201
196
|
</div>
|
|
202
197
|
</div>
|
|
203
198
|
</body>
|
data/doc-api/index.html
CHANGED
data/doc/users-guide.html
CHANGED
|
@@ -14,16 +14,20 @@
|
|
|
14
14
|
|
|
15
15
|
<div align="left"><h1>Erubis Users' Guide</h1></div>
|
|
16
16
|
<div align="left">
|
|
17
|
-
last update: $Date:
|
|
17
|
+
last update: $Date: 2007-02-12 13:08:37 +0900 (Mon, 12 Feb 2007) $<br>
|
|
18
18
|
</div>
|
|
19
19
|
|
|
20
|
+
<p>release: 2.2.0
|
|
21
|
+
</p>
|
|
20
22
|
<a name="preface"></a>
|
|
21
23
|
<h2 class="section1">Preface</h2>
|
|
22
24
|
<p>Erubis is an implementation of eRuby.
|
|
23
25
|
It has the following features.
|
|
24
26
|
</p>
|
|
25
27
|
<ul type="disc">
|
|
26
|
-
<li>Very fast, almost
|
|
28
|
+
<li>Very fast, almost 3 times faster than ERB and about 10 percent faster than eruby (implemented in C)
|
|
29
|
+
</li>
|
|
30
|
+
<li>File caching of converted Ruby script support
|
|
27
31
|
</li>
|
|
28
32
|
<li>Auto escaping support
|
|
29
33
|
</li>
|
|
@@ -41,7 +45,7 @@ It has the following features.
|
|
|
41
45
|
</li>
|
|
42
46
|
<li>Easy to expand and customize in subclass
|
|
43
47
|
</li>
|
|
44
|
-
<li>Ruby on Rails support
|
|
48
|
+
<li><a href="#topics-rails">Ruby on Rails support</a>
|
|
45
49
|
</li>
|
|
46
50
|
</ul>
|
|
47
51
|
<p>Erubis is implemented in pure Ruby. It requires Ruby 1.8 or higher.
|
|
@@ -71,6 +75,8 @@ It has the following features.
|
|
|
71
75
|
</li>
|
|
72
76
|
<li><a href="#tut-datafile">Context Data File</a>
|
|
73
77
|
</li>
|
|
78
|
+
<li><a href="#tut-datastr">Context Data String</a>
|
|
79
|
+
</li>
|
|
74
80
|
<li><a href="#tut-preamble">Preamble and Postamble</a>
|
|
75
81
|
</li>
|
|
76
82
|
<li><a href="#tut-pi">Processing Instruction (PI) Converter</a>
|
|
@@ -125,7 +131,11 @@ It has the following features.
|
|
|
125
131
|
</li>
|
|
126
132
|
<li><a href="#topics">Other Topics</a>
|
|
127
133
|
<ul>
|
|
128
|
-
<li><a href="#topics-
|
|
134
|
+
<li><a href="#topics-syntax">Syntax Checking</a>
|
|
135
|
+
</li>
|
|
136
|
+
<li><a href="#topics-caching">File Caching</a>
|
|
137
|
+
</li>
|
|
138
|
+
<li><a href="#topics-tinyeruby">Erubis::TinyEruby class</a>
|
|
129
139
|
</li>
|
|
130
140
|
<li><a href="#topics-rails">Ruby on Rails Support</a>
|
|
131
141
|
</li>
|
|
@@ -227,14 +237,14 @@ puts <strong>eruby.result(binding())</strong> # get result
|
|
|
227
237
|
output</div>
|
|
228
238
|
<pre class="terminal">$ ruby example1.rb
|
|
229
239
|
---------- script source ---
|
|
230
|
-
_buf =
|
|
240
|
+
_buf = ''; _buf << '<ul>
|
|
231
241
|
'; for item in list
|
|
232
242
|
_buf << ' <li>'; _buf << ( item ).to_s; _buf << '</li>
|
|
233
243
|
'; end
|
|
234
244
|
|
|
235
245
|
_buf << '</ul>
|
|
236
246
|
';
|
|
237
|
-
_buf.
|
|
247
|
+
_buf.to_s
|
|
238
248
|
---------- result ----------
|
|
239
249
|
<ul>
|
|
240
250
|
<li>aaa</li>
|
|
@@ -247,14 +257,14 @@ _buf.join
|
|
|
247
257
|
<div class="terminal_caption">
|
|
248
258
|
example of command-line option '-x'</div>
|
|
249
259
|
<pre class="terminal">$ erubis <strong>-x</strong> example1.eruby
|
|
250
|
-
_buf =
|
|
260
|
+
_buf = ''; _buf << '<ul>
|
|
251
261
|
'; for item in list
|
|
252
262
|
_buf << ' <li>'; _buf << ( item ).to_s; _buf << '</li>
|
|
253
263
|
'; end
|
|
254
264
|
|
|
255
265
|
_buf << '</ul>
|
|
256
266
|
';
|
|
257
|
-
_buf.
|
|
267
|
+
_buf.to_s
|
|
258
268
|
</pre>
|
|
259
269
|
<br>
|
|
260
270
|
|
|
@@ -277,30 +287,30 @@ example2.eruby</div>
|
|
|
277
287
|
<div class="terminal_caption">
|
|
278
288
|
compiled source code</div>
|
|
279
289
|
<pre class="terminal">$ erubis -x example2.eruby
|
|
280
|
-
_buf =
|
|
290
|
+
_buf = ''; _buf << '<ul>
|
|
281
291
|
'; for item in list
|
|
282
292
|
_buf << ' <li>
|
|
283
|
-
|
|
293
|
+
'; _buf << ( item ).to_s; _buf << '
|
|
284
294
|
'; _buf << ' </li>
|
|
285
295
|
'; end
|
|
286
296
|
_buf << '</ul>
|
|
287
297
|
';
|
|
288
|
-
_buf.
|
|
298
|
+
_buf.to_s
|
|
289
299
|
</pre>
|
|
290
|
-
<p>If you want leave spaces around '<% %>', add command-line
|
|
300
|
+
<p>If you want leave spaces around '<% %>', add command-line property '--trim=false'.
|
|
291
301
|
</p>
|
|
292
302
|
<div class="terminal_caption">
|
|
293
|
-
compiled source code with command-line
|
|
294
|
-
<pre class="terminal">$ erubis -x <strong
|
|
295
|
-
_buf =
|
|
303
|
+
compiled source code with command-line property '--trim=false'</div>
|
|
304
|
+
<pre class="terminal">$ erubis -x <strong>--trim=false</strong> example2.eruby
|
|
305
|
+
_buf = ''; _buf << '<ul>
|
|
296
306
|
'; _buf << ' '; for item in list ; _buf << '
|
|
297
307
|
'; _buf << ' <li>
|
|
298
|
-
|
|
308
|
+
'; _buf << ( item ).to_s; _buf << '
|
|
299
309
|
'; _buf << ' </li>
|
|
300
310
|
'; _buf << ' '; end ; _buf << '
|
|
301
311
|
'; _buf << '</ul>
|
|
302
312
|
';
|
|
303
|
-
_buf.
|
|
313
|
+
_buf.to_s
|
|
304
314
|
</pre>
|
|
305
315
|
<p>Or add option <code>:trim=>false</code> to Erubis::Eruby.new().
|
|
306
316
|
</p>
|
|
@@ -322,15 +332,15 @@ puts eruby.result(binding()) # get result
|
|
|
322
332
|
output</div>
|
|
323
333
|
<pre class="terminal">$ ruby example2.rb
|
|
324
334
|
---------- script source ---
|
|
325
|
-
_buf =
|
|
335
|
+
_buf = ''; _buf << '<ul>
|
|
326
336
|
'; _buf << ' '; for item in list ; _buf << '
|
|
327
337
|
'; _buf << ' <li>
|
|
328
|
-
|
|
338
|
+
'; _buf << ( item ).to_s; _buf << '
|
|
329
339
|
'; _buf << ' </li>
|
|
330
340
|
'; _buf << ' '; end ; _buf << '
|
|
331
341
|
'; _buf << '</ul>
|
|
332
342
|
';
|
|
333
|
-
_buf.
|
|
343
|
+
_buf.to_s
|
|
334
344
|
---------- result ----------
|
|
335
345
|
<ul>
|
|
336
346
|
|
|
@@ -353,7 +363,7 @@ _buf.join
|
|
|
353
363
|
|
|
354
364
|
<a name="tut-escape"></a>
|
|
355
365
|
<h3 class="section2">Escape</h3>
|
|
356
|
-
<p>Erubis
|
|
366
|
+
<p>Erubis has ability to escape (sanitize) expression.
|
|
357
367
|
Erubis::Eruby class act as the following:
|
|
358
368
|
</p>
|
|
359
369
|
<ul type="disc">
|
|
@@ -398,13 +408,13 @@ puts eruby.result(binding()) # get result
|
|
|
398
408
|
output</div>
|
|
399
409
|
<pre class="terminal">$ ruby example3.rb 2> stderr.log
|
|
400
410
|
---------- script source ---
|
|
401
|
-
_buf =
|
|
411
|
+
_buf = ''; for item in list
|
|
402
412
|
_buf << ' <p>'; <strong>_buf << Erubis::XmlHelper.escape_xml( item );</strong> _buf << '</p>
|
|
403
413
|
<p>'; <strong>_buf << ( item ).to_s;</strong> _buf << '</p>
|
|
404
414
|
<p>'; <strong>$stderr.puts("*** debug: item=#{(item).inspect}");</strong> _buf << '</p>
|
|
405
415
|
|
|
406
416
|
'; end
|
|
407
|
-
_buf.
|
|
417
|
+
_buf.to_s
|
|
408
418
|
---------- result ----------
|
|
409
419
|
<p>&lt;aaa&gt;</p>
|
|
410
420
|
<p><aaa></p>
|
|
@@ -427,13 +437,13 @@ $ cat stderr.log
|
|
|
427
437
|
This option is available for any language.
|
|
428
438
|
</p>
|
|
429
439
|
<pre class="terminal">$ erubis -l ruby <strong>-e</strong> example3.eruby
|
|
430
|
-
_buf =
|
|
440
|
+
_buf = ''; for item in list
|
|
431
441
|
_buf << ' <p>'; _buf << Erubis::XmlHelper.escape_xml( item ); _buf << '</p>
|
|
432
442
|
<p>'; _buf << ( item ).to_s; _buf << '</p>
|
|
433
443
|
<p>'; $stderr.puts("*** debug: item=#{(item).inspect}"); _buf << '</p>
|
|
434
444
|
|
|
435
445
|
'; end
|
|
436
|
-
_buf.
|
|
446
|
+
_buf.to_s
|
|
437
447
|
</pre>
|
|
438
448
|
<p>Escaping function (default 'Erubis::XmlHelper.escape_xml()') can be changed by command-line property '--escapefunc=xxx' or by overriding Erubis::Eruby#escaped_expr() in subclass.
|
|
439
449
|
</p>
|
|
@@ -475,10 +485,10 @@ example4.eruby</div>
|
|
|
475
485
|
<div class="terminal_caption">
|
|
476
486
|
compiled source code with command-line option '-p'</div>
|
|
477
487
|
<pre class="terminal">$ erubis -x <strong>-p '<!--% %-->'</strong> example4.eruby
|
|
478
|
-
_buf =
|
|
488
|
+
_buf = ''; for item in list
|
|
479
489
|
_buf << ' <p>'; _buf << ( item ).to_s; _buf << '</p>
|
|
480
490
|
'; end
|
|
481
|
-
_buf.
|
|
491
|
+
_buf.to_s
|
|
482
492
|
</pre>
|
|
483
493
|
<a name="example4.rb"></a>
|
|
484
494
|
<div class="program_caption">
|
|
@@ -499,10 +509,10 @@ puts eruby.result(binding()) # get result
|
|
|
499
509
|
output</div>
|
|
500
510
|
<pre class="terminal">$ ruby example4.rb
|
|
501
511
|
---------- script source ---
|
|
502
|
-
_buf =
|
|
512
|
+
_buf = ''; for item in list
|
|
503
513
|
_buf << ' <p>'; _buf << ( item ).to_s; _buf << '</p>
|
|
504
514
|
'; end
|
|
505
|
-
_buf.
|
|
515
|
+
_buf.to_s
|
|
506
516
|
---------- result ----------
|
|
507
517
|
<p>aaa</p>
|
|
508
518
|
<p>bbb</p>
|
|
@@ -521,7 +531,7 @@ For example, '<code><(!--)?% %(--)?></code>' will not work while '<code>&l
|
|
|
521
531
|
Using context object makes clear which data to be used.
|
|
522
532
|
In Erubis, Hash object and Erubis::Context object are available as context object.
|
|
523
533
|
</p>
|
|
524
|
-
<p>Context data can be accessible via
|
|
534
|
+
<p>Context data can be accessible via instance variables in eRuby script.
|
|
525
535
|
</p>
|
|
526
536
|
<a name="example5.eruby"></a>
|
|
527
537
|
<div class="program_caption">
|
|
@@ -546,10 +556,10 @@ eruby = Erubis::Eruby.new(input) # create Eruby object
|
|
|
546
556
|
:val => 'Erubis Example',
|
|
547
557
|
'list' => ['aaa', 'bbb', 'ccc'],
|
|
548
558
|
}</strong>
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
559
|
+
## or
|
|
560
|
+
# context = Erubis::Context.new()
|
|
561
|
+
# context['val'] = 'Erubis Example'
|
|
562
|
+
# context[:list] = ['aaa', 'bbb', 'ccc'],
|
|
553
563
|
|
|
554
564
|
puts <strong>eruby.evaluate(context)</strong> # get result
|
|
555
565
|
</pre>
|
|
@@ -564,7 +574,7 @@ output</div>
|
|
|
564
574
|
</ul>
|
|
565
575
|
</pre>
|
|
566
576
|
<p>The difference between Erubis#result(binding) and Erubis#evaluate(context) is that the former invokes 'eval @src, binding' and the latter invokes 'context.instance_eval @src'.
|
|
567
|
-
This means that data is passed into eRuby script via local
|
|
577
|
+
This means that data is passed into eRuby script via local variables when Eruby::binding() is called, or passed via instance variables when Eruby::evaluate() is called.
|
|
568
578
|
</p>
|
|
569
579
|
<p>Here is the definition of Erubis#result() and Erubis#evaluate().
|
|
570
580
|
</p>
|
|
@@ -580,14 +590,14 @@ definition of result(binding) and evaluate(context)</div>
|
|
|
580
590
|
return <strong>eval(@src, _binding)</strong>
|
|
581
591
|
end
|
|
582
592
|
|
|
583
|
-
def evaluate(
|
|
584
|
-
if
|
|
593
|
+
def evaluate(_context)
|
|
594
|
+
if _context.is_a?(Hash)
|
|
585
595
|
# convert hash object to Context object
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
596
|
+
_hash = _context
|
|
597
|
+
_context = Erubis::Context.new
|
|
598
|
+
_hash.each { |key, val| _context[key] = val }
|
|
589
599
|
end
|
|
590
|
-
return <strong>
|
|
600
|
+
return <strong>_context.instance_eval(@src)</strong>
|
|
591
601
|
end
|
|
592
602
|
</pre>
|
|
593
603
|
<p>instance_eval() is defined at Object class so it is able to use any object as a context object as well as Hash or Erubis::Context.
|
|
@@ -623,20 +633,10 @@ output</div>
|
|
|
623
633
|
|
|
624
634
|
<a name="tut-datafile"></a>
|
|
625
635
|
<h3 class="section2">Context Data File</h3>
|
|
626
|
-
<p>
|
|
636
|
+
<p>Command-line option '-f' specifies context data file.
|
|
637
|
+
Erubis load context data file and use it as context data.
|
|
638
|
+
Context data file can be YAML file ('*.yaml' or '*.yml') or Ruby script ('*.rb').
|
|
627
639
|
</p>
|
|
628
|
-
<a name="example7.yaml"></a>
|
|
629
|
-
<div class="program_caption">
|
|
630
|
-
example7.yaml</div>
|
|
631
|
-
<pre class="program"><strong>title:</strong> Users List
|
|
632
|
-
<strong>users:</strong>
|
|
633
|
-
- name: foo
|
|
634
|
-
mail: foo@mail.com
|
|
635
|
-
- name: bar
|
|
636
|
-
mail: bar@mail.net
|
|
637
|
-
- name: baz
|
|
638
|
-
mail: baz@mail.org
|
|
639
|
-
</pre>
|
|
640
640
|
<a name="example7.eruby"></a>
|
|
641
641
|
<div class="program_caption">
|
|
642
642
|
example7.eruby</div>
|
|
@@ -649,22 +649,31 @@ example7.eruby</div>
|
|
|
649
649
|
<% end %>
|
|
650
650
|
</ul>
|
|
651
651
|
</pre>
|
|
652
|
-
<a name="
|
|
652
|
+
<a name="context.yaml"></a>
|
|
653
653
|
<div class="program_caption">
|
|
654
|
-
|
|
655
|
-
<pre class="program">
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
654
|
+
context.yaml</div>
|
|
655
|
+
<pre class="program"><strong>title:</strong> Users List
|
|
656
|
+
<strong>users:</strong>
|
|
657
|
+
- name: foo
|
|
658
|
+
mail: foo@mail.com
|
|
659
|
+
- name: bar
|
|
660
|
+
mail: bar@mail.net
|
|
661
|
+
- name: baz
|
|
662
|
+
mail: baz@mail.org
|
|
663
|
+
</pre>
|
|
664
|
+
<a name="context.rb"></a>
|
|
665
|
+
<div class="program_caption">
|
|
666
|
+
context.rb</div>
|
|
667
|
+
<pre class="program">@title = 'Users List'
|
|
668
|
+
@users = [
|
|
669
|
+
{ 'name'=>'foo', 'mail'=>'foo@mail.com' },
|
|
670
|
+
{ 'name'=>'bar', 'mail'=>'bar@mail.net' },
|
|
671
|
+
{ 'name'=>'baz', 'mail'=>'baz@mail.org' },
|
|
672
|
+
]
|
|
664
673
|
</pre>
|
|
665
674
|
<div class="terminal_caption">
|
|
666
|
-
|
|
667
|
-
<pre class="terminal">$
|
|
675
|
+
example of command-line option '-f'</div>
|
|
676
|
+
<pre class="terminal">$ erubis <strong>-f context.yaml</strong> example7.eruby
|
|
668
677
|
<h1>Users List</h1>
|
|
669
678
|
<ul>
|
|
670
679
|
<li>
|
|
@@ -677,13 +686,7 @@ output</div>
|
|
|
677
686
|
<a href="mailto:baz@mail.org">baz</a>
|
|
678
687
|
</li>
|
|
679
688
|
</ul>
|
|
680
|
-
</
|
|
681
|
-
<p>It is able to specify YAML data file with the command-line option '-f'.
|
|
682
|
-
You don't have to write ruby script such as 'example7.rb'.
|
|
683
|
-
</p>
|
|
684
|
-
<div class="terminal_caption">
|
|
685
|
-
example of command-line option '-f'</div>
|
|
686
|
-
<pre class="terminal">$ erubis <strong>-f example7.yaml</strong> example7.eruby
|
|
689
|
+
$ erubis <strong>-f context.rb</strong> example7.eruby
|
|
687
690
|
<h1>Users List</h1>
|
|
688
691
|
<ul>
|
|
689
692
|
<li>
|
|
@@ -703,42 +706,79 @@ Command-line option '-B' invokes 'Erubis::Eruby#result(binding())' instead of 'E
|
|
|
703
706
|
<br>
|
|
704
707
|
|
|
705
708
|
|
|
709
|
+
<a name="tut-datastr"></a>
|
|
710
|
+
<h3 class="section2">Context Data String</h3>
|
|
711
|
+
<p>Command-line option '-c <em>str</em>' enables you to specify context data in command-line.
|
|
712
|
+
<em>str</em> can be YAML inline style or Ruby code.
|
|
713
|
+
</p>
|
|
714
|
+
<a name="example8.eruby"></a>
|
|
715
|
+
<div class="program_caption">
|
|
716
|
+
example8.eruby</div>
|
|
717
|
+
<pre class="program"><h1><%= @title %></h1>
|
|
718
|
+
<ul>
|
|
719
|
+
<% for item in @list %>
|
|
720
|
+
<li><%= item %></li>
|
|
721
|
+
<% end %>
|
|
722
|
+
</ul>
|
|
723
|
+
</pre>
|
|
724
|
+
<div class="terminal_caption">
|
|
725
|
+
example of command-line option '-c'</div>
|
|
726
|
+
<pre class="terminal">### YAML inline style
|
|
727
|
+
$ erubis <strong>-c '{title: Example, list: [AAA, BBB, CCC]}'</strong> example8.eruby
|
|
728
|
+
<h1>Example</h1>
|
|
729
|
+
<ul>
|
|
730
|
+
<li>AAA</li>
|
|
731
|
+
<li>BBB</li>
|
|
732
|
+
<li>CCC</li>
|
|
733
|
+
</ul>
|
|
734
|
+
### Ruby code
|
|
735
|
+
$ erubis <strong>-c '@title="Example"; @list=%w[AAA BBB CCC]'</strong> example8.eruby
|
|
736
|
+
<h1>Example</h1>
|
|
737
|
+
<ul>
|
|
738
|
+
<li>AAA</li>
|
|
739
|
+
<li>BBB</li>
|
|
740
|
+
<li>CCC</li>
|
|
741
|
+
</ul>
|
|
742
|
+
</pre>
|
|
743
|
+
<br>
|
|
744
|
+
|
|
745
|
+
|
|
706
746
|
<a name="tut-preamble"></a>
|
|
707
747
|
<h3 class="section2">Preamble and Postamble</h3>
|
|
708
|
-
<p>The first line ('_buf =
|
|
709
|
-
and the last line ('_buf.
|
|
748
|
+
<p>The first line ('_buf = '';') in the compiled source code is called preamble
|
|
749
|
+
and the last line ('_buf.to_s') is called postamble.
|
|
710
750
|
</p>
|
|
711
751
|
<p>Command-line option '-b' skips the output of preamble and postamble.
|
|
712
752
|
</p>
|
|
713
|
-
<a name="
|
|
753
|
+
<a name="example9.eruby"></a>
|
|
714
754
|
<div class="program_caption">
|
|
715
|
-
|
|
755
|
+
example9.eruby</div>
|
|
716
756
|
<pre class="program"><% for item in @list %>
|
|
717
757
|
<b><%= item %></b>
|
|
718
758
|
<% end %>
|
|
719
759
|
</pre>
|
|
720
|
-
<
|
|
721
|
-
</
|
|
760
|
+
<div class="terminal_caption">
|
|
761
|
+
compiled source code with and without command-line option '-b'</div>
|
|
722
762
|
<pre class="terminal">## without '-b'
|
|
723
|
-
$ erubis -x
|
|
724
|
-
<strong>_buf =
|
|
763
|
+
$ erubis -x example9.eruby
|
|
764
|
+
<strong>_buf = '';</strong> for item in @list
|
|
725
765
|
_buf << ' <b>'; _buf << ( item ).to_s; _buf << '</b>
|
|
726
766
|
'; end
|
|
727
|
-
<strong>_buf.
|
|
767
|
+
<strong>_buf.to_s</strong>
|
|
728
768
|
|
|
729
769
|
## with '-b'
|
|
730
|
-
$ erubis -x <strong>-b</strong>
|
|
770
|
+
$ erubis -x <strong>-b</strong> example9.eruby
|
|
731
771
|
for item in @list
|
|
732
772
|
_buf << ' <b>'; _buf << ( item ).to_s; _buf << '</b>
|
|
733
773
|
'; end
|
|
734
774
|
</pre>
|
|
735
775
|
<p>Erubis::Eruby.new option '<code>:preamble=>false</code>' and '<code>:postamble=>false</code>' also suppress output of preamble or postamle.
|
|
736
776
|
</p>
|
|
737
|
-
<a name="
|
|
777
|
+
<a name="example9.rb"></a>
|
|
738
778
|
<div class="program_caption">
|
|
739
|
-
|
|
779
|
+
example9.rb</div>
|
|
740
780
|
<pre class="program">require 'erubis'
|
|
741
|
-
input = File.read('
|
|
781
|
+
input = File.read('example9.eruby')
|
|
742
782
|
eruby1 = Erubis::Eruby.new(input)
|
|
743
783
|
eruby2 = Erubis::Eruby.new(input, <strong>:preamble=>false, :postamble=>false</strong>)
|
|
744
784
|
|
|
@@ -748,11 +788,11 @@ puts eruby2.src # don't print preamble and postamble
|
|
|
748
788
|
</pre>
|
|
749
789
|
<div class="terminal_caption">
|
|
750
790
|
output</div>
|
|
751
|
-
<pre class="terminal">$ ruby
|
|
752
|
-
_buf =
|
|
791
|
+
<pre class="terminal">$ ruby example9.rb
|
|
792
|
+
_buf = ''; for item in @list
|
|
753
793
|
_buf << ' <b>'; _buf << ( item ).to_s; _buf << '</b>
|
|
754
794
|
'; end
|
|
755
|
-
_buf.
|
|
795
|
+
_buf.to_s
|
|
756
796
|
--------------
|
|
757
797
|
for item in @list
|
|
758
798
|
_buf << ' <b>'; _buf << ( item ).to_s; _buf << '</b>
|
|
@@ -780,9 +820,9 @@ _buf.join
|
|
|
780
820
|
<p>This is more useful than basic embedded pattern ('<code><% ... ></code>') because PI doesn't break XML or HTML at all.
|
|
781
821
|
For example the following XHTML file is well-formed and HTML validator got no errors on this example.
|
|
782
822
|
</p>
|
|
783
|
-
<a name="
|
|
823
|
+
<a name="example10.xhtml"></a>
|
|
784
824
|
<div class="program_caption">
|
|
785
|
-
|
|
825
|
+
example10.xhtml</div>
|
|
786
826
|
<pre class="program"><?xml version="1.0" ?>
|
|
787
827
|
<strong><?rb
|
|
788
828
|
lang = 'en'
|
|
@@ -802,11 +842,7 @@ example9.xhtml</div>
|
|
|
802
842
|
If <em>name</em> is omitted then the following name is used according to '-l <em>lang</em>'.
|
|
803
843
|
</p>
|
|
804
844
|
<div align="center">
|
|
805
|
-
<table class="table1" border="1" cellspacing="0"
|
|
806
|
-
">
|
|
807
|
-
<caption class="caption1">
|
|
808
|
-
mapping of '-l' option and PI name
|
|
809
|
-
</caption>
|
|
845
|
+
<table class="table1" border="1" cellspacing="0">
|
|
810
846
|
<tr class="tr1">
|
|
811
847
|
<th class="th1">'-l' option</th>
|
|
812
848
|
<th class="th1">PI name</th>
|
|
@@ -839,20 +875,56 @@ If <em>name</em> is omitted then the following name is used according to '-l <em
|
|
|
839
875
|
</div>
|
|
840
876
|
<div class="terminal_caption">
|
|
841
877
|
output</div>
|
|
842
|
-
<pre class="terminal">$ erubis <strong>--pi</strong>
|
|
843
|
-
<?xml version="1.0" ?>
|
|
844
|
-
|
|
878
|
+
<pre class="terminal">$ erubis -x <strong>--pi</strong> example10.xhtml
|
|
879
|
+
_buf = ''; _buf << '<?xml version="1.0" ?>
|
|
880
|
+
';
|
|
881
|
+
lang = 'en'
|
|
882
|
+
list = ['<aaa>', 'b&b', '"ccc"']
|
|
883
|
+
|
|
884
|
+
_buf << '<html lang="'; _buf << (lang).to_s; _buf << '">
|
|
845
885
|
<body>
|
|
846
886
|
<ul>
|
|
847
|
-
|
|
848
|
-
<li>
|
|
849
|
-
|
|
850
|
-
</ul>
|
|
887
|
+
'; for item in list
|
|
888
|
+
_buf << ' <li>'; _buf << Erubis::XmlHelper.escape_xml(item); _buf << '</li>
|
|
889
|
+
'; end
|
|
890
|
+
_buf << ' </ul>
|
|
851
891
|
</body>
|
|
852
892
|
</html>
|
|
893
|
+
';
|
|
894
|
+
_buf.to_s
|
|
853
895
|
</pre>
|
|
854
896
|
<p>Expression character can be changeable by command-line property '--embchar=<em>char</em>. Default is '<code>@</code>'.
|
|
855
897
|
</p>
|
|
898
|
+
<p>Use Erubis::PI::Eruby instead of Erubis::Eruby if you want to use PI as embedded pattern.
|
|
899
|
+
</p>
|
|
900
|
+
<a name="example10.rb"></a>
|
|
901
|
+
<div class="program_caption">
|
|
902
|
+
example10.rb</div>
|
|
903
|
+
<pre class="program">require 'erubis'
|
|
904
|
+
input = File.read('example10.xhtml')
|
|
905
|
+
eruby = Erubis::PI::Eruby.new(input)
|
|
906
|
+
print eruby.src
|
|
907
|
+
</pre>
|
|
908
|
+
<div class="terminal_caption">
|
|
909
|
+
output</div>
|
|
910
|
+
<pre class="terminal">$ ruby example10.rb
|
|
911
|
+
_buf = ''; _buf << '<?xml version="1.0" ?>
|
|
912
|
+
';
|
|
913
|
+
lang = 'en'
|
|
914
|
+
list = ['<aaa>', 'b&b', '"ccc"']
|
|
915
|
+
|
|
916
|
+
_buf << '<html lang="'; _buf << (lang).to_s; _buf << '">
|
|
917
|
+
<body>
|
|
918
|
+
<ul>
|
|
919
|
+
'; for item in list
|
|
920
|
+
_buf << ' <li>'; _buf << Erubis::XmlHelper.escape_xml(item); _buf << '</li>
|
|
921
|
+
'; end
|
|
922
|
+
_buf << ' </ul>
|
|
923
|
+
</body>
|
|
924
|
+
</html>
|
|
925
|
+
';
|
|
926
|
+
_buf.to_s
|
|
927
|
+
</pre>
|
|
856
928
|
<p><strong>(experimental)</strong> Erubis supports '<%= ... %>' pattern with PI pattern.
|
|
857
929
|
</p>
|
|
858
930
|
<div class="program_caption">
|
|
@@ -984,14 +1056,14 @@ example.eruby</div>
|
|
|
984
1056
|
<div class="terminal_caption">
|
|
985
1057
|
compiled source code</div>
|
|
986
1058
|
<pre class="terminal">$ erubis -xE Escape example.eruby
|
|
987
|
-
_buf =
|
|
1059
|
+
_buf = ''; _buf << '<div>
|
|
988
1060
|
'; for item in list
|
|
989
1061
|
_buf << ' <p>'; <strong>_buf << Erubis::XmlHelper.escape_xml( item );</strong> _buf << '</p>
|
|
990
1062
|
<p>'; <strong>_buf << ( item ).to_s;</strong> _buf << '</p>
|
|
991
1063
|
'; end
|
|
992
1064
|
_buf << '</div>
|
|
993
1065
|
';
|
|
994
|
-
_buf.
|
|
1066
|
+
_buf.to_s
|
|
995
1067
|
</pre>
|
|
996
1068
|
<p>EscapeEnhancer is language-independent.
|
|
997
1069
|
</p>
|
|
@@ -1100,29 +1172,30 @@ compiled source code</div>
|
|
|
1100
1172
|
|
|
1101
1173
|
<a name="arraybuffer-enhancer"></a>
|
|
1102
1174
|
<h3 class="section2">ArrayBufferEnhancer</h3>
|
|
1103
|
-
<p>
|
|
1104
|
-
Array buffer is a litte
|
|
1105
|
-
Erubis::Eruby includes this enhancer by default.
|
|
1175
|
+
<p>ArrayBufferEnhancer makes Eruby to use array buffer.
|
|
1176
|
+
Array buffer is a litte slower than String buffer.
|
|
1106
1177
|
</p>
|
|
1107
1178
|
<p>ArrayBufferEnhancer is only for Eruby.
|
|
1108
1179
|
</p>
|
|
1109
|
-
<
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
<a name="stringbuffer-enhancer"></a>
|
|
1113
|
-
<h3 class="section2">StringBufferEnhancer</h3>
|
|
1114
|
-
<p>StringBufferEnhancer makes Eruby to use string buffer.
|
|
1115
|
-
</p>
|
|
1116
|
-
<pre class="terminal">$ erubis -xE StringBuffer example.eruby
|
|
1117
|
-
<strong>_buf = '';</strong> _buf << '<div>
|
|
1180
|
+
<pre class="terminal">$ erubis -xE ArrayBuffer example.eruby
|
|
1181
|
+
<strong>_buf = [];</strong> _buf << '<div>
|
|
1118
1182
|
'; for item in list
|
|
1119
1183
|
_buf << ' <p>'; _buf << ( item ).to_s; _buf << '</p>
|
|
1120
1184
|
<p>'; _buf << Erubis::XmlHelper.escape_xml( item ); _buf << '</p>
|
|
1121
1185
|
'; end
|
|
1122
1186
|
_buf << '</div>
|
|
1123
1187
|
';
|
|
1124
|
-
<strong>_buf</strong
|
|
1188
|
+
<strong>_buf</strong>.join
|
|
1125
1189
|
</pre>
|
|
1190
|
+
<br>
|
|
1191
|
+
|
|
1192
|
+
|
|
1193
|
+
<a name="stringbuffer-enhancer"></a>
|
|
1194
|
+
<h3 class="section2">StringBufferEnhancer</h3>
|
|
1195
|
+
<p>StringBufferEnhancer makes Eruby to use string buffer.
|
|
1196
|
+
String buffer is a little faster than array buffer.
|
|
1197
|
+
Erubis::Eruby includes this enhancer by default.
|
|
1198
|
+
</p>
|
|
1126
1199
|
<p>StringBufferEnhancer is only for Eruby.
|
|
1127
1200
|
</p>
|
|
1128
1201
|
<br>
|
|
@@ -1153,22 +1226,22 @@ notext-example.eruby</div>
|
|
|
1153
1226
|
</pre>
|
|
1154
1227
|
<div class="terminal_caption">
|
|
1155
1228
|
output example of NoTextEnhancer</div>
|
|
1156
|
-
<pre class="terminal">$ erubis -
|
|
1157
|
-
_buf =
|
|
1158
|
-
if !@list || @list.empty?
|
|
1229
|
+
<pre class="terminal">$ erubis -xE NoText notext-example.eruby
|
|
1230
|
+
_buf = '';
|
|
1231
|
+
if !@list || @list.empty?
|
|
1159
1232
|
|
|
1160
|
-
else
|
|
1233
|
+
else
|
|
1161
1234
|
|
|
1162
1235
|
|
|
1163
|
-
@list.each_with_index do |item, i|
|
|
1236
|
+
@list.each_with_index do |item, i|
|
|
1164
1237
|
_buf << ( i%2 == 0 ? '#FFCCCC' : '#CCCCFF' ).to_s;
|
|
1165
1238
|
_buf << ( item ).to_s;
|
|
1166
1239
|
|
|
1167
|
-
end
|
|
1240
|
+
end
|
|
1168
1241
|
|
|
1169
1242
|
|
|
1170
|
-
end
|
|
1171
|
-
_buf.
|
|
1243
|
+
end
|
|
1244
|
+
_buf.to_s
|
|
1172
1245
|
</pre>
|
|
1173
1246
|
<p>NoTextEnhancer is language-independent. It is useful even if you are PHP user, see <a href="#topics-php">this section</a>.
|
|
1174
1247
|
</p>
|
|
@@ -1199,19 +1272,19 @@ nocode-example.eruby</div>
|
|
|
1199
1272
|
<% end %>
|
|
1200
1273
|
</pre>
|
|
1201
1274
|
<div class="terminal_caption">
|
|
1202
|
-
output example of
|
|
1203
|
-
<pre class="terminal">$ erubis -
|
|
1275
|
+
output example of NoCodeEnhancer</div>
|
|
1276
|
+
<pre class="terminal">$ erubis -xE NoCode notext-example.eruby
|
|
1204
1277
|
<h3>List</h3>
|
|
1205
1278
|
|
|
1206
1279
|
<p>not found.</p>
|
|
1207
1280
|
|
|
1208
1281
|
<table>
|
|
1209
1282
|
<tbody>
|
|
1210
|
-
|
|
1283
|
+
|
|
1211
1284
|
<tr bgcolor="">
|
|
1212
1285
|
<td></td>
|
|
1213
1286
|
</tr>
|
|
1214
|
-
|
|
1287
|
+
|
|
1215
1288
|
</tbody>
|
|
1216
1289
|
</table>
|
|
1217
1290
|
|
|
@@ -1228,14 +1301,14 @@ output example of NoTextEnhancer</div>
|
|
|
1228
1301
|
<div class="terminal_caption">
|
|
1229
1302
|
compiled source code</div>
|
|
1230
1303
|
<pre class="terminal">$ erubis -xE Simplify example.euby
|
|
1231
|
-
_buf =
|
|
1304
|
+
_buf = ''; _buf << '<div>
|
|
1232
1305
|
'; for item in list ; _buf << '
|
|
1233
1306
|
<p>'; _buf << ( item ).to_s; _buf << '</p>
|
|
1234
1307
|
<p>'; _buf << Erubis::XmlHelper.escape_xml( item ); _buf << '</p>
|
|
1235
1308
|
'; end ; _buf << '
|
|
1236
1309
|
</div>
|
|
1237
1310
|
';
|
|
1238
|
-
_buf.
|
|
1311
|
+
_buf.to_s
|
|
1239
1312
|
</pre>
|
|
1240
1313
|
<p>SimplifyEnhancer is language-independent.
|
|
1241
1314
|
</p>
|
|
@@ -1259,11 +1332,11 @@ bipattern-example.rhtml</div>
|
|
|
1259
1332
|
<div class="terminal_caption">
|
|
1260
1333
|
compiled source code</div>
|
|
1261
1334
|
<pre class="terminal">$ erubis -xE BiPattern bipattern-example.rhtml
|
|
1262
|
-
_buf =
|
|
1335
|
+
_buf = ''; for item in list
|
|
1263
1336
|
_buf << ' <b>'; <strong>_buf << ( item ).to_s;</strong> _buf << '</b>
|
|
1264
1337
|
<b>'; <strong>_buf << Erubis::XmlHelper.escape_xml( item );</strong> _buf << '</b>
|
|
1265
1338
|
'; end
|
|
1266
|
-
_buf.
|
|
1339
|
+
_buf.to_s
|
|
1267
1340
|
</pre>
|
|
1268
1341
|
<p>BiPatternEnhancer is language-independent.
|
|
1269
1342
|
</p>
|
|
@@ -1286,12 +1359,12 @@ percentline-example.rhtml</div>
|
|
|
1286
1359
|
<div class="terminal_caption">
|
|
1287
1360
|
compiled source code</div>
|
|
1288
1361
|
<pre class="terminal">$ erubis -xE PercentLine percentline-example.rhtml
|
|
1289
|
-
_buf =
|
|
1362
|
+
_buf = ''; <strong>for item in list</strong>
|
|
1290
1363
|
_buf << ' <b>'; _buf << ( item ).to_s; _buf << '</b>
|
|
1291
1364
|
'; <strong>end</strong>
|
|
1292
1365
|
_buf << '% lines with \'%%\'
|
|
1293
1366
|
';
|
|
1294
|
-
_buf.
|
|
1367
|
+
_buf.to_s
|
|
1295
1368
|
</pre>
|
|
1296
1369
|
<p>PercentLineEnhancer is language-independent.
|
|
1297
1370
|
</p>
|
|
@@ -1323,10 +1396,10 @@ compiled source code</div>
|
|
|
1323
1396
|
|
|
1324
1397
|
<strong>def list_items(items)</strong>
|
|
1325
1398
|
|
|
1326
|
-
_buf =
|
|
1399
|
+
_buf = ''; for item in items
|
|
1327
1400
|
_buf << ' <b>'; _buf << ( item ).to_s; _buf << '</b>
|
|
1328
1401
|
'; end
|
|
1329
|
-
_buf.
|
|
1402
|
+
_buf.to_s
|
|
1330
1403
|
|
|
1331
1404
|
<strong>end</strong>
|
|
1332
1405
|
|
|
@@ -1349,7 +1422,7 @@ normal-eruby-test.eruby</div>
|
|
|
1349
1422
|
<div class="terminal_caption">
|
|
1350
1423
|
compiled source code</div>
|
|
1351
1424
|
<pre class="terminal">$ erubis -x normal-eruby-test.eruby
|
|
1352
|
-
_buf =
|
|
1425
|
+
_buf = '';
|
|
1353
1426
|
<strong>def list_items(items)</strong>
|
|
1354
1427
|
|
|
1355
1428
|
for item in items
|
|
@@ -1358,7 +1431,7 @@ _buf = [];
|
|
|
1358
1431
|
|
|
1359
1432
|
<strong>end</strong>
|
|
1360
1433
|
|
|
1361
|
-
_buf.
|
|
1434
|
+
_buf.to_s
|
|
1362
1435
|
</pre>
|
|
1363
1436
|
<p>Header and footer can be in any position in eRuby script,
|
|
1364
1437
|
that is, header is no need to be in the head of eRuby script.
|
|
@@ -1383,12 +1456,12 @@ compiled source code</div>
|
|
|
1383
1456
|
|
|
1384
1457
|
<strong>def page(list)</strong>
|
|
1385
1458
|
|
|
1386
|
-
_buf =
|
|
1459
|
+
_buf = ''; _buf << '<?xml version="1.0"?>
|
|
1387
1460
|
<html>
|
|
1388
1461
|
'; _buf << ' :
|
|
1389
1462
|
'; _buf << '</html>
|
|
1390
1463
|
';
|
|
1391
|
-
_buf.
|
|
1464
|
+
_buf.to_s
|
|
1392
1465
|
|
|
1393
1466
|
<strong>end</strong>
|
|
1394
1467
|
|
|
@@ -1439,7 +1512,7 @@ example.ephp</div>
|
|
|
1439
1512
|
<td><strong><%= $i %></strong></td>
|
|
1440
1513
|
<td><strong><%== $item %></strong></td>
|
|
1441
1514
|
</tr>
|
|
1442
|
-
|
|
1515
|
+
<strong><% } %></strong>
|
|
1443
1516
|
</tbody>
|
|
1444
1517
|
</table>
|
|
1445
1518
|
</body>
|
|
@@ -1873,44 +1946,113 @@ document.write(_buf.join(""));
|
|
|
1873
1946
|
|
|
1874
1947
|
<a name="topics"></a>
|
|
1875
1948
|
<h2 class="section1">Other Topics</h2>
|
|
1949
|
+
<a name="topics-syntax"></a>
|
|
1950
|
+
<h3 class="section2">Syntax Checking</h3>
|
|
1951
|
+
<p>Command-line option '-z' checks syntax. It is similar to 'erubis -x file.rhtml | ruby -wc', but it can take several file names.
|
|
1952
|
+
</p>
|
|
1953
|
+
<div class="terminal_caption">
|
|
1954
|
+
example of command-line option '-z'</div>
|
|
1955
|
+
<pre class="terminal">$ erubis <strong>-z</strong> app/views/*/*.rhtml
|
|
1956
|
+
Syntax OK
|
|
1957
|
+
</pre>
|
|
1958
|
+
<br>
|
|
1959
|
+
|
|
1960
|
+
|
|
1961
|
+
<a name="topics-caching"></a>
|
|
1962
|
+
<h3 class="section2">File Caching</h3>
|
|
1963
|
+
<p>Erubis::Eruby.convert_file(filename) convert file into Ruby script and return Eruby object.
|
|
1964
|
+
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.convert_file() loads cache file.
|
|
1966
|
+
</p>
|
|
1967
|
+
<div class="program_caption">
|
|
1968
|
+
example of Erubis::Eruby.convert_file()</div>
|
|
1969
|
+
<pre class="program">require 'erubis'
|
|
1970
|
+
filename = 'example.rhtml'
|
|
1971
|
+
eruby = <strong>Erubis::Eruby.convert_file(filename)</strong>
|
|
1972
|
+
cachename = filename + '.cache'
|
|
1973
|
+
if test(?f, cachename)
|
|
1974
|
+
puts "*** cache file '#{cachename}' created."
|
|
1975
|
+
end
|
|
1976
|
+
</pre>
|
|
1977
|
+
<p>Caching makes Erubis about 40-50 percent faster than no-caching.
|
|
1978
|
+
See <a href="#topics-benchmark">benchmark</a> for details.
|
|
1979
|
+
</p>
|
|
1980
|
+
<br>
|
|
1981
|
+
|
|
1982
|
+
|
|
1876
1983
|
<a name="topics-tinyeruby"></a>
|
|
1877
|
-
<h3 class="section2">TinyEruby class</h3>
|
|
1878
|
-
<p>TinyEruby class in 'erubis/tiny.rb' is the smallest implementation of eRuby.
|
|
1984
|
+
<h3 class="section2">Erubis::TinyEruby class</h3>
|
|
1985
|
+
<p>Erubis::TinyEruby class in 'erubis/tiny.rb' is the smallest implementation of eRuby.
|
|
1879
1986
|
If you don't need any enhancements of Erubis and only require simple eRuby implementation,
|
|
1880
|
-
try TinyEruby class.
|
|
1987
|
+
try Erubis::TinyEruby class.
|
|
1881
1988
|
</p>
|
|
1882
1989
|
<br>
|
|
1883
1990
|
|
|
1884
1991
|
|
|
1885
1992
|
<a name="topics-rails"></a>
|
|
1886
1993
|
<h3 class="section2">Ruby on Rails Support</h3>
|
|
1887
|
-
<p>Erubis supports Ruby on Rails.
|
|
1888
|
-
Add the following code to your 'app/controllers/application.rb'.
|
|
1994
|
+
<p>Erubis supports Ruby on Rails.
|
|
1889
1995
|
</p>
|
|
1996
|
+
<ol type="1">
|
|
1997
|
+
<li>Add the following code to your 'config/environment.rb'.
|
|
1890
1998
|
<div class="program_caption">
|
|
1891
|
-
|
|
1892
|
-
<pre class="program">require 'erubis/
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
#Erubis::
|
|
1896
|
-
#Erubis::Helper::RailsTemplate.default_properties = { :escape=>true, :escapefunc=>'h' }
|
|
1999
|
+
config/environment.rb</div>
|
|
2000
|
+
<pre class="program">require 'erubis/helpers/rails_helper'
|
|
2001
|
+
#Erubis::Helpers::RailsHelper.engine_class = Erubis::Eruby
|
|
2002
|
+
#Erubis::Helpers::RailsHelper.init_properties = {}
|
|
2003
|
+
#Erubis::Helpers::RailsHelper.show_src = false
|
|
1897
2004
|
</pre>
|
|
1898
|
-
<p>
|
|
2005
|
+
<p> This will replace ERB in Rails by Erubis entirely.
|
|
1899
2006
|
</p>
|
|
1900
|
-
|
|
2007
|
+
</li>
|
|
2008
|
+
<li>(Optional) apply the following patch to 'action_pack/lib/action_view/base.rb'.
|
|
2009
|
+
<div class="program_caption">
|
|
2010
|
+
action_view_base_rb.patch</div>
|
|
2011
|
+
<pre class="program">--- lib/action_view/base.rb (original)
|
|
2012
|
+
+++ lib/action_view/base.rb (working copy)
|
|
2013
|
+
@@ -445,6 +445,11 @@
|
|
2014
|
+
end
|
|
2015
|
+
end
|
|
2016
|
+
|
|
2017
|
+
+ # convert template into ruby code
|
|
2018
|
+
+ def convert_template_into_ruby_code(template)
|
|
2019
|
+
+ ERB.new(template, nil, @@erb_trim_mode).src
|
|
2020
|
+
+ end
|
|
2021
|
+
+
|
|
2022
|
+
# Create source code for given template
|
|
2023
|
+
def create_template_source(extension, template, render_symbol, locals)
|
|
2024
|
+
if template_requires_setup?(extension)
|
|
2025
|
+
@@ -458,7 +463,7 @@
|
|
2026
|
+
"update_page do |page|\n#{template}\nend"
|
|
2027
|
+
end
|
|
2028
|
+
else
|
|
2029
|
+
- body = ERB.new(template, nil, @@erb_trim_mode).src
|
|
2030
|
+
+ body = convert_template_into_ruby_code(template)
|
|
2031
|
+
end
|
|
2032
|
+
|
|
2033
|
+
@@template_args[render_symbol] ||= {}
|
|
2034
|
+
</pre>
|
|
2035
|
+
<p> This patch is included in erubis_2.X.X/contrib directory and the following is an
|
|
2036
|
+
example to apply this patch.
|
|
1901
2037
|
</p>
|
|
1902
|
-
<
|
|
2038
|
+
<div class="terminal_caption">
|
|
2039
|
+
how to apply patch:</div>
|
|
2040
|
+
<pre class="terminal">$ cd /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_view/
|
|
2041
|
+
$ sudo patch -p1 < /tmp/erubis_2.X.X/contrib/action_view_base_rb.patch
|
|
1903
2042
|
</pre>
|
|
1904
|
-
<p>
|
|
1905
|
-
Use '@content_for_layout' instead 'yield'.
|
|
2043
|
+
<p> Notice that this patch is not necessary if you are using Ruby on Rails ver 1.1 or 1.2, but it is recommended.
|
|
1906
2044
|
</p>
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
<pre class="
|
|
1910
|
-
<%<strong>#</strong>= yield %>
|
|
1911
|
-
<strong><%= @content_for_layout %></strong>
|
|
1912
|
-
...
|
|
2045
|
+
</li>
|
|
2046
|
+
<li>Restart web server.
|
|
2047
|
+
<pre class="terminal">$ ruby script/server
|
|
1913
2048
|
</pre>
|
|
2049
|
+
</li>
|
|
2050
|
+
</ol>
|
|
2051
|
+
<p>ActionView::Helpers::CaptureHelper#capture() and ActionView::Helpers::Texthelper#concat() are available.
|
|
2052
|
+
</p>
|
|
2053
|
+
<p>If Erubis::Helper::Rails.show_src is ture, Erubis prints converted Ruby code into log file (ex. 'log/development.log').
|
|
2054
|
+
It is useful for debugging.
|
|
2055
|
+
</p>
|
|
1914
2056
|
<br>
|
|
1915
2057
|
|
|
1916
2058
|
|
|
@@ -1950,7 +2092,7 @@ NoTextEnhancer can separate PHP code from HTML document.
|
|
|
1950
2092
|
</p>
|
|
1951
2093
|
<div class="terminal_caption">
|
|
1952
2094
|
example of using NoTextEnhancer with PHP file</div>
|
|
1953
|
-
<pre class="terminal">$ erubis -
|
|
2095
|
+
<pre class="terminal">$ erubis -l php -E NoText -p '<\?php \?>' --trim=false notext-example.php | cat -n
|
|
1954
2096
|
1
|
|
1955
2097
|
2
|
|
1956
2098
|
3
|
|
@@ -1975,24 +2117,24 @@ example of using NoTextEnhancer with PHP file</div>
|
|
|
1975
2117
|
</p>
|
|
1976
2118
|
<div class="terminal_caption">
|
|
1977
2119
|
example of using NoCodeEnhancer with PHP file</div>
|
|
1978
|
-
<pre class="terminal">$ erubis -
|
|
2120
|
+
<pre class="terminal">$ erubis -l php -E NoCode -p '<\?php \?>' notext-example.php | cat -n
|
|
1979
2121
|
1 <html>
|
|
1980
2122
|
2 <body>
|
|
1981
2123
|
3 <h3>List</h3>
|
|
1982
|
-
4
|
|
2124
|
+
4
|
|
1983
2125
|
5 <p>not found.</p>
|
|
1984
|
-
6
|
|
2126
|
+
6
|
|
1985
2127
|
7 <table>
|
|
1986
2128
|
8 <tbody>
|
|
1987
|
-
9
|
|
1988
|
-
10
|
|
2129
|
+
9
|
|
2130
|
+
10
|
|
1989
2131
|
11 <tr bgcolor="">
|
|
1990
2132
|
12 <td></td>
|
|
1991
2133
|
13 </tr>
|
|
1992
|
-
14
|
|
2134
|
+
14
|
|
1993
2135
|
15 </tbody>
|
|
1994
2136
|
16 </table>
|
|
1995
|
-
17
|
|
2137
|
+
17
|
|
1996
2138
|
18 </body>
|
|
1997
2139
|
19 </html>
|
|
1998
2140
|
</pre>
|
|
@@ -2025,7 +2167,7 @@ notext-ex.rhtml</div>
|
|
|
2025
2167
|
<div class="terminal_caption">
|
|
2026
2168
|
command line example</div>
|
|
2027
2169
|
<pre class="terminal">$ notext notext-ex.rhtml
|
|
2028
|
-
_buf =
|
|
2170
|
+
_buf = '';
|
|
2029
2171
|
|
|
2030
2172
|
|
|
2031
2173
|
|
|
@@ -2039,14 +2181,14 @@ _buf = [];
|
|
|
2039
2181
|
end ;
|
|
2040
2182
|
|
|
2041
2183
|
|
|
2042
|
-
_buf.
|
|
2184
|
+
_buf.to_s
|
|
2043
2185
|
</pre>
|
|
2044
2186
|
<p>Command-line option '-u' deletes continuous empty lines to one empty line.
|
|
2045
2187
|
</p>
|
|
2046
2188
|
<div class="terminal_caption">
|
|
2047
2189
|
command-line example</div>
|
|
2048
2190
|
<pre class="terminal">$ notext <strong>-u</strong> notext-ex.rhtml
|
|
2049
|
-
_buf =
|
|
2191
|
+
_buf = '';
|
|
2050
2192
|
|
|
2051
2193
|
@list.each_with_index do |item, i| ;
|
|
2052
2194
|
klass = i % 2 == 0 ? 'odd' : 'even' ;
|
|
@@ -2055,25 +2197,25 @@ _buf = [];
|
|
|
2055
2197
|
|
|
2056
2198
|
end ;
|
|
2057
2199
|
|
|
2058
|
-
_buf.
|
|
2200
|
+
_buf.to_s
|
|
2059
2201
|
</pre>
|
|
2060
2202
|
<p>Command-line option '-c' deletes all empty lines.
|
|
2061
2203
|
</p>
|
|
2062
2204
|
<div class="terminal_caption">
|
|
2063
2205
|
command-line example</div>
|
|
2064
2206
|
<pre class="terminal">$ notext <strong>-c</strong> notext-ex.rhtml
|
|
2065
|
-
_buf =
|
|
2207
|
+
_buf = '';
|
|
2066
2208
|
@list.each_with_index do |item, i| ;
|
|
2067
2209
|
klass = i % 2 == 0 ? 'odd' : 'even' ;
|
|
2068
2210
|
_buf << ( klass ).to_s;
|
|
2069
2211
|
_buf << Erubis::XmlHelper.escape_xml( item );
|
|
2070
2212
|
end ;
|
|
2071
|
-
_buf.
|
|
2213
|
+
_buf.to_s
|
|
2072
2214
|
</pre>
|
|
2073
2215
|
<p>Command-line option '-n' shows line numbers. It can work with '-c' or '-u'.
|
|
2074
2216
|
</p>
|
|
2075
2217
|
<pre class="terminal">$ notext <strong>-nu</strong> example2.rhtml
|
|
2076
|
-
1: _buf =
|
|
2218
|
+
1: _buf = '';
|
|
2077
2219
|
|
|
2078
2220
|
7: @list.each_with_index do |item, i| ;
|
|
2079
2221
|
8: klass = i % 2 == 0 ? 'odd' : 'even' ;
|
|
@@ -2082,15 +2224,15 @@ _buf.join
|
|
|
2082
2224
|
|
|
2083
2225
|
12: end ;
|
|
2084
2226
|
|
|
2085
|
-
16: _buf.
|
|
2227
|
+
16: _buf.to_s
|
|
2086
2228
|
$ notext <strong>-nc</strong> example2.rhtml
|
|
2087
|
-
1: _buf =
|
|
2229
|
+
1: _buf = '';
|
|
2088
2230
|
7: @list.each_with_index do |item, i| ;
|
|
2089
2231
|
8: klass = i % 2 == 0 ? 'odd' : 'even' ;
|
|
2090
2232
|
9: _buf << ( klass ).to_s;
|
|
2091
2233
|
10: _buf << Erubis::XmlHelper.escape_xml( item );
|
|
2092
2234
|
12: end ;
|
|
2093
|
-
16: _buf.
|
|
2235
|
+
16: _buf.to_s
|
|
2094
2236
|
</pre>
|
|
2095
2237
|
<p>Command 'notext' supports '-l <em>lang</em>' options. For example, command-line option '-l php' retrieves embedded PHP code from PHP file.
|
|
2096
2238
|
</p>
|
|
@@ -2099,45 +2241,62 @@ $ notext <strong>-nc</strong> example2.rhtml
|
|
|
2099
2241
|
|
|
2100
2242
|
<a name="topics-benchmark"></a>
|
|
2101
2243
|
<h3 class="section2">Benchmark</h3>
|
|
2102
|
-
<p>A benchmark script is included in Erubis package at erubis-X.X.X/benchark directory.
|
|
2244
|
+
<p>A benchmark script is included in Erubis package at 'erubis-X.X.X/benchark/' directory.
|
|
2103
2245
|
Here is an example result of benchmark.
|
|
2104
2246
|
</p>
|
|
2105
|
-
<div class="
|
|
2106
|
-
|
|
2107
|
-
<pre class="
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
Erubis::
|
|
2114
|
-
Erubis::
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
Erubis::StdoutEruby 26.240000 1.490000 27.730000 ( 41.840430)
|
|
2124
|
-
Erubis::TinyEruby 31.690000 1.590000 33.280000 ( 49.862091)
|
|
2125
|
-
Erubis::TinyStdoutEruby 22.550000 1.230000 23.780000 ( 33.316978)
|
|
2126
|
-
</pre>
|
|
2127
|
-
<p>This shows that:
|
|
2247
|
+
<div class="terminal_caption">
|
|
2248
|
+
MacOS X 10.4 Tiger, Intel CoreDuo 1.83GHz, Ruby1.8.5, eruby1.0.5, gcc4.0.1</div>
|
|
2249
|
+
<pre class="terminal">$ cd erubis-2.2.0/benchmark/
|
|
2250
|
+
$ ruby erubybench.rb -n 10000 -m execute
|
|
2251
|
+
## execute
|
|
2252
|
+
user system total real
|
|
2253
|
+
eruby 12.870000 0.290000 <strong>13.160000</strong> ( 14.020219)
|
|
2254
|
+
ERB 37.090000 0.460000 <strong>37.550000</strong> ( 39.639027)
|
|
2255
|
+
Erubis::Eruby 11.420000 0.330000 <strong>11.750000</strong> ( 12.385562)
|
|
2256
|
+
Erubis::Eruby(cached) 7.580000 0.440000 <strong>8.020000</strong> ( 8.536019)
|
|
2257
|
+
Erubis::ArrayBufferEruby 11.550000 0.340000 11.890000 ( 12.597665)
|
|
2258
|
+
Erubis::SimplifiedEruby 10.410000 0.320000 10.730000 ( 11.406730)
|
|
2259
|
+
Erubis::StdoutEruby 12.170000 0.340000 12.510000 ( 13.252177)
|
|
2260
|
+
Erubis::PrintOutEruby 12.070000 0.330000 12.400000 ( 13.142734)
|
|
2261
|
+
Erubis::TinyEruby 9.710000 0.320000 10.030000 ( 10.771446)
|
|
2262
|
+
Erubis::PI::Eruby 12.010000 0.340000 12.350000 ( 13.104801)
|
|
2263
|
+
</pre>
|
|
2264
|
+
<p>This shows that...
|
|
2128
2265
|
</p>
|
|
2129
2266
|
<ul type="disc">
|
|
2130
|
-
<li>Erubis::Eruby
|
|
2267
|
+
<li>Erubis::Eruby runs more than 10 percent faster than eruby.
|
|
2131
2268
|
</li>
|
|
2132
|
-
<li>Erubis::Eruby
|
|
2269
|
+
<li>Erubis::Eruby runs about 3 times faster than ERB.
|
|
2133
2270
|
</li>
|
|
2134
|
-
<li>
|
|
2271
|
+
<li>Caching (by Erubis::Eruby.load_file()) makes Erubis about 40-50 percent faster.
|
|
2135
2272
|
</li>
|
|
2136
|
-
<li>
|
|
2273
|
+
<li>Array buffer (ArrayBufferEnhancer) is a little slower than string buffer (StringBufferEnhancer which Erubis::Eruby includes)
|
|
2137
2274
|
</li>
|
|
2138
|
-
<li
|
|
2275
|
+
<li>$stdout and print() make Erubis a little slower.
|
|
2276
|
+
</li>
|
|
2277
|
+
<li>Erubis::TinyEruby (at 'erubis/tiny.rb') is the fastest in all eRuby implementations when no caching.
|
|
2139
2278
|
</li>
|
|
2140
2279
|
</ul>
|
|
2280
|
+
<p>Escaping HTML characters (such as '< > & "') makes Erubis more faster than eruby and ERB,
|
|
2281
|
+
because Erubis::XmlHelper#escape_xml() works faster than CGI.escapeHTML() and ERB::Util#h().
|
|
2282
|
+
The following shows that Erubis runs more than 30 percent faster than eruby if HTML characters are escaped.
|
|
2283
|
+
</p>
|
|
2284
|
+
<div class="terminal_caption">
|
|
2285
|
+
When escaping HTML characters with option '-e'</div>
|
|
2286
|
+
<pre class="terminal">$ ruby erubybench.rb -n 10000 -m execute -e
|
|
2287
|
+
## execute
|
|
2288
|
+
user system total real
|
|
2289
|
+
eruby 22.730000 0.350000 <strong>23.080000</strong> ( 24.815081)
|
|
2290
|
+
ERB 46.590000 0.520000 <strong>47.110000</strong> ( 50.360891)
|
|
2291
|
+
Erubis::Eruby 16.750000 0.360000 <strong>17.110000</strong> ( 18.253436)
|
|
2292
|
+
Erubis::Eruby(cached) 12.540000 0.450000 <strong>12.990000</strong> ( 13.935044)
|
|
2293
|
+
Erubis::ArrayBufferEruby 16.860000 0.370000 17.230000 ( 18.373771)
|
|
2294
|
+
Erubis::SimplifiedEruby 15.750000 0.350000 16.100000 ( 17.344105)
|
|
2295
|
+
Erubis::StdoutEruby 17.650000 0.360000 18.010000 ( 19.194326)
|
|
2296
|
+
Erubis::PrintOutEruby 17.560000 0.360000 17.920000 ( 19.293728)
|
|
2297
|
+
Erubis::TinyEruby 16.300000 0.350000 16.650000 ( 17.887278)
|
|
2298
|
+
Erubis::PI::Eruby 17.210000 0.360000 17.570000 ( 18.836510)
|
|
2299
|
+
</pre>
|
|
2141
2300
|
<br>
|
|
2142
2301
|
|
|
2143
2302
|
|
|
@@ -2172,10 +2331,9 @@ Erubis::TinyStdoutEruby 22.550000 1.230000 23.780000 ( 33.316978)
|
|
|
2172
2331
|
Show compiled source.
|
|
2173
2332
|
</dd>
|
|
2174
2333
|
<dt class="dt3"><b>
|
|
2175
|
-
-
|
|
2334
|
+
-z </b></dt>
|
|
2176
2335
|
<dd class="dd3">
|
|
2177
|
-
|
|
2178
|
-
This is equivarent to '--trim=false'.
|
|
2336
|
+
Syntax checking.
|
|
2179
2337
|
</dd>
|
|
2180
2338
|
<dt class="dt3"><b>
|
|
2181
2339
|
-b </b></dt>
|
|
@@ -2220,13 +2378,19 @@ Erubis::TinyStdoutEruby 22.550000 1.230000 23.780000 ( 33.316978)
|
|
|
2220
2378
|
Kanji code (euc, sjis, utf8, or none) (default none).
|
|
2221
2379
|
</dd>
|
|
2222
2380
|
<dt class="dt3"><b>
|
|
2223
|
-
-f
|
|
2381
|
+
-f datafile </b></dt>
|
|
2224
2382
|
<dd class="dd3">
|
|
2225
|
-
|
|
2383
|
+
Context data file in YAML format ('*.yaml', '*.yml') or
|
|
2384
|
+
Ruby script ('*.rb').
|
|
2226
2385
|
It is able to specify several filenames separating with ','
|
|
2227
2386
|
(ex. -f file1,file2,file3).
|
|
2228
2387
|
</dd>
|
|
2229
2388
|
<dt class="dt3"><b>
|
|
2389
|
+
-c context </b></dt>
|
|
2390
|
+
<dd class="dd3">
|
|
2391
|
+
Context data string in YAML inline style or Ruby code.
|
|
2392
|
+
</dd>
|
|
2393
|
+
<dt class="dt3"><b>
|
|
2230
2394
|
-t </b></dt>
|
|
2231
2395
|
<dd class="dd3">
|
|
2232
2396
|
Expand tab characters in YAML file.
|
|
@@ -2246,6 +2410,11 @@ Erubis::TinyStdoutEruby 22.550000 1.230000 23.780000 ( 33.316978)
|
|
|
2246
2410
|
<dd class="dd3">
|
|
2247
2411
|
parse '<?name ... ?>' instead of '<% ... %>'
|
|
2248
2412
|
</dd>
|
|
2413
|
+
<dt class="dt3"><b>
|
|
2414
|
+
--trim=false </b></dt>
|
|
2415
|
+
<dd class="dd3">
|
|
2416
|
+
No trimming spaces around '<% %>'.
|
|
2417
|
+
</dd>
|
|
2249
2418
|
</dl>
|
|
2250
2419
|
<br>
|
|
2251
2420
|
|