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
@@ -92,7 +92,7 @@ this is language-independent.
92
92
  <h3 class="section-bar">Methods</h3>
93
93
 
94
94
  <div class="name-list">
95
- <a href="#M000022">add_text</a>&nbsp;&nbsp;
95
+ <a href="#M000152">add_text</a>&nbsp;&nbsp;
96
96
  </div>
97
97
  </div>
98
98
 
@@ -127,21 +127,21 @@ this is language-independent.
127
127
  <div id="methods">
128
128
  <h3 class="section-bar">Public Instance methods</h3>
129
129
 
130
- <div id="method-M000022" class="method-detail">
131
- <a name="M000022"></a>
130
+ <div id="method-M000152" class="method-detail">
131
+ <a name="M000152"></a>
132
132
 
133
133
  <div class="method-heading">
134
- <a href="#M000022" class="method-signature">
134
+ <a href="#M000152" class="method-signature">
135
135
  <span class="method-name">add_text</span><span class="method-args">(src, text)</span>
136
136
  </a>
137
137
  </div>
138
138
 
139
139
  <div class="method-description">
140
140
  <p><a class="source-toggle" href="#"
141
- onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
142
- <div class="method-source-code" id="M000022-source">
141
+ onclick="toggleCode('M000152-source');return false;">[Source]</a></p>
142
+ <div class="method-source-code" id="M000152-source">
143
143
  <pre>
144
- <span class="ruby-comment cmt"># File erubis/enhancer.rb, line 390</span>
144
+ <span class="ruby-comment cmt"># File erubis/enhancer.rb, line 424</span>
145
145
  <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>)
146
146
  <span class="ruby-identifier">text</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-constant">PERCENT_LINE_PATTERN</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">txt</span>, <span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
147
147
  <span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">txt</span>)
