erubis 2.0.1 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. data/ChangeLog +150 -2
  2. data/LGPL +504 -0
  3. data/README.txt +14 -8
  4. data/benchmark/erubybench.rb +1 -1
  5. data/benchmark/erubybench.rhtml +3 -3
  6. data/bin/erubis +1 -1
  7. data/bin/notext +154 -0
  8. data/contrib/erubis +1036 -374
  9. data/contrib/inline-require +5 -3
  10. data/doc-api/classes/Erubis.html +43 -1
  11. data/doc-api/classes/Erubis/ArrayBufferEnhancer.html +14 -14
  12. data/doc-api/classes/Erubis/ArrayEnhancer.html +14 -14
  13. data/doc-api/classes/Erubis/Basic.html +112 -0
  14. data/doc-api/classes/Erubis/Basic/Converter.html +318 -0
  15. data/doc-api/classes/Erubis/Basic/Engine.html +130 -0
  16. data/doc-api/classes/Erubis/BiPatternEnhancer.html +14 -14
  17. data/doc-api/classes/Erubis/CGenerator.html +386 -0
  18. data/doc-api/classes/Erubis/Context.html +31 -32
  19. data/doc-api/classes/Erubis/Converter.html +231 -0
  20. data/doc-api/classes/Erubis/Ec.html +9 -283
  21. data/doc-api/classes/Erubis/Ejava.html +9 -274
  22. data/doc-api/classes/Erubis/Ejavascript.html +9 -298
  23. data/doc-api/classes/Erubis/Engine.html +68 -508
  24. data/doc-api/classes/Erubis/Eperl.html +9 -259
  25. data/doc-api/classes/Erubis/Ephp.html +9 -239
  26. data/doc-api/classes/Erubis/ErubisError.html +2 -2
  27. data/doc-api/classes/Erubis/Eruby.html +4 -187
  28. data/doc-api/classes/Erubis/EscapeEnhancer.html +9 -11
  29. data/doc-api/classes/Erubis/Escheme.html +9 -272
  30. data/doc-api/classes/Erubis/Evaluator.html +212 -0
  31. data/doc-api/classes/Erubis/Generator.html +410 -0
  32. data/doc-api/classes/Erubis/HeaderFooterEnhancer.html +16 -16
  33. data/doc-api/classes/Erubis/Helper.html +112 -0
  34. data/doc-api/classes/Erubis/Helper/CachedRailsTemplate.html +198 -0
  35. data/doc-api/classes/Erubis/Helper/RailsTemplate.html +366 -0
  36. data/doc-api/classes/Erubis/JavaGenerator.html +359 -0
  37. data/doc-api/classes/Erubis/JavascriptGenerator.html +381 -0
  38. data/doc-api/classes/Erubis/Main.html +27 -25
  39. data/doc-api/classes/Erubis/NoCodeEnhancer.html +249 -0
  40. data/doc-api/classes/Erubis/NoCodeEruby.html +120 -0
  41. data/doc-api/classes/Erubis/NoTextEnhancer.html +8 -8
  42. data/doc-api/classes/Erubis/NotSupportedError.html +119 -0
  43. data/doc-api/classes/Erubis/OptimizedEruby.html +22 -304
  44. data/doc-api/classes/Erubis/OptimizedGenerator.html +439 -0
  45. data/doc-api/classes/Erubis/OptimizedXmlEruby.html +7 -7
  46. data/doc-api/classes/Erubis/PI.html +124 -0
  47. data/doc-api/classes/Erubis/PI/Converter.html +318 -0
  48. data/doc-api/classes/Erubis/PI/Ec.html +166 -0
  49. data/doc-api/classes/Erubis/PI/Ejava.html +166 -0
  50. data/doc-api/classes/Erubis/PI/Ejavascript.html +166 -0
  51. data/doc-api/classes/Erubis/PI/Engine.html +122 -0
  52. data/doc-api/classes/Erubis/PI/Eperl.html +166 -0
  53. data/doc-api/classes/Erubis/PI/Ephp.html +166 -0
  54. data/doc-api/classes/Erubis/PI/Eruby.html +155 -0
  55. data/doc-api/classes/Erubis/PI/Escheme.html +166 -0
  56. data/doc-api/classes/Erubis/PI/TinyEruby.html +305 -0
  57. data/doc-api/classes/Erubis/PercentLineEnhancer.html +7 -7
  58. data/doc-api/classes/Erubis/PerlGenerator.html +344 -0
  59. data/doc-api/classes/Erubis/PhpGenerator.html +350 -0
  60. data/doc-api/classes/Erubis/PrintEnabledEnhancer.html +24 -24
  61. data/doc-api/classes/Erubis/PrintOutEnhancer.html +35 -35
  62. data/doc-api/classes/Erubis/RubyEvaluator.html +190 -0
  63. data/doc-api/classes/Erubis/RubyGenerator.html +327 -0
  64. data/doc-api/classes/Erubis/SchemeGenerator.html +382 -0
  65. data/doc-api/classes/Erubis/SimplifyEnhancer.html +17 -13
  66. data/doc-api/classes/Erubis/StdoutEnhancer.html +14 -14
  67. data/doc-api/classes/Erubis/StringBufferEnhancer.html +14 -14
  68. data/doc-api/classes/Erubis/TinyEruby.html +45 -40
  69. data/doc-api/classes/Erubis/XmlHelper.html +14 -14
  70. data/doc-api/created.rid +1 -1
  71. data/doc-api/files/__/README_txt.html +27 -9
  72. data/doc-api/files/erubis/context_rb.html +107 -0
  73. data/doc-api/files/erubis/converter_rb.html +114 -0
  74. data/doc-api/files/erubis/engine/ec_rb.html +2 -2
  75. data/doc-api/files/erubis/engine/ejava_rb.html +2 -2
  76. data/doc-api/files/erubis/engine/ejavascript_rb.html +2 -2
  77. data/doc-api/files/erubis/engine/enhanced_rb.html +2 -2
  78. data/doc-api/files/erubis/engine/eperl_rb.html +2 -2
  79. data/doc-api/files/erubis/engine/ephp_rb.html +2 -2
  80. data/doc-api/files/erubis/engine/eruby_rb.html +3 -2
  81. data/doc-api/files/erubis/engine/escheme_rb.html +2 -2
  82. data/doc-api/files/erubis/engine/optimized_rb.html +2 -2
  83. data/doc-api/files/erubis/engine_rb.html +6 -3
  84. data/doc-api/files/erubis/enhancer_rb.html +2 -9
  85. data/doc-api/files/erubis/error_rb.html +107 -0
  86. data/doc-api/files/erubis/evaluator_rb.html +115 -0
  87. data/doc-api/files/erubis/generator_rb.html +114 -0
  88. data/doc-api/files/erubis/helper/rails_rb.html +140 -0
  89. data/doc-api/files/erubis/helper_rb.html +1 -1
  90. data/doc-api/files/erubis/local-setting_rb.html +1 -1
  91. data/doc-api/files/erubis/main_rb.html +2 -2
  92. data/doc-api/files/erubis/tiny_rb.html +2 -2
  93. data/doc-api/files/erubis_rb.html +2 -2
  94. data/doc-api/fr_class_index.html +32 -0
  95. data/doc-api/fr_file_index.html +6 -0
  96. data/doc-api/fr_method_index.html +178 -136
  97. data/doc/users-guide.html +538 -199
  98. data/examples/{Makefile → basic/Makefile} +11 -11
  99. data/examples/basic/example.ec +42 -0
  100. data/examples/{example.ejava → basic/example.ejava} +5 -1
  101. data/examples/{example.ejavascript → basic/example.ejs} +0 -0
  102. data/examples/{example.eperl → basic/example.eperl} +2 -2
  103. data/examples/{example.ephp → basic/example.ephp} +0 -0
  104. data/examples/{example.eruby → basic/example.eruby} +0 -0
  105. data/examples/{example.escheme → basic/example.escheme} +0 -0
  106. data/examples/pi/Makefile +54 -0
  107. data/examples/pi/example.ec +42 -0
  108. data/examples/pi/example.ejava +45 -0
  109. data/examples/pi/example.ejs +16 -0
  110. data/examples/pi/example.eperl +16 -0
  111. data/examples/pi/example.ephp +17 -0
  112. data/examples/pi/example.eruby +15 -0
  113. data/examples/pi/example.escheme +26 -0
  114. data/lib/erubis.rb +15 -8
  115. data/lib/erubis/context.rb +54 -0
  116. data/lib/erubis/converter.rb +307 -0
  117. data/lib/erubis/engine.rb +57 -227
  118. data/lib/erubis/engine/ec.rb +31 -20
  119. data/lib/erubis/engine/ejava.rb +33 -21
  120. data/lib/erubis/engine/ejavascript.rb +30 -18
  121. data/lib/erubis/engine/enhanced.rb +7 -2
  122. data/lib/erubis/engine/eperl.rb +33 -19
  123. data/lib/erubis/engine/ephp.rb +32 -14
  124. data/lib/erubis/engine/eruby.rb +34 -7
  125. data/lib/erubis/engine/escheme.rb +34 -15
  126. data/lib/erubis/engine/optimized.rb +25 -11
  127. data/lib/erubis/enhancer.rb +53 -19
  128. data/lib/erubis/error.rb +24 -0
  129. data/lib/erubis/evaluator.rb +71 -0
  130. data/lib/erubis/generator.rb +83 -0
  131. data/lib/erubis/helper.rb +1 -1
  132. data/lib/erubis/helper/rails.rb +159 -0
  133. data/lib/erubis/local-setting.rb +1 -1
  134. data/lib/erubis/main.rb +87 -46
  135. data/lib/erubis/tiny.rb +81 -7
  136. data/test/assert-text-equal.rb +1 -1
  137. data/test/test-engines.rb +8 -9
  138. data/test/test-erubis.rb +196 -18
  139. data/test/{test-bin.rb → test-main.rb} +123 -21
  140. data/test/test-notext.rb +27 -0
  141. data/test/test.rb +5 -3
  142. data/test/testutil.rb +25 -36
  143. metadata +75 -13
  144. data/COPYING +0 -340
  145. data/examples/example.ec +0 -24