@@ -0,0 +1,344 @@
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::PerlGenerator</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::PerlGenerator</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/erubis/engine/eperl_rb.html">
59
+ erubis/engine/eperl.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="#M000069">add_expr_debug</a>&nbsp;&nbsp;
84
+ <a href="#M000068">add_expr_escaped</a>&nbsp;&nbsp;
85
+ <a href="#M000067">add_expr_literal</a>&nbsp;&nbsp;
86
+ <a href="#M000071">add_postamble</a>&nbsp;&nbsp;
87
+ <a href="#M000064">add_preamble</a>&nbsp;&nbsp;
88
+ <a href="#M000070">add_stmt</a>&nbsp;&nbsp;
89
+ <a href="#M000066">add_text</a>&nbsp;&nbsp;
90
+ <a href="#M000065">escape_text</a>&nbsp;&nbsp;
91
+ <a href="#M000063">init_generator</a>&nbsp;&nbsp;
92
+ </div>
93
+ </div>
94
+
95
+ </div>
96
+
97
+
98
+ <!-- if includes -->
99
+ <div id="includes">
100
+ <h3 class="section-bar">Included Modules</h3>
101
+
102
+ <div id="includes-list">
103
+ <span class="include-name"><a href="Generator.html">Generator</a></span>
104
+ </div>
105
+ </div>
106
+
107
+ <div id="section">
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+
116
+ <!-- if method_list -->
117
+ <div id="methods">
118
+ <h3 class="section-bar">Public Instance methods</h3>
119
+
120
+ <div id="method-M000069" class="method-detail">
121
+ <a name="M000069"></a>
122
+
123
+ <div class="method-heading">
124
+ <a href="#M000069" class="method-signature">
125
+ <span class="method-name">add_expr_debug</span><span class="method-args">(src, code)</span>
126
+ </a>
127
+ </div>
128
+
129
+ <div class="method-description">
130
+ <p><a class="source-toggle" href="#"
131
+ onclick="toggleCode('M000069-source');return false;">[Source]</a></p>
132
+ <div class="method-source-code" id="M000069-source">
133
+ <pre>
134
+ <span class="ruby-comment cmt"># File erubis/engine/eperl.rb, line 50</span>
135
+ <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>)
136
+ <span class="ruby-identifier">code</span>.<span class="ruby-identifier">strip!</span>
137
+ <span class="ruby-identifier">s</span> = <span class="ruby-identifier">code</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\'/</span>, <span class="ruby-value str">&quot;\\'&quot;</span>)
138
+ <span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@func</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;('*** debug: #{code}=', #{code}, \&quot;\\n\&quot;);&quot;</span>
139
+ <span class="ruby-keyword kw">end</span>
140
+ </pre>
141
+ </div>
142
+ </div>
143
+ </div>
144
+
145
+ <div id="method-M000068" class="method-detail">
146
+ <a name="M000068"></a>
147
+
148
+ <div class="method-heading">
149
+ <a href="#M000068" class="method-signature">
150
+ <span class="method-name">add_expr_escaped</span><span class="method-args">(src, code)</span>
151
+ </a>
152
+ </div>
153
+
154
+ <div class="method-description">
155
+ <p><a class="source-toggle" href="#"
156
+ onclick="toggleCode('M000068-source');return false;">[Source]</a></p>
157
+ <div class="method-source-code" id="M000068-source">
158
+ <pre>
159
+ <span class="ruby-comment cmt"># File erubis/engine/eperl.rb, line 46</span>
160
+ <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>)
161
+ <span class="ruby-identifier">add_expr_literal</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">escaped_expr</span>(<span class="ruby-identifier">code</span>))
162
+ <span class="ruby-keyword kw">end</span>
163
+ </pre>
164
+ </div>
165
+ </div>
166
+ </div>
167
+
168
+ <div id="method-M000067" class="method-detail">
169
+ <a name="M000067"></a>
170
+
171
+ <div class="method-heading">
172
+ <a href="#M000067" class="method-signature">
173
+ <span class="method-name">add_expr_literal</span><span class="method-args">(src, code)</span>
174
+ </a>
175
+ </div>
176
+
177
+ <div class="method-description">
178
+ <p><a class="source-toggle" href="#"
179
+ onclick="toggleCode('M000067-source');return false;">[Source]</a></p>
180
+ <div class="method-source-code" id="M000067-source">
181
+ <pre>
182
+ <span class="ruby-comment cmt"># File erubis/engine/eperl.rb, line 41</span>
183
+ <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>)
184
+ <span class="ruby-identifier">code</span>.<span class="ruby-identifier">strip!</span>
185
+ <span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@func</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;(&quot;</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">code</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;); &quot;</span>
186
+ <span class="ruby-keyword kw">end</span>
187
+ </pre>
188
+ </div>
189
+ </div>
190
+ </div>
191
+
192
+ <div id="method-M000071" class="method-detail">
193
+ <a name="M000071"></a>
194
+
195
+ <div class="method-heading">
196
+ <a href="#M000071" class="method-signature">
197
+ <span class="method-name">add_postamble</span><span class="method-args">(src)</span>
198
+ </a>
199
+ </div>
200
+
201
+ <div class="method-description">
202
+ <p><a class="source-toggle" href="#"
203
+ onclick="toggleCode('M000071-source');return false;">[Source]</a></p>
204
+ <div class="method-source-code" id="M000071-source">
205
+ <pre>
206
+ <span class="ruby-comment cmt"># File erubis/engine/eperl.rb, line 60</span>
207
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_postamble</span>(<span class="ruby-identifier">src</span>)
208
+ <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">unless</span> <span class="ruby-identifier">src</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?\n</span>
209
+ <span class="ruby-keyword kw">end</span>
210
+ </pre>
211
+ </div>
212
+ </div>
213
+ </div>
214
+
215
+ <div id="method-M000064" class="method-detail">
216
+ <a name="M000064"></a>
217
+
218
+ <div class="method-heading">
219
+ <a href="#M000064" class="method-signature">
220
+ <span class="method-name">add_preamble</span><span class="method-args">(src)</span>
221
+ </a>
222
+ </div>
223
+
224
+ <div class="method-description">
225
+ <p><a class="source-toggle" href="#"
226
+ onclick="toggleCode('M000064-source');return false;">[Source]</a></p>
227
+ <div class="method-source-code" id="M000064-source">
228
+ <pre>
229
+ <span class="ruby-comment cmt"># File erubis/engine/eperl.rb, line 29</span>
230
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_preamble</span>(<span class="ruby-identifier">src</span>)
231
+ <span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;use HTML::Entities; &quot;</span>;
232
+ <span class="ruby-keyword kw">end</span>
233
+ </pre>
234
+ </div>
235
+ </div>
236
+ </div>
237
+
238
+ <div id="method-M000070" class="method-detail">
239
+ <a name="M000070"></a>
240
+
241
+ <div class="method-heading">
242
+ <a href="#M000070" class="method-signature">
243
+ <span class="method-name">add_stmt</span><span class="method-args">(src, code)</span>
244
+ </a>
245
+ </div>
246
+
247
+ <div class="method-description">
248
+ <p><a class="source-toggle" href="#"
249
+ onclick="toggleCode('M000070-source');return false;">[Source]</a></p>
250
+ <div class="method-source-code" id="M000070-source">
251
+ <pre>
252
+ <span class="ruby-comment cmt"># File erubis/engine/eperl.rb, line 56</span>
253
+ <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>)
254
+ <span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">code</span>
255
+ <span class="ruby-keyword kw">end</span>
256
+ </pre>
257
+ </div>
258
+ </div>
259
+ </div>
260
+
261
+ <div id="method-M000066" class="method-detail">
262
+ <a name="M000066"></a>
263
+
264
+ <div class="method-heading">
265
+ <a href="#M000066" class="method-signature">
266
+ <span class="method-name">add_text</span><span class="method-args">(src, text)</span>
267
+ </a>
268
+ </div>
269
+
270
+ <div class="method-description">
271
+ <p><a class="source-toggle" href="#"
272
+ onclick="toggleCode('M000066-source');return false;">[Source]</a></p>
273
+ <div class="method-source-code" id="M000066-source">
274
+ <pre>
275
+ <span class="ruby-comment cmt"># File erubis/engine/eperl.rb, line 37</span>
276
+ <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>)
277
+ <span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@func</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;('&quot;</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">escape_text</span>(<span class="ruby-identifier">text</span>) <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;'); &quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">text</span>.<span class="ruby-identifier">empty?</span>
278
+ <span class="ruby-keyword kw">end</span>
279
+ </pre>
280
+ </div>
281
+ </div>
282
+ </div>
283
+
284
+ <div id="method-M000065" class="method-detail">
285
+ <a name="M000065"></a>
286
+
287
+ <div class="method-heading">
288
+ <a href="#M000065" class="method-signature">
289
+ <span class="method-name">escape_text</span><span class="method-args">(text)</span>
290
+ </a>
291
+ </div>
292
+
293
+ <div class="method-description">
294
+ <p><a class="source-toggle" href="#"
295
+ onclick="toggleCode('M000065-source');return false;">[Source]</a></p>
296
+ <div class="method-source-code" id="M000065-source">
297
+ <pre>
298
+ <span class="ruby-comment cmt"># File erubis/engine/eperl.rb, line 33</span>
299
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">escape_text</span>(<span class="ruby-identifier">text</span>)
300
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">text</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/['\\]/</span>, <span class="ruby-value str">'\\\\\&amp;'</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">text</span>
301
+ <span class="ruby-keyword kw">end</span>
302
+ </pre>
303
+ </div>
304
+ </div>
305
+ </div>
306
+
307
+ <div id="method-M000063" class="method-detail">
308
+ <a name="M000063"></a>
309
+
310
+ <div class="method-heading">
311
+ <a href="#M000063" class="method-signature">
312
+ <span class="method-name">init_generator</span><span class="method-args">(properties={})</span>
313
+ </a>
314
+ </div>
315
+
316
+ <div class="method-description">
317
+ <p><a class="source-toggle" href="#"
318
+ onclick="toggleCode('M000063-source');return false;">[Source]</a></p>
319
+ <div class="method-source-code" id="M000063-source">
320
+ <pre>
321
+ <span class="ruby-comment cmt"># File erubis/engine/eperl.rb, line 23</span>
322
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">init_generator</span>(<span class="ruby-identifier">properties</span>={})
323
+ <span class="ruby-keyword kw">super</span>
324
+ <span class="ruby-ivar">@escapefunc</span> <span class="ruby-operator">||=</span> <span class="ruby-value str">'encode_entities'</span>
325
+ <span class="ruby-ivar">@func</span> = <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:func</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">'print'</span>
326
+ <span class="ruby-keyword kw">end</span>
327
+ </pre>
328
+ </div>
329
+ </div>
330
+ </div>
331
+
332
+
333
+ </div>
334
+
335
+
336
+ </div>
337
+
338
+
339
+ <div id="validator-badges">
340
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
341
+ </div>
342
+
343
+ </body>
344
+ </html>
@@ -0,0 +1,350 @@
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::PhpGenerator</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::PhpGenerator</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/erubis/engine/ephp_rb.html">
59
+ erubis/engine/ephp.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="#M000104">add_expr_debug</a>&nbsp;&nbsp;
84
+ <a href="#M000103">add_expr_escaped</a>&nbsp;&nbsp;
85
+ <a href="#M000102">add_expr_literal</a>&nbsp;&nbsp;
86
+ <a href="#M000106">add_postamble</a>&nbsp;&nbsp;
87
+ <a href="#M000099">add_preamble</a>&nbsp;&nbsp;
88
+ <a href="#M000105">add_stmt</a>&nbsp;&nbsp;
89
+ <a href="#M000101">add_text</a>&nbsp;&nbsp;
90
+ <a href="#M000100">escape_text</a>&nbsp;&nbsp;
91
+ <a href="#M000098">init_generator</a>&nbsp;&nbsp;
92
+ </div>
93
+ </div>
94
+
95
+ </div>
96
+
97
+
98
+ <!-- if includes -->
99
+ <div id="includes">
100
+ <h3 class="section-bar">Included Modules</h3>
101
+
102
+ <div id="includes-list">
103
+ <span class="include-name"><a href="Generator.html">Generator</a></span>
104
+ </div>
105
+ </div>
106
+
107
+ <div id="section">
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+
116
+ <!-- if method_list -->
117
+ <div id="methods">
118
+ <h3 class="section-bar">Public Instance methods</h3>
119
+
120
+ <div id="method-M000104" class="method-detail">
121
+ <a name="M000104"></a>
122
+
123
+ <div class="method-heading">
124
+ <a href="#M000104" class="method-signature">
125
+ <span class="method-name">add_expr_debug</span><span class="method-args">(src, code)</span>
126
+ </a>
127
+ </div>
128
+
129
+ <div class="method-description">
130
+ <p><a class="source-toggle" href="#"
131
+ onclick="toggleCode('M000104-source');return false;">[Source]</a></p>
132
+ <div class="method-source-code" id="M000104-source">
133
+ <pre>
134
+ <span class="ruby-comment cmt"># File erubis/engine/ephp.rb, line 47</span>
135
+ <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>)
136
+ <span class="ruby-identifier">code</span>.<span class="ruby-identifier">strip!</span>
137
+ <span class="ruby-identifier">s</span> = <span class="ruby-identifier">code</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\'/</span>, <span class="ruby-value str">&quot;\\'&quot;</span>)
138
+ <span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;&lt;?php error_log('*** debug: #{s}='.(#{code}), 0); ?&gt;&quot;</span>
139
+ <span class="ruby-keyword kw">end</span>
140
+ </pre>
141
+ </div>
142
+ </div>
143
+ </div>
144
+
145
+ <div id="method-M000103" class="method-detail">
146
+ <a name="M000103"></a>
147
+
148
+ <div class="method-heading">
149
+ <a href="#M000103" class="method-signature">
150
+ <span class="method-name">add_expr_escaped</span><span class="method-args">(src, code)</span>
151
+ </a>
152
+ </div>
153
+
154
+ <div class="method-description">
155
+ <p><a class="source-toggle" href="#"
156
+ onclick="toggleCode('M000103-source');return false;">[Source]</a></p>
157
+ <div class="method-source-code" id="M000103-source">
158
+ <pre>
159
+ <span class="ruby-comment cmt"># File erubis/engine/ephp.rb, line 43</span>
160
+ <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>)
161
+ <span class="ruby-identifier">add_expr_literal</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">escaped_expr</span>(<span class="ruby-identifier">code</span>))
162
+ <span class="ruby-keyword kw">end</span>
163
+ </pre>
164
+ </div>
165
+ </div>
166
+ </div>
167
+
168
+ <div id="method-M000102" class="method-detail">
169
+ <a name="M000102"></a>
170
+
171
+ <div class="method-heading">
172
+ <a href="#M000102" class="method-signature">
173
+ <span class="method-name">add_expr_literal</span><span class="method-args">(src, code)</span>
174
+ </a>
175
+ </div>
176
+
177
+ <div class="method-description">
178
+ <p><a class="source-toggle" href="#"
179
+ onclick="toggleCode('M000102-source');return false;">[Source]</a></p>
180
+ <div class="method-source-code" id="M000102-source">
181
+ <pre>
182
+ <span class="ruby-comment cmt"># File erubis/engine/ephp.rb, line 38</span>
183
+ <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>)
184
+ <span class="ruby-identifier">code</span>.<span class="ruby-identifier">strip!</span>
185
+ <span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;&lt;?php echo #{code}; ?&gt;&quot;</span>
186
+ <span class="ruby-keyword kw">end</span>
187
+ </pre>
188
+ </div>
189
+ </div>
190
+ </div>
191
+
192
+ <div id="method-M000106" class="method-detail">
193
+ <a name="M000106"></a>
194
+
195
+ <div class="method-heading">
196
+ <a href="#M000106" class="method-signature">
197
+ <span class="method-name">add_postamble</span><span class="method-args">(src)</span>
198
+ </a>
199
+ </div>
200
+
201
+ <div class="method-description">
202
+ <p><a class="source-toggle" href="#"
203
+ onclick="toggleCode('M000106-source');return false;">[Source]</a></p>
204
+ <div class="method-source-code" id="M000106-source">
205
+ <pre>
206
+ <span class="ruby-comment cmt"># File erubis/engine/ephp.rb, line 64</span>
207
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_postamble</span>(<span class="ruby-identifier">src</span>)
208
+ <span class="ruby-comment cmt"># empty</span>
209
+ <span class="ruby-keyword kw">end</span>
210
+ </pre>
211
+ </div>
212
+ </div>
213
+ </div>
214
+
215
+ <div id="method-M000099" class="method-detail">
216
+ <a name="M000099"></a>
217
+
218
+ <div class="method-heading">
219
+ <a href="#M000099" class="method-signature">
220
+ <span class="method-name">add_preamble</span><span class="method-args">(src)</span>
221
+ </a>
222
+ </div>
223
+
224
+ <div class="method-description">
225
+ <p><a class="source-toggle" href="#"
226
+ onclick="toggleCode('M000099-source');return false;">[Source]</a></p>
227
+ <div class="method-source-code" id="M000099-source">
228
+ <pre>
229
+ <span class="ruby-comment cmt"># File erubis/engine/ephp.rb, line 26</span>
230
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_preamble</span>(<span class="ruby-identifier">src</span>)
231
+ <span class="ruby-comment cmt"># empty</span>
232
+ <span class="ruby-keyword kw">end</span>
233
+ </pre>
234
+ </div>
235
+ </div>
236
+ </div>
237
+
238
+ <div id="method-M000105" class="method-detail">
239
+ <a name="M000105"></a>
240
+
241
+ <div class="method-heading">
242
+ <a href="#M000105" class="method-signature">
243
+ <span class="method-name">add_stmt</span><span class="method-args">(src, code)</span>
244
+ </a>
245
+ </div>
246
+
247
+ <div class="method-description">
248
+ <p><a class="source-toggle" href="#"
249
+ onclick="toggleCode('M000105-source');return false;">[Source]</a></p>
250
+ <div class="method-source-code" id="M000105-source">
251
+ <pre>
252
+ <span class="ruby-comment cmt"># File erubis/engine/ephp.rb, line 53</span>
253
+ <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>)
254
+ <span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;&lt;?php&quot;</span>
255
+ <span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot; &quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">code</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">!=</span> <span class="ruby-value">?\ </span><span class="ruby-comment cmt">#</span>
256
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">code</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?\n</span>
257
+ <span class="ruby-identifier">code</span>.<span class="ruby-identifier">chomp!</span>
258
+ <span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">code</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;?&gt;\n&quot;</span>
259
+ <span class="ruby-keyword kw">else</span>
260
+ <span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">code</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;?&gt;&quot;</span>
261
+ <span class="ruby-keyword kw">end</span>
262
+ <span class="ruby-keyword kw">end</span>
263
+ </pre>
264
+ </div>
265
+ </div>
266
+ </div>
267
+
268
+ <div id="method-M000101" class="method-detail">
269
+ <a name="M000101"></a>
270
+
271
+ <div class="method-heading">
272
+ <a href="#M000101" class="method-signature">
273
+ <span class="method-name">add_text</span><span class="method-args">(src, text)</span>
274
+ </a>
275
+ </div>
276
+
277
+ <div class="method-description">
278
+ <p><a class="source-toggle" href="#"
279
+ onclick="toggleCode('M000101-source');return false;">[Source]</a></p>
280
+ <div class="method-source-code" id="M000101-source">
281
+ <pre>
282
+ <span class="ruby-comment cmt"># File erubis/engine/ephp.rb, line 34</span>
283
+ <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>)
284
+ <span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">escape_text</span>(<span class="ruby-identifier">text</span>)
285
+ <span class="ruby-keyword kw">end</span>
286
+ </pre>
287
+ </div>
288
+ </div>
289
+ </div>
290
+
291
+ <div id="method-M000100" class="method-detail">
292
+ <a name="M000100"></a>
293
+
294
+ <div class="method-heading">
295
+ <a href="#M000100" class="method-signature">
296
+ <span class="method-name">escape_text</span><span class="method-args">(text)</span>
297
+ </a>
298
+ </div>
299
+
300
+ <div class="method-description">
301
+ <p><a class="source-toggle" href="#"
302
+ onclick="toggleCode('M000100-source');return false;">[Source]</a></p>
303
+ <div class="method-source-code" id="M000100-source">
304
+ <pre>
305
+ <span class="ruby-comment cmt"># File erubis/engine/ephp.rb, line 30</span>
306
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">escape_text</span>(<span class="ruby-identifier">text</span>)
307
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">text</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/&lt;\?xml\b/</span>, <span class="ruby-value str">'&lt;&lt;?php ?&gt;?xml'</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">text</span>
308
+ <span class="ruby-keyword kw">end</span>
309
+ </pre>
310
+ </div>
311
+ </div>
312
+ </div>
313
+
314
+ <div id="method-M000098" class="method-detail">
315
+ <a name="M000098"></a>
316
+
317
+ <div class="method-heading">
318
+ <a href="#M000098" class="method-signature">
319
+ <span class="method-name">init_generator</span><span class="method-args">(properties={})</span>
320
+ </a>
321
+ </div>
322
+
323
+ <div class="method-description">
324
+ <p><a class="source-toggle" href="#"
325
+ onclick="toggleCode('M000098-source');return false;">[Source]</a></p>
326
+ <div class="method-source-code" id="M000098-source">
327
+ <pre>
328
+ <span class="ruby-comment cmt"># File erubis/engine/ephp.rb, line 21</span>
329
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">init_generator</span>(<span class="ruby-identifier">properties</span>={})
330
+ <span class="ruby-keyword kw">super</span>
331
+ <span class="ruby-ivar">@escapefunc</span> <span class="ruby-operator">||=</span> <span class="ruby-value str">'htmlspecialchars'</span>
332
+ <span class="ruby-keyword kw">end</span>
333
+ </pre>
334
+ </div>
335
+ </div>
336
+ </div>
337
+
338
+
339
+ </div>
340
+
341
+
342
+ </div>
343
+
344
+
345
+ <div id="validator-badges">
346
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
347
+ </div>
348
+
349
+ </body>
350
+ </html>