@@ -0,0 +1,130 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Class: Erubis::Basic::Engine</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">Erubis::Basic::Engine</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../../files/erubis/engine_rb.html">
59
+ erubis/engine.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ <a href="Engine.html">
69
+ Engine
70
+ </a>
71
+ </td>
72
+ </tr>
73
+ </table>
74
+ </div>
75
+ <!-- banner header -->
76
+
77
+ <div id="bodyContent">
78
+
79
+
80
+
81
+ <div id="contextContent">
82
+
83
+ <div id="description">
84
+ <p>
85
+ (abstract) base engine class for <a href="../Eruby.html">Eruby</a>, <a
86
+ href="../Eperl.html">Eperl</a>, <a href="../Ejava.html">Ejava</a>, and so
87
+ on. subclass must include generator.
88
+ </p>
89
+
90
+ </div>
91
+
92
+
93
+ </div>
94
+
95
+
96
+ </div>
97
+
98
+
99
+ <!-- if includes -->
100
+ <div id="includes">
101
+ <h3 class="section-bar">Included Modules</h3>
102
+
103
+ <div id="includes-list">
104
+ <span class="include-name"><a href="../Evaluator.html">Evaluator</a></span>
105
+ <span class="include-name"><a href="Converter.html">Basic::Converter</a></span>
106
+ <span class="include-name"><a href="../Generator.html">Generator</a></span>
107
+ </div>
108
+ </div>
109
+
110
+ <div id="section">
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+ <!-- if method_list -->
120
+
121
+
122
+ </div>
123
+
124
+
125
+ <div id="validator-badges">
126
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
127
+ </div>
128
+
129
+ </body>
130
+ </html>
@@ -119,8 +119,8 @@ this is language independent.
119
119
  <h3 class="section-bar">Methods</h3>
120
120
 
121
121
  <div class="name-list">
122
- <a href="#M000018">add_text</a>&nbsp;&nbsp;
123
- <a href="#M000017">new</a>&nbsp;&nbsp;
122
+ <a href="#M000118">add_text</a>&nbsp;&nbsp;
123
+ <a href="#M000117">new</a>&nbsp;&nbsp;
124
124
  </div>
125
125
  </div>
126
126
 
@@ -142,21 +142,21 @@ this is language independent.
142
142
  <div id="methods">
143
143
  <h3 class="section-bar">Public Class methods</h3>
144
144
 
145
- <div id="method-M000017" class="method-detail">
146
- <a name="M000017"></a>
145
+ <div id="method-M000117" class="method-detail">
146
+ <a name="M000117"></a>
147
147
 
148
148
  <div class="method-heading">
149
- <a href="#M000017" class="method-signature">
149
+ <a href="#M000117" class="method-signature">
150
150
  <span class="method-name">new</span><span class="method-args">(input, properties={})</span>
151
151
  </a>
152
152
  </div>
153
153
 
154
154
  <div class="method-description">
155
155
  <p><a class="source-toggle" href="#"
156
- onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
157
- <div class="method-source-code" id="M000017-source">
156
+ onclick="toggleCode('M000117-source');return false;">[Source]</a></p>
157
+ <div class="method-source-code" id="M000117-source">
158
158
  <pre>
159
- <span class="ruby-comment cmt"># File erubis/enhancer.rb, line 350</span>
159
+ <span class="ruby-comment cmt"># File erubis/enhancer.rb, line 384</span>
160
160
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">input</span>, <span class="ruby-identifier">properties</span>={})
161
161
  <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">bipattern</span> = <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:bipattern</span>] <span class="ruby-comment cmt"># or '\$\{ \}'</span>
162
162
  <span class="ruby-keyword kw">super</span>
@@ -168,21 +168,21 @@ this is language independent.
168
168
 
169
169
  <h3 class="section-bar">Public Instance methods</h3>
170
170
 
171
- <div id="method-M000018" class="method-detail">
172
- <a name="M000018"></a>
171
+ <div id="method-M000118" class="method-detail">
172
+ <a name="M000118"></a>
173
173
 
174
174
  <div class="method-heading">
175
- <a href="#M000018" class="method-signature">
175
+ <a href="#M000118" class="method-signature">
176
176
  <span class="method-name">add_text</span><span class="method-args">(src, text)</span>
177
177
  </a>
178
178
  </div>
179
179
 
180
180
  <div class="method-description">
181
181
  <p><a class="source-toggle" href="#"
182
- onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
183
- <div class="method-source-code" id="M000018-source">
182
+ onclick="toggleCode('M000118-source');return false;">[Source]</a></p>
183
+ <div class="method-source-code" id="M000118-source">
184
184
  <pre>
185
- <span class="ruby-comment cmt"># File erubis/enhancer.rb, line 362</span>
185
+ <span class="ruby-comment cmt"># File erubis/enhancer.rb, line 396</span>
186
186
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">text</span>)
187
187
  <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">text</span>
188
188
  <span class="ruby-identifier">text</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-ivar">@bipattern_regexp</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">txt</span>, <span class="ruby-identifier">indicator</span>, <span class="ruby-identifier">code</span><span class="ruby-operator">|</span>
@@ -0,0 +1,386 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Module: Erubis::CGenerator</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Module</strong></td>
53
+ <td class="class-name-in-header">Erubis::CGenerator</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/erubis/engine/ec_rb.html">
59
+ erubis/engine/ec.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ </table>
66
+ </div>
67
+ <!-- banner header -->
68
+
69
+ <div id="bodyContent">
70
+
71
+
72
+
73
+ <div id="contextContent">
74
+
75
+
76
+
77
+ </div>
78
+
79
+ <div id="method-list">
80
+ <h3 class="section-bar">Methods</h3>
81
+
82
+ <div class="name-list">
83
+ <a href="#M000115">add_expr_debug</a>&nbsp;&nbsp;
84
+ <a href="#M000114">add_expr_escaped</a>&nbsp;&nbsp;
85
+ <a href="#M000113">add_expr_literal</a>&nbsp;&nbsp;
86
+ <a href="#M000116">add_postamble</a>&nbsp;&nbsp;
87
+ <a href="#M000108">add_preamble</a>&nbsp;&nbsp;
88
+ <a href="#M000112">add_stmt</a>&nbsp;&nbsp;
89
+ <a href="#M000111">add_text</a>&nbsp;&nbsp;
90
+ <a href="#M000109">escape_text</a>&nbsp;&nbsp;
91
+ <a href="#M000110">escaped_expr</a>&nbsp;&nbsp;
92
+ <a href="#M000107">init_generator</a>&nbsp;&nbsp;
93
+ </div>
94
+ </div>
95
+
96
+ </div>
97
+
98
+
99
+ <!-- if includes -->
100
+ <div id="includes">
101
+ <h3 class="section-bar">Included Modules</h3>
102
+
103
+ <div id="includes-list">
104
+ <span class="include-name"><a href="Generator.html">Generator</a></span>
105
+ </div>
106
+ </div>
107
+
108
+ <div id="section">
109
+
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+ <!-- if method_list -->
118
+ <div id="methods">
119
+ <h3 class="section-bar">Public Instance methods</h3>
120
+
121
+ <div id="method-M000115" class="method-detail">
122
+ <a name="M000115"></a>
123
+
124
+ <div class="method-heading">
125
+ <a href="#M000115" class="method-signature">
126
+ <span class="method-name">add_expr_debug</span><span class="method-args">(src, code)</span>
127
+ </a>
128
+ </div>
129
+
130
+ <div class="method-description">
131
+ <p><a class="source-toggle" href="#"
132
+ onclick="toggleCode('M000115-source');return false;">[Source]</a></p>
133
+ <div class="method-source-code" id="M000115-source">
134
+ <pre>
135
+ <span class="ruby-comment cmt"># File erubis/engine/ec.rb, line 73</span>
136
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_expr_debug</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
137
+ <span class="ruby-identifier">code</span>.<span class="ruby-identifier">strip!</span>
138
+ <span class="ruby-identifier">s</span> = <span class="ruby-keyword kw">nil</span>
139
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">code</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/\A\&quot;.*?\&quot;\s*,\s*(.*)/</span>
140
+ <span class="ruby-identifier">s</span> = <span class="ruby-identifier">$1</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/[%&quot;]/</span>, <span class="ruby-value str">'\\\1'</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">'='</span>
141
+ <span class="ruby-keyword kw">end</span>
142
+ <span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@indent</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">src</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">src</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?\n</span>
143
+ <span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot; fprintf(stderr, \&quot;*** debug: #{s}\&quot; #{code});&quot;</span>
144
+ <span class="ruby-keyword kw">end</span>
145
+ </pre>
146
+ </div>
147
+ </div>
148
+ </div>
149
+
150
+ <div id="method-M000114" class="method-detail">
151
+ <a name="M000114"></a>
152
+
153
+ <div class="method-heading">
154
+ <a href="#M000114" class="method-signature">
155
+ <span class="method-name">add_expr_escaped</span><span class="method-args">(src, code)</span>
156
+ </a>
157
+ </div>
158
+
159
+ <div class="method-description">
160
+ <p><a class="source-toggle" href="#"
161
+ onclick="toggleCode('M000114-source');return false;">[Source]</a></p>
162
+ <div class="method-source-code" id="M000114-source">
163
+ <pre>
164
+ <span class="ruby-comment cmt"># File erubis/engine/ec.rb, line 68</span>
165
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_expr_escaped</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
166
+ <span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@indent</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">src</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">src</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?\n</span>
167
+ <span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">' '</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">escaped_expr</span>(<span class="ruby-identifier">code</span>) <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">';'</span>
168
+ <span class="ruby-keyword kw">end</span>
169
+ </pre>
170
+ </div>
171
+ </div>
172
+ </div>
173
+
174
+ <div id="method-M000113" class="method-detail">
175
+ <a name="M000113"></a>
176
+
177
+ <div class="method-heading">
178
+ <a href="#M000113" class="method-signature">
179
+ <span class="method-name">add_expr_literal</span><span class="method-args">(src, code)</span>
180
+ </a>
181
+ </div>
182
+
183
+ <div class="method-description">
184
+ <p><a class="source-toggle" href="#"
185
+ onclick="toggleCode('M000113-source');return false;">[Source]</a></p>
186
+ <div class="method-source-code" id="M000113-source">
187
+ <pre>
188
+ <span class="ruby-comment cmt"># File erubis/engine/ec.rb, line 63</span>
189
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_expr_literal</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
190
+ <span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@indent</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">src</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">src</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?\n</span>
191
+ <span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot; fprintf(#{@out}, &quot;</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">code</span>.<span class="ruby-identifier">strip</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">');'</span>
192
+ <span class="ruby-keyword kw">end</span>
193
+ </pre>
194
+ </div>
195
+ </div>
196
+ </div>
197
+
198
+ <div id="method-M000116" class="method-detail">
199
+ <a name="M000116"></a>
200
+
201
+ <div class="method-heading">
202
+ <a href="#M000116" class="method-signature">
203
+ <span class="method-name">add_postamble</span><span class="method-args">(src)</span>
204
+ </a>
205
+ </div>
206
+
207
+ <div class="method-description">
208
+ <p><a class="source-toggle" href="#"
209
+ onclick="toggleCode('M000116-source');return false;">[Source]</a></p>
210
+ <div class="method-source-code" id="M000116-source">
211
+ <pre>
212
+ <span class="ruby-comment cmt"># File erubis/engine/ec.rb, line 83</span>
213
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_postamble</span>(<span class="ruby-identifier">src</span>)
214
+ <span class="ruby-comment cmt"># empty</span>
215
+ <span class="ruby-keyword kw">end</span>
216
+ </pre>
217
+ </div>
218
+ </div>
219
+ </div>
220
+
221
+ <div id="method-M000108" class="method-detail">
222
+ <a name="M000108"></a>
223
+
224
+ <div class="method-heading">
225
+ <a href="#M000108" class="method-signature">
226
+ <span class="method-name">add_preamble</span><span class="method-args">(src)</span>
227
+ </a>
228
+ </div>
229
+
230
+ <div class="method-description">
231
+ <p><a class="source-toggle" href="#"
232
+ onclick="toggleCode('M000108-source');return false;">[Source]</a></p>
233
+ <div class="method-source-code" id="M000108-source">
234
+ <pre>
235
+ <span class="ruby-comment cmt"># File erubis/engine/ec.rb, line 31</span>
236
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_preamble</span>(<span class="ruby-identifier">src</span>)
237
+ <span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;#line 1 \&quot;#{self.filename}\&quot;\n&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">filename</span>
238
+ <span class="ruby-keyword kw">end</span>
239
+ </pre>
240
+ </div>
241
+ </div>
242
+ </div>
243
+
244
+ <div id="method-M000112" class="method-detail">
245
+ <a name="M000112"></a>
246
+
247
+ <div class="method-heading">
248
+ <a href="#M000112" class="method-signature">
249
+ <span class="method-name">add_stmt</span><span class="method-args">(src, code)</span>
250
+ </a>
251
+ </div>
252
+
253
+ <div class="method-description">
254
+ <p><a class="source-toggle" href="#"
255
+ onclick="toggleCode('M000112-source');return false;">[Source]</a></p>
256
+ <div class="method-source-code" id="M000112-source">
257
+ <pre>
258
+ <span class="ruby-comment cmt"># File erubis/engine/ec.rb, line 59</span>
259
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_stmt</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
260
+ <span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">code</span>
261
+ <span class="ruby-keyword kw">end</span>
262
+ </pre>
263
+ </div>
264
+ </div>
265
+ </div>
266
+
267
+ <div id="method-M000111" class="method-detail">
268
+ <a name="M000111"></a>
269
+
270
+ <div class="method-heading">
271
+ <a href="#M000111" class="method-signature">
272
+ <span class="method-name">add_text</span><span class="method-args">(src, text)</span>
273
+ </a>
274
+ </div>
275
+
276
+ <div class="method-description">
277
+ <p><a class="source-toggle" href="#"
278
+ onclick="toggleCode('M000111-source');return false;">[Source]</a></p>
279
+ <div class="method-source-code" id="M000111-source">
280
+ <pre>
281
+ <span class="ruby-comment cmt"># File erubis/engine/ec.rb, line 45</span>
282
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">text</span>)
283
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">text</span>.<span class="ruby-identifier">empty?</span>
284
+ <span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> (<span class="ruby-identifier">src</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">src</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?\n</span> <span class="ruby-operator">?</span> <span class="ruby-ivar">@indent</span> <span class="ruby-operator">:</span> <span class="ruby-value str">' '</span>)
285
+ <span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;fputs(&quot;</span>
286
+ <span class="ruby-identifier">i</span> = <span class="ruby-value">0</span>
287
+ <span class="ruby-identifier">text</span>.<span class="ruby-identifier">each_line</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
288
+ <span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;\n&quot;</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@indent</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">' '</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">i</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
289
+ <span class="ruby-identifier">i</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
290
+ <span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">'&quot;'</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">escape_text</span>(<span class="ruby-identifier">line</span>) <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">'&quot;'</span>
291
+ <span class="ruby-keyword kw">end</span>
292
+ <span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;, #{@out});&quot;</span> <span class="ruby-comment cmt">#&lt;&lt; (text[-1] == ?\n ? &quot;\n&quot; : &quot;&quot;)</span>
293
+ <span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;\n&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">text</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?\n</span>
294
+ <span class="ruby-keyword kw">end</span>
295
+ </pre>
296
+ </div>
297
+ </div>
298
+ </div>
299
+
300
+ <div id="method-M000109" class="method-detail">
301
+ <a name="M000109"></a>
302
+
303
+ <div class="method-heading">
304
+ <a href="#M000109" class="method-signature">
305
+ <span class="method-name">escape_text</span><span class="method-args">(text)</span>
306
+ </a>
307
+ </div>
308
+
309
+ <div class="method-description">
310
+ <p><a class="source-toggle" href="#"
311
+ onclick="toggleCode('M000109-source');return false;">[Source]</a></p>
312
+ <div class="method-source-code" id="M000109-source">
313
+ <pre>
314
+ <span class="ruby-comment cmt"># File erubis/engine/ec.rb, line 35</span>
315
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">escape_text</span>(<span class="ruby-identifier">text</span>)
316
+ <span class="ruby-ivar">@@table_</span> <span class="ruby-operator">||=</span> { <span class="ruby-value str">&quot;\r&quot;</span>=<span class="ruby-operator">&gt;</span><span class="ruby-value str">&quot;\\r&quot;</span>, <span class="ruby-value str">&quot;\n&quot;</span>=<span class="ruby-operator">&gt;</span><span class="ruby-value str">&quot;\\n&quot;</span>, <span class="ruby-value str">&quot;\t&quot;</span>=<span class="ruby-operator">&gt;</span><span class="ruby-value str">&quot;\\t&quot;</span>, <span class="ruby-value str">'&quot;'</span>=<span class="ruby-operator">&gt;</span><span class="ruby-value str">'\\&quot;'</span>, <span class="ruby-value str">&quot;\\&quot;</span>=<span class="ruby-operator">&gt;</span><span class="ruby-value str">&quot;\\\\&quot;</span> }
317
+ <span class="ruby-identifier">text</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/[\r\n\t&quot;\\]/</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@@table_</span>[<span class="ruby-identifier">m</span>] }
318
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">text</span>
319
+ <span class="ruby-keyword kw">end</span>
320
+ </pre>
321
+ </div>
322
+ </div>
323
+ </div>
324
+
325
+ <div id="method-M000110" class="method-detail">
326
+ <a name="M000110"></a>
327
+
328
+ <div class="method-heading">
329
+ <a href="#M000110" class="method-signature">
330
+ <span class="method-name">escaped_expr</span><span class="method-args">(code)</span>
331
+ </a>
332
+ </div>
333
+
334
+ <div class="method-description">
335
+ <p><a class="source-toggle" href="#"
336
+ onclick="toggleCode('M000110-source');return false;">[Source]</a></p>
337
+ <div class="method-source-code" id="M000110-source">
338
+ <pre>
339
+ <span class="ruby-comment cmt"># File erubis/engine/ec.rb, line 41</span>
340
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">escaped_expr</span>(<span class="ruby-identifier">code</span>)
341
+ <span class="ruby-keyword kw">return</span> <span class="ruby-node">&quot;#{@escapefunc}(#{code.strip}, #{@out})&quot;</span>
342
+ <span class="ruby-keyword kw">end</span>
343
+ </pre>
344
+ </div>
345
+ </div>
346
+ </div>
347
+
348
+ <div id="method-M000107" class="method-detail">
349
+ <a name="M000107"></a>
350
+
351
+ <div class="method-heading">
352
+ <a href="#M000107" class="method-signature">
353
+ <span class="method-name">init_generator</span><span class="method-args">(properties={})</span>
354
+ </a>
355
+ </div>
356
+
357
+ <div class="method-description">
358
+ <p><a class="source-toggle" href="#"
359
+ onclick="toggleCode('M000107-source');return false;">[Source]</a></p>
360
+ <div class="method-source-code" id="M000107-source">
361
+ <pre>
362
+ <span class="ruby-comment cmt"># File erubis/engine/ec.rb, line 24</span>
363
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">init_generator</span>(<span class="ruby-identifier">properties</span>={})
364
+ <span class="ruby-keyword kw">super</span>
365
+ <span class="ruby-ivar">@escapefunc</span> <span class="ruby-operator">||=</span> <span class="ruby-value str">&quot;escape&quot;</span>
366
+ <span class="ruby-ivar">@indent</span> = <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:indent</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">''</span>
367
+ <span class="ruby-ivar">@out</span> = <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:out</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">'stdout'</span>
368
+ <span class="ruby-keyword kw">end</span>
369
+ </pre>
370
+ </div>
371
+ </div>
372
+ </div>
373
+
374
+
375
+ </div>
376
+
377
+
378
+ </div>
379
+
380
+
381
+ <div id="validator-badges">
382
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
383
+ </div>
384
+
385
+ </body>
386
+ </html>