tenjin 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.txt +54 -0
- data/benchmark/bench.rb +502 -0
- data/benchmark/bench_context.rb +17 -0
- data/benchmark/bench_context.yaml +141 -0
- data/benchmark/templates/_footer.html +4 -0
- data/benchmark/templates/_header.html +52 -0
- data/benchmark/templates/bench_eruby.rhtml +29 -0
- data/benchmark/templates/bench_tenjin.rbhtml +29 -0
- data/bin/rbtenjin +449 -0
- data/doc-api/classes/Tenjin.html +141 -0
- data/doc-api/classes/Tenjin/ArrayBufferTemplate.html +270 -0
- data/doc-api/classes/Tenjin/BaseContext.html +312 -0
- data/doc-api/classes/Tenjin/Context.html +126 -0
- data/doc-api/classes/Tenjin/ContextHelper.html +433 -0
- data/doc-api/classes/Tenjin/Engine.html +616 -0
- data/doc-api/classes/Tenjin/ErubisTemplate.html +166 -0
- data/doc-api/classes/Tenjin/HtmlHelper.html +359 -0
- data/doc-api/classes/Tenjin/Preprocessor.html +242 -0
- data/doc-api/classes/Tenjin/Template.html +916 -0
- data/doc-api/created.rid +1 -0
- data/doc-api/files/README_txt.html +185 -0
- data/doc-api/files/lib/tenjin_rb.html +136 -0
- data/doc-api/fr_class_index.html +36 -0
- data/doc-api/fr_file_index.html +28 -0
- data/doc-api/fr_method_index.html +89 -0
- data/doc-api/index.html +24 -0
- data/doc-api/rdoc-style.css +208 -0
- data/doc/docstyle.css +188 -0
- data/doc/examples.html +312 -0
- data/doc/faq.html +909 -0
- data/doc/users-guide.html +1691 -0
- data/lib/tenjin.rb +959 -0
- data/setup.rb +1331 -0
- data/tenjin.gemspec +58 -0
- data/test/assert-text-equal.rb +45 -0
- data/test/data/examples/form/create.rbhtml +4 -0
- data/test/data/examples/form/form.rbhtml +14 -0
- data/test/data/examples/form/layout.rbhtml +8 -0
- data/test/data/examples/form/main.rb +9 -0
- data/test/data/examples/form/main.result +21 -0
- data/test/data/examples/form/update.rbhtml +4 -0
- data/test/data/examples/preprocessing/helper.rb +16 -0
- data/test/data/examples/preprocessing/main.rb +11 -0
- data/test/data/examples/preprocessing/main.result +17 -0
- data/test/data/examples/preprocessing/select.rbhtml +15 -0
- data/test/data/examples/preprocessing/select_P.result +18 -0
- data/test/data/examples/table/table.rb +9 -0
- data/test/data/examples/table/table.rbhtml +16 -0
- data/test/data/examples/table/table.result +20 -0
- data/test/data/examples/table/table_s.result +18 -0
- data/test/data/faq/ex1.rbhtml +5 -0
- data/test/data/faq/ex10-baselayout.rbhtml +27 -0
- data/test/data/faq/ex10-content.rbhtml +12 -0
- data/test/data/faq/ex10-customlayout.rbhtml +11 -0
- data/test/data/faq/ex10_inherit.result +25 -0
- data/test/data/faq/ex11-bench.rb +28 -0
- data/test/data/faq/ex11-content.rbhtml +9 -0
- data/test/data/faq/ex11-layout1.rbhtml +5 -0
- data/test/data/faq/ex11-layout2.rbhtml +6 -0
- data/test/data/faq/ex11.rb +5 -0
- data/test/data/faq/ex11.rbhtml +8 -0
- data/test/data/faq/ex11.source +11 -0
- data/test/data/faq/ex11_arraybuffer.result +15 -0
- data/test/data/faq/ex1_chksyntax.result +3 -0
- data/test/data/faq/ex2-content.rbhtml +3 -0
- data/test/data/faq/ex2-layout.rbhtml +11 -0
- data/test/data/faq/ex2_removenl.result +19 -0
- data/test/data/faq/ex3.rb +4 -0
- data/test/data/faq/ex3.rbhtml +1 -0
- data/test/data/faq/ex3_escapefunc1.result +2 -0
- data/test/data/faq/ex3_escapefunc2.result +2 -0
- data/test/data/faq/ex5.rbhtml +7 -0
- data/test/data/faq/ex5_template_args.source +9 -0
- data/test/data/faq/ex6-content.rhtml +6 -0
- data/test/data/faq/ex6-layout.rhtml +6 -0
- data/test/data/faq/ex6.rb +10 -0
- data/test/data/faq/ex6_eruby.result +12 -0
- data/test/data/faq/ex7-expr-pattern.rb +34 -0
- data/test/data/faq/ex7-expr-pattern.rbhtml +3 -0
- data/test/data/faq/ex7_expr_pattern.result +4 -0
- data/test/data/faq/ex8-m18n.rb +77 -0
- data/test/data/faq/ex8-m18n.rbhtml +4 -0
- data/test/data/faq/ex8_m18n.result +10 -0
- data/test/data/faq/ex9-baselayout.rbhtml +8 -0
- data/test/data/faq/ex9-content.rbhtml +6 -0
- data/test/data/faq/ex9-mylayout.rbhtml +5 -0
- data/test/data/faq/ex9_changelayout.result +11 -0
- data/test/data/users_guide/content6.rbhtml +3 -0
- data/test/data/users_guide/content7.rbhtml +5 -0
- data/test/data/users_guide/content8.rbhtml +2 -0
- data/test/data/users_guide/contextdata.rb +7 -0
- data/test/data/users_guide/datafile.rb +5 -0
- data/test/data/users_guide/datafile.yaml +10 -0
- data/test/data/users_guide/ex.rbhtml +6 -0
- data/test/data/users_guide/ex.result +7 -0
- data/test/data/users_guide/ex.script +5 -0
- data/test/data/users_guide/ex_script.result +7 -0
- data/test/data/users_guide/ex_source.result +8 -0
- data/test/data/users_guide/example1.rbhtml +12 -0
- data/test/data/users_guide/example1.result +17 -0
- data/test/data/users_guide/example10.rbhtml +4 -0
- data/test/data/users_guide/example10_template_args.result +6 -0
- data/test/data/users_guide/example11.rbhtml +5 -0
- data/test/data/users_guide/example11_template_args_result +2 -0
- data/test/data/users_guide/example12.rbhtml +12 -0
- data/test/data/users_guide/example12_preprocessed.result +10 -0
- data/test/data/users_guide/example12_preprocessed_source.result +10 -0
- data/test/data/users_guide/example13.rbhtml +6 -0
- data/test/data/users_guide/example13_preprocessed.result +2 -0
- data/test/data/users_guide/example13_preprocessed_source.result +2 -0
- data/test/data/users_guide/example14.rb +32 -0
- data/test/data/users_guide/example14.rbhtml +6 -0
- data/test/data/users_guide/example14_tmplclass.result +15 -0
- data/test/data/users_guide/example15.rb +10 -0
- data/test/data/users_guide/example15_escapefunc.result +14 -0
- data/test/data/users_guide/example16.rbhtml +4 -0
- data/test/data/users_guide/example16a.rb +10 -0
- data/test/data/users_guide/example16a.result +4 -0
- data/test/data/users_guide/example16b.rb +13 -0
- data/test/data/users_guide/example16b.result +4 -0
- data/test/data/users_guide/example16c.rb +12 -0
- data/test/data/users_guide/example16c.result +4 -0
- data/test/data/users_guide/example1_S.result +14 -0
- data/test/data/users_guide/example1_SXNC.result +10 -0
- data/test/data/users_guide/example1_source.result +14 -0
- data/test/data/users_guide/example2.rbhtml +3 -0
- data/test/data/users_guide/example2_sb.result2 +9 -0
- data/test/data/users_guide/example3.rbhtml +5 -0
- data/test/data/users_guide/example3_syntaxcheck.result +2 -0
- data/test/data/users_guide/example4.rbhtml +13 -0
- data/test/data/users_guide/example4_datafile_rb.result +13 -0
- data/test/data/users_guide/example4_yaml.result +13 -0
- data/test/data/users_guide/example5.rbhtml +9 -0
- data/test/data/users_guide/example5_datastr_rb.result +9 -0
- data/test/data/users_guide/example5_datastr_yaml.result +9 -0
- data/test/data/users_guide/example6.rbhtml +19 -0
- data/test/data/users_guide/example6_layout.result +29 -0
- data/test/data/users_guide/example6_nested.result +28 -0
- data/test/data/users_guide/example7_layout2.result +13 -0
- data/test/data/users_guide/example8_layout3.result +8 -0
- data/test/data/users_guide/example9.rbhtml +18 -0
- data/test/data/users_guide/example9_capture.result +26 -0
- data/test/data/users_guide/footer.html +5 -0
- data/test/data/users_guide/footer.rbhtml +4 -0
- data/test/data/users_guide/layout6.rbhtml +17 -0
- data/test/data/users_guide/layout7.rbhtml +9 -0
- data/test/data/users_guide/layout8_html.rbhtml +5 -0
- data/test/data/users_guide/layout8_xhtml.rbhtml +6 -0
- data/test/data/users_guide/layout9.rbhtml +25 -0
- data/test/data/users_guide/sidemenu.rbhtml +5 -0
- data/test/data/users_guide/user_app.cgi +39 -0
- data/test/data/users_guide/user_app.result +30 -0
- data/test/data/users_guide/user_create.rbhtml +6 -0
- data/test/data/users_guide/user_edit.rbhtml +7 -0
- data/test/data/users_guide/user_form.rbhtml +10 -0
- data/test/data/users_guide/user_layout.rbhtml +16 -0
- data/test/test_all.rb +23 -0
- data/test/test_engine.rb +526 -0
- data/test/test_engine.yaml +2039 -0
- data/test/test_examples.rb +81 -0
- data/test/test_faq.rb +60 -0
- data/test/test_htmlhelper.rb +78 -0
- data/test/test_main.rb +564 -0
- data/test/test_main.yaml +174 -0
- data/test/test_template.rb +113 -0
- data/test/test_template.yaml +1244 -0
- data/test/test_users_guide.rb +75 -0
- data/test/testcase-helper.rb +166 -0
- metadata +226 -0
@@ -0,0 +1,2039 @@
|
|
1
|
+
##
|
2
|
+
##
|
3
|
+
##
|
4
|
+
|
5
|
+
###
|
6
|
+
|
7
|
+
- name: basic
|
8
|
+
contexts:
|
9
|
+
"list":
|
10
|
+
title: Users List
|
11
|
+
items:
|
12
|
+
- name: Robert
|
13
|
+
email: bob@example.com
|
14
|
+
gender: m
|
15
|
+
- name: Margalette
|
16
|
+
email: meg@example.com
|
17
|
+
gender: w
|
18
|
+
- name: William
|
19
|
+
email: bill@example.com
|
20
|
+
gender: m
|
21
|
+
"show":
|
22
|
+
title: Show User
|
23
|
+
item:
|
24
|
+
name: Robert
|
25
|
+
email: bob@example.com
|
26
|
+
gender: m
|
27
|
+
"create":
|
28
|
+
title: Create User
|
29
|
+
params:
|
30
|
+
name:
|
31
|
+
email:
|
32
|
+
gender:
|
33
|
+
"edit":
|
34
|
+
title: Edit User
|
35
|
+
params:
|
36
|
+
name: Robert
|
37
|
+
email: bob@example.com
|
38
|
+
gender: m
|
39
|
+
|
40
|
+
templates:
|
41
|
+
|
42
|
+
- filename: user_layout.xxhtml
|
43
|
+
content*:
|
44
|
+
"python": |
|
45
|
+
<html>
|
46
|
+
<body>
|
47
|
+
<h1>${title}</h1>
|
48
|
+
<div id="sidemenu">
|
49
|
+
<?py include(':sidemenu') ?>
|
50
|
+
</div>
|
51
|
+
<div id="maincontent">
|
52
|
+
#{_content}
|
53
|
+
</div>
|
54
|
+
<div id="footer">
|
55
|
+
#{include('footer.html', False)}
|
56
|
+
</div>
|
57
|
+
</body>
|
58
|
+
</html>
|
59
|
+
"ruby": |
|
60
|
+
<html>
|
61
|
+
<body>
|
62
|
+
<h1>${@title}</h1>
|
63
|
+
<div id="sidemenu">
|
64
|
+
<?rb import :sidemenu ?>
|
65
|
+
</div>
|
66
|
+
<div id="maincontent">
|
67
|
+
#{@_content}
|
68
|
+
</div>
|
69
|
+
<div id="footer">
|
70
|
+
#{import 'footer.html', false}
|
71
|
+
</div>
|
72
|
+
</body>
|
73
|
+
</html>
|
74
|
+
"perl": |
|
75
|
+
<html>
|
76
|
+
<body>
|
77
|
+
<h1>[=$title=]</h1>
|
78
|
+
<div id="sidemenu">
|
79
|
+
<?pl include(':sidemenu') ?>
|
80
|
+
</div>
|
81
|
+
<div id="maincontent">
|
82
|
+
[==$_content=]
|
83
|
+
</div>
|
84
|
+
<div id="footer">
|
85
|
+
<?pl include('footer.html') ?>
|
86
|
+
|
87
|
+
</div>
|
88
|
+
</body>
|
89
|
+
</html>
|
90
|
+
"js": |
|
91
|
+
<html>
|
92
|
+
<body>
|
93
|
+
<h1>${title}</h1>
|
94
|
+
<div id="sidemenu">
|
95
|
+
<?js include(':sidemenu') ?>
|
96
|
+
</div>
|
97
|
+
<div id="maincontent">
|
98
|
+
#{$_content}
|
99
|
+
</div>
|
100
|
+
<div id="footer">
|
101
|
+
<?js include('footer.html') ?>
|
102
|
+
|
103
|
+
</div>
|
104
|
+
</body>
|
105
|
+
</html>
|
106
|
+
|
107
|
+
- filename: user_list.xxhtml
|
108
|
+
content*:
|
109
|
+
"python": |
|
110
|
+
<ul>
|
111
|
+
<?py for item in items: ?>
|
112
|
+
<li>${item['name']}
|
113
|
+
(${item['email']})</li>
|
114
|
+
<?py #end ?>
|
115
|
+
</ul>
|
116
|
+
"ruby": |
|
117
|
+
<ul>
|
118
|
+
<?rb for item in @items ?>
|
119
|
+
<li>${item['name']}
|
120
|
+
(${item['email']})</li>
|
121
|
+
<?rb end ?>
|
122
|
+
</ul>
|
123
|
+
"perl": |
|
124
|
+
<ul>
|
125
|
+
<?pl for my $item (@$items) { ?>
|
126
|
+
<li>[=$item->{name}=]
|
127
|
+
([=$item->{email}=])</li>
|
128
|
+
<?pl } ?>
|
129
|
+
</ul>
|
130
|
+
"js": |
|
131
|
+
<ul>
|
132
|
+
<?js for (var i=0; i<items.length; i++) { ?>
|
133
|
+
<li>${items[i].name}
|
134
|
+
(${item[i].email})</li>
|
135
|
+
<?js } ?>
|
136
|
+
</ul>
|
137
|
+
|
138
|
+
- filename: user_show.xxhtml
|
139
|
+
content*:
|
140
|
+
"python": |
|
141
|
+
<p>
|
142
|
+
Name: ${item['name']}<br />
|
143
|
+
Email: ${item['email']}
|
144
|
+
</p>
|
145
|
+
"ruby": |
|
146
|
+
<p>
|
147
|
+
Name: ${@item['name']}<br />
|
148
|
+
Email: ${@item['email']}
|
149
|
+
</p>
|
150
|
+
"perl": |
|
151
|
+
<p>
|
152
|
+
Name: [=$item->{name}=]<br />
|
153
|
+
Email: [=$item->{email}=]
|
154
|
+
</p>
|
155
|
+
"js": |
|
156
|
+
<p>
|
157
|
+
Name: ${item.name}<br />
|
158
|
+
Email: ${item.email}
|
159
|
+
</p>
|
160
|
+
|
161
|
+
- filename: user_form.xxhtml
|
162
|
+
content*:
|
163
|
+
"python": |
|
164
|
+
<p>
|
165
|
+
Name: <input type="input" name="name" value="${params['name']}" />
|
166
|
+
</p>
|
167
|
+
<p>
|
168
|
+
Email: <input type="input" name="email" value="${params['email']}" />
|
169
|
+
</p>
|
170
|
+
"ruby": |
|
171
|
+
<p>
|
172
|
+
Name: <input type="input" name="name" value="${@params['name']}" />
|
173
|
+
</p>
|
174
|
+
<p>
|
175
|
+
Email: <input type="input" name="email" value="${@params['email']}" />
|
176
|
+
</p>
|
177
|
+
"perl": |
|
178
|
+
<p>
|
179
|
+
Name: <input type="input" name="name" value="[=$params->{name}=]" />
|
180
|
+
</p>
|
181
|
+
<p>
|
182
|
+
Email: <input type="input" name="email" value="[=$params->{email}=]" />
|
183
|
+
</p>
|
184
|
+
"js": |
|
185
|
+
<p>
|
186
|
+
Name: <input type="input" name="name" value="${params.name}" />
|
187
|
+
</p>
|
188
|
+
<p>
|
189
|
+
Email: <input type="input" name="email" value="${params.email}" />
|
190
|
+
</p>
|
191
|
+
|
192
|
+
- filename: user_create.xxhtml
|
193
|
+
desc: import()
|
194
|
+
content*:
|
195
|
+
"python": |
|
196
|
+
<form action="create" method="post">
|
197
|
+
<?py include(':form') ?>
|
198
|
+
<input type="submit" value="Create" />
|
199
|
+
</form>
|
200
|
+
"ruby": |
|
201
|
+
<form action="create" method="post">
|
202
|
+
<?rb import :form ?>
|
203
|
+
<input type="submit" value="Create" />
|
204
|
+
</form>
|
205
|
+
"perl": |
|
206
|
+
<form action="create" method="post">
|
207
|
+
<?pl include(':form'); ?>
|
208
|
+
<input type="submit" value="Create" />
|
209
|
+
</form>
|
210
|
+
"js": |
|
211
|
+
<form action="create" method="post">
|
212
|
+
<?js include(':form'); ?>
|
213
|
+
<input type="submit" value="Create" />
|
214
|
+
</form>
|
215
|
+
|
216
|
+
- filename: user_edit.xxhtml
|
217
|
+
desc: import(append=false)
|
218
|
+
content*:
|
219
|
+
"python": |
|
220
|
+
<form action="edit" method="post">
|
221
|
+
#{include('user_form.pyhtml', False)}
|
222
|
+
<input type="submit" value="Edit" />
|
223
|
+
</form>
|
224
|
+
"ruby": |
|
225
|
+
<form action="edit" method="post">
|
226
|
+
#{import 'user_form.rbhtml', false}
|
227
|
+
<input type="submit" value="Edit" />
|
228
|
+
</form>
|
229
|
+
"perl": |
|
230
|
+
<form action="edit" method="post">
|
231
|
+
<?pl include('user_form.plhtml')?>
|
232
|
+
|
233
|
+
<input type="submit" value="Edit" />
|
234
|
+
</form>
|
235
|
+
"js": |
|
236
|
+
<form action="edit" method="post">
|
237
|
+
<?js include('user_form.plhtml')?>
|
238
|
+
|
239
|
+
<input type="submit" value="Edit" />
|
240
|
+
</form>
|
241
|
+
|
242
|
+
- filename: user_sidemenu.xxhtml
|
243
|
+
desc: _engine.render()
|
244
|
+
content*:
|
245
|
+
"python": |
|
246
|
+
<a href="/user/list">List</a><br />
|
247
|
+
<a href="/user/create">Create</a><br />
|
248
|
+
"ruby": |
|
249
|
+
<a href="/user/list">List</a><br />
|
250
|
+
<a href="/user/create">Create</a><br />
|
251
|
+
"perl": |
|
252
|
+
<a href="/user/list">List</a><br />
|
253
|
+
<a href="/user/create">Create</a><br />
|
254
|
+
"js": |
|
255
|
+
<a href="/user/list">List</a><br />
|
256
|
+
<a href="/user/create">Create</a><br />
|
257
|
+
|
258
|
+
- filename: footer.html
|
259
|
+
desc: _engine.evaluate()
|
260
|
+
content*:
|
261
|
+
"python": &footer |
|
262
|
+
<hr />
|
263
|
+
<address>
|
264
|
+
copyright©2007 kuwata-lab.com
|
265
|
+
</address>
|
266
|
+
"ruby": *footer
|
267
|
+
"perl": *footer
|
268
|
+
"js": *footer
|
269
|
+
|
270
|
+
expected:
|
271
|
+
|
272
|
+
- name: user_list_nolayout
|
273
|
+
content*:
|
274
|
+
"python": &c01 |
|
275
|
+
<ul>
|
276
|
+
<li>Robert
|
277
|
+
(bob@example.com)</li>
|
278
|
+
<li>Margalette
|
279
|
+
(meg@example.com)</li>
|
280
|
+
<li>William
|
281
|
+
(bill@example.com)</li>
|
282
|
+
</ul>
|
283
|
+
"ruby": *c01
|
284
|
+
"perl": *c01
|
285
|
+
"js": *c01
|
286
|
+
|
287
|
+
- name: user_show_nolayout
|
288
|
+
content*:
|
289
|
+
"python": &c02 |
|
290
|
+
<p>
|
291
|
+
Name: Robert<br />
|
292
|
+
Email: bob@example.com
|
293
|
+
</p>
|
294
|
+
"ruby": *c02
|
295
|
+
"perl": *c02
|
296
|
+
"js": *c02
|
297
|
+
|
298
|
+
- name: user_create_nolayout
|
299
|
+
content*:
|
300
|
+
"python": &c03 |
|
301
|
+
<form action="create" method="post">
|
302
|
+
<p>
|
303
|
+
Name: <input type="input" name="name" value="" />
|
304
|
+
</p>
|
305
|
+
<p>
|
306
|
+
Email: <input type="input" name="email" value="" />
|
307
|
+
</p>
|
308
|
+
<input type="submit" value="Create" />
|
309
|
+
</form>
|
310
|
+
"ruby": *c03
|
311
|
+
"perl": *c03
|
312
|
+
"js": *c03
|
313
|
+
|
314
|
+
- name: user_edit_nolayout
|
315
|
+
content*:
|
316
|
+
"python": &c04 |
|
317
|
+
<form action="edit" method="post">
|
318
|
+
<p>
|
319
|
+
Name: <input type="input" name="name" value="Robert" />
|
320
|
+
</p>
|
321
|
+
<p>
|
322
|
+
Email: <input type="input" name="email" value="bob@example.com" />
|
323
|
+
</p>
|
324
|
+
|
325
|
+
<input type="submit" value="Edit" />
|
326
|
+
</form>
|
327
|
+
"ruby": *c04
|
328
|
+
"perl": *c04
|
329
|
+
"js": *c04
|
330
|
+
|
331
|
+
- name: user_list_withlayout
|
332
|
+
content*:
|
333
|
+
"python": &c05 |
|
334
|
+
<html>
|
335
|
+
<body>
|
336
|
+
<h1>Users List</h1>
|
337
|
+
<div id="sidemenu">
|
338
|
+
<a href="/user/list">List</a><br />
|
339
|
+
<a href="/user/create">Create</a><br />
|
340
|
+
</div>
|
341
|
+
<div id="maincontent">
|
342
|
+
<ul>
|
343
|
+
<li>Robert
|
344
|
+
(bob@example.com)</li>
|
345
|
+
<li>Margalette
|
346
|
+
(meg@example.com)</li>
|
347
|
+
<li>William
|
348
|
+
(bill@example.com)</li>
|
349
|
+
</ul>
|
350
|
+
|
351
|
+
</div>
|
352
|
+
<div id="footer">
|
353
|
+
<hr />
|
354
|
+
<address>
|
355
|
+
copyright©2007 kuwata-lab.com
|
356
|
+
</address>
|
357
|
+
|
358
|
+
</div>
|
359
|
+
</body>
|
360
|
+
</html>
|
361
|
+
"ruby": *c05
|
362
|
+
"perl": *c05
|
363
|
+
"js": *c05
|
364
|
+
|
365
|
+
- name: user_show_withlayout
|
366
|
+
content*:
|
367
|
+
"python": &c06 |
|
368
|
+
<html>
|
369
|
+
<body>
|
370
|
+
<h1>Show User</h1>
|
371
|
+
<div id="sidemenu">
|
372
|
+
<a href="/user/list">List</a><br />
|
373
|
+
<a href="/user/create">Create</a><br />
|
374
|
+
</div>
|
375
|
+
<div id="maincontent">
|
376
|
+
<p>
|
377
|
+
Name: Robert<br />
|
378
|
+
Email: bob@example.com
|
379
|
+
</p>
|
380
|
+
|
381
|
+
</div>
|
382
|
+
<div id="footer">
|
383
|
+
<hr />
|
384
|
+
<address>
|
385
|
+
copyright©2007 kuwata-lab.com
|
386
|
+
</address>
|
387
|
+
|
388
|
+
</div>
|
389
|
+
</body>
|
390
|
+
</html>
|
391
|
+
"ruby": *c06
|
392
|
+
"perl": *c06
|
393
|
+
"js": *c06
|
394
|
+
|
395
|
+
- name: user_create_withlayout
|
396
|
+
content*:
|
397
|
+
"python": &c07 |
|
398
|
+
<html>
|
399
|
+
<body>
|
400
|
+
<h1>Create User</h1>
|
401
|
+
<div id="sidemenu">
|
402
|
+
<a href="/user/list">List</a><br />
|
403
|
+
<a href="/user/create">Create</a><br />
|
404
|
+
</div>
|
405
|
+
<div id="maincontent">
|
406
|
+
<form action="create" method="post">
|
407
|
+
<p>
|
408
|
+
Name: <input type="input" name="name" value="" />
|
409
|
+
</p>
|
410
|
+
<p>
|
411
|
+
Email: <input type="input" name="email" value="" />
|
412
|
+
</p>
|
413
|
+
<input type="submit" value="Create" />
|
414
|
+
</form>
|
415
|
+
|
416
|
+
</div>
|
417
|
+
<div id="footer">
|
418
|
+
<hr />
|
419
|
+
<address>
|
420
|
+
copyright©2007 kuwata-lab.com
|
421
|
+
</address>
|
422
|
+
|
423
|
+
</div>
|
424
|
+
</body>
|
425
|
+
</html>
|
426
|
+
"ruby": *c07
|
427
|
+
"perl": *c07
|
428
|
+
"js": *c07
|
429
|
+
|
430
|
+
- name: user_edit_withlayout
|
431
|
+
content*:
|
432
|
+
"python": &c08 |
|
433
|
+
<html>
|
434
|
+
<body>
|
435
|
+
<h1>Edit User</h1>
|
436
|
+
<div id="sidemenu">
|
437
|
+
<a href="/user/list">List</a><br />
|
438
|
+
<a href="/user/create">Create</a><br />
|
439
|
+
</div>
|
440
|
+
<div id="maincontent">
|
441
|
+
<form action="edit" method="post">
|
442
|
+
<p>
|
443
|
+
Name: <input type="input" name="name" value="Robert" />
|
444
|
+
</p>
|
445
|
+
<p>
|
446
|
+
Email: <input type="input" name="email" value="bob@example.com" />
|
447
|
+
</p>
|
448
|
+
|
449
|
+
<input type="submit" value="Edit" />
|
450
|
+
</form>
|
451
|
+
|
452
|
+
</div>
|
453
|
+
<div id="footer">
|
454
|
+
<hr />
|
455
|
+
<address>
|
456
|
+
copyright©2007 kuwata-lab.com
|
457
|
+
</address>
|
458
|
+
|
459
|
+
</div>
|
460
|
+
</body>
|
461
|
+
</html>
|
462
|
+
"ruby": *c08
|
463
|
+
"perl": *c08
|
464
|
+
"js": *c08
|
465
|
+
|
466
|
+
|
467
|
+
### -- for capture test
|
468
|
+
|
469
|
+
- name: test_capture_and_echo
|
470
|
+
layout*:
|
471
|
+
"python": |
|
472
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
473
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
474
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
475
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
476
|
+
<head>
|
477
|
+
<title>${title}</title>
|
478
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
479
|
+
<link rel="stylesheet" type="text/css" href="style.css" />
|
480
|
+
</head>
|
481
|
+
<body>
|
482
|
+
<h1>${title}</h1>
|
483
|
+
|
484
|
+
<div id="main_content">
|
485
|
+
<?py echo(main_content) ?>
|
486
|
+
</div>
|
487
|
+
|
488
|
+
<div id="footer">
|
489
|
+
<?py echo(footer) ?>
|
490
|
+
</div>
|
491
|
+
|
492
|
+
</body>
|
493
|
+
</html>
|
494
|
+
"ruby": |
|
495
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
496
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
497
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
498
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
499
|
+
<head>
|
500
|
+
<title>${@title}</title>
|
501
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
502
|
+
<link rel="stylesheet" type="text/css" href="style.css" />
|
503
|
+
</head>
|
504
|
+
<body>
|
505
|
+
<h1>${@title}</h1>
|
506
|
+
|
507
|
+
<div id="main_content">
|
508
|
+
<?rb echo(@main_content) ?>
|
509
|
+
</div>
|
510
|
+
|
511
|
+
<div id="footer">
|
512
|
+
<?rb echo(@footer) ?>
|
513
|
+
</div>
|
514
|
+
|
515
|
+
</body>
|
516
|
+
</html>
|
517
|
+
"perl": |
|
518
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
519
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
520
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
521
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
522
|
+
<head>
|
523
|
+
<title>[=$title=]</title>
|
524
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
525
|
+
<link rel="stylesheet" type="text/css" href="style.css" />
|
526
|
+
</head>
|
527
|
+
<body>
|
528
|
+
<h1>[=$title=]</h1>
|
529
|
+
|
530
|
+
<div id="main_content">
|
531
|
+
<?pl echo($main_content) ?>
|
532
|
+
</div>
|
533
|
+
|
534
|
+
<div id="footer">
|
535
|
+
<?pl echo($footer) ?>
|
536
|
+
</div>
|
537
|
+
|
538
|
+
</body>
|
539
|
+
</html>
|
540
|
+
"js": |
|
541
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
542
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
543
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
544
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
545
|
+
<head>
|
546
|
+
<title>${title}</title>
|
547
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
548
|
+
<link rel="stylesheet" type="text/css" href="style.css" />
|
549
|
+
</head>
|
550
|
+
<body>
|
551
|
+
<h1>${title}</h1>
|
552
|
+
|
553
|
+
<div id="main_content">
|
554
|
+
<?js echo(main_content) ?>
|
555
|
+
</div>
|
556
|
+
|
557
|
+
<div id="footer">
|
558
|
+
<?js echo(footer) ?>
|
559
|
+
</div>
|
560
|
+
|
561
|
+
</body>
|
562
|
+
</html>
|
563
|
+
|
564
|
+
content*:
|
565
|
+
"python": |
|
566
|
+
<html>
|
567
|
+
<body>
|
568
|
+
<h1><?py
|
569
|
+
start_capture('title')
|
570
|
+
?>Capturing Example<?py
|
571
|
+
stop_capture()
|
572
|
+
?></h1>
|
573
|
+
|
574
|
+
<?py start_capture('main_content') ?>
|
575
|
+
<table>
|
576
|
+
<?py for i, item in enumerate(items): ?>
|
577
|
+
<?py color = i % 2 == 0 and '#FFCCCC' or '#CCCCFF' ?>
|
578
|
+
<tr bgcolor="#{color}">
|
579
|
+
<td>${item}</td>
|
580
|
+
</tr>
|
581
|
+
<?py #endfor ?>
|
582
|
+
</table>
|
583
|
+
<?py stop_capture(False) ?>
|
584
|
+
<?py _context['main_content'] = main_content ?>
|
585
|
+
|
586
|
+
<?py start_capture() ?>
|
587
|
+
<hr>
|
588
|
+
<address>
|
589
|
+
<a href="mailto:webmaster@example.com">webmaster@example.com</a>
|
590
|
+
</address>
|
591
|
+
<?py _context['footer'] = stop_capture(False) ?>
|
592
|
+
|
593
|
+
</body>
|
594
|
+
</html>
|
595
|
+
"ruby": |
|
596
|
+
<html>
|
597
|
+
<body>
|
598
|
+
<h1><?rb start_capture(:title) do ?>Capturing Example<?rb end ?></h1>
|
599
|
+
|
600
|
+
<?rb start_capture(:main_content) ?>
|
601
|
+
<table>
|
602
|
+
<?rb @items.each_with_index do |item, i| ?>
|
603
|
+
<?rb color = i % 2 == 0 ? '#FFCCCC' : '#CCCCFF' ?>
|
604
|
+
<tr bgcolor="#{color}">
|
605
|
+
<td>${item}</td>
|
606
|
+
</tr>
|
607
|
+
<?rb end ?>
|
608
|
+
</table>
|
609
|
+
<?rb stop_capture() ?>
|
610
|
+
|
611
|
+
<?rb start_capture() ?>
|
612
|
+
<hr>
|
613
|
+
<address>
|
614
|
+
<a href="mailto:webmaster@example.com">webmaster@example.com</a>
|
615
|
+
</address>
|
616
|
+
<?rb @footer = stop_capture() ?>
|
617
|
+
|
618
|
+
</body>
|
619
|
+
</html>
|
620
|
+
"perl": |
|
621
|
+
<html>
|
622
|
+
<body>
|
623
|
+
<h1><?pl start_capture('title') ?>Capturing Example<?pl stop_capture() ?></h1>
|
624
|
+
|
625
|
+
<?pl start_capture('main_content') ?>
|
626
|
+
<table>
|
627
|
+
<?pl my $i = 0; ?>
|
628
|
+
<?pl for my $item (@$items) { ?>
|
629
|
+
<?pl $color = $i++ % 2 == 0 ? '#FFCCCC' : '#CCCCFF'; ?>
|
630
|
+
<tr bgcolor="[==$color=]">
|
631
|
+
<td>[=$item=]</td>
|
632
|
+
</tr>
|
633
|
+
<?pl } ?>
|
634
|
+
</table>
|
635
|
+
<?pl stop_capture() ?>
|
636
|
+
|
637
|
+
<?pl start_capture('footer');?>
|
638
|
+
<hr>
|
639
|
+
<address>
|
640
|
+
<a href="mailto:webmaster@example.com">webmaster@example.com</a>
|
641
|
+
</address>
|
642
|
+
<?pl stop_capture();?>
|
643
|
+
|
644
|
+
</body>
|
645
|
+
</html>
|
646
|
+
"js": |
|
647
|
+
<html>
|
648
|
+
<body>
|
649
|
+
<h1><?js startCapture('title') ?>Capturing Example<?js stopCapture() ?></h1>
|
650
|
+
|
651
|
+
<?js startCapture('main_content') ?>
|
652
|
+
<table>
|
653
|
+
<?js for (var i = 0, n = items.length; i < n; i++) { ?>
|
654
|
+
<?js var color = i % 2 == 0 ? '#FFCCCC' : '#CCCCFF' ?>
|
655
|
+
<tr bgcolor="#{color}">
|
656
|
+
<td>${item[i]}</td>
|
657
|
+
</tr>
|
658
|
+
<?js } ?>
|
659
|
+
</table>
|
660
|
+
<?js stopCapture() ?>
|
661
|
+
|
662
|
+
<?js start_capture('footer') ?>
|
663
|
+
<hr>
|
664
|
+
<address>
|
665
|
+
<a href="mailto:webmaster@example.com">webmaster@example.com</a>
|
666
|
+
</address>
|
667
|
+
<?js stop_capture(False) ?>
|
668
|
+
|
669
|
+
</body>
|
670
|
+
</html>
|
671
|
+
|
672
|
+
expected*:
|
673
|
+
"python": &ex11 |
|
674
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
675
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
676
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
677
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
678
|
+
<head>
|
679
|
+
<title>Capturing Example</title>
|
680
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
681
|
+
<link rel="stylesheet" type="text/css" href="style.css" />
|
682
|
+
</head>
|
683
|
+
<body>
|
684
|
+
<h1>Capturing Example</h1>
|
685
|
+
|
686
|
+
<div id="main_content">
|
687
|
+
<table>
|
688
|
+
<tr bgcolor="#FFCCCC">
|
689
|
+
<td>AAA</td>
|
690
|
+
</tr>
|
691
|
+
<tr bgcolor="#CCCCFF">
|
692
|
+
<td>BBB</td>
|
693
|
+
</tr>
|
694
|
+
<tr bgcolor="#FFCCCC">
|
695
|
+
<td>CCC</td>
|
696
|
+
</tr>
|
697
|
+
</table>
|
698
|
+
</div>
|
699
|
+
|
700
|
+
<div id="footer">
|
701
|
+
<hr>
|
702
|
+
<address>
|
703
|
+
<a href="mailto:webmaster@example.com">webmaster@example.com</a>
|
704
|
+
</address>
|
705
|
+
</div>
|
706
|
+
|
707
|
+
</body>
|
708
|
+
</html>
|
709
|
+
"ruby": *ex11
|
710
|
+
"perl": *ex11
|
711
|
+
"js": *ex11
|
712
|
+
|
713
|
+
|
714
|
+
### -- for captured_as() function test
|
715
|
+
|
716
|
+
- name: test_captured_as
|
717
|
+
baselayout*:
|
718
|
+
"python": |
|
719
|
+
<html>
|
720
|
+
<body>
|
721
|
+
|
722
|
+
<!-- HEADER -->
|
723
|
+
<?py if not captured_as('header_part'): ?>
|
724
|
+
<img src="img/logo.png" alt="logo" ?>
|
725
|
+
<?py #end ?>
|
726
|
+
<!-- /HEADER -->
|
727
|
+
|
728
|
+
<!-- CONTENT -->
|
729
|
+
<?py _buf.append(content_part) ?>
|
730
|
+
<!-- /CONTENT -->
|
731
|
+
|
732
|
+
<!-- FOOTER -->
|
733
|
+
<?py if not captured_as('footer_part'): ?>
|
734
|
+
<hr />
|
735
|
+
<em>webmaster@example.com</em>
|
736
|
+
<?py #end ?>
|
737
|
+
<!-- /FOOTER -->
|
738
|
+
|
739
|
+
</body>
|
740
|
+
</html>
|
741
|
+
"ruby": |
|
742
|
+
<html>
|
743
|
+
<body>
|
744
|
+
|
745
|
+
<!-- HEADER -->
|
746
|
+
<?rb unless captured_as('header_part') ?>
|
747
|
+
<img src="img/logo.png" alt="logo" ?>
|
748
|
+
<?rb end ?>
|
749
|
+
<!-- /HEADER -->
|
750
|
+
|
751
|
+
<!-- CONTENT -->
|
752
|
+
<?rb _buf << @content_part ?>
|
753
|
+
<!-- /CONTENT -->
|
754
|
+
|
755
|
+
<!-- FOOTER -->
|
756
|
+
<?rb unless captured_as('footer_part') ?>
|
757
|
+
<hr />
|
758
|
+
<em>webmaster@example.com</em>
|
759
|
+
<?rb end ?>
|
760
|
+
<!-- /FOOTER -->
|
761
|
+
|
762
|
+
</body>
|
763
|
+
</html>
|
764
|
+
"perl": |
|
765
|
+
<html>
|
766
|
+
<body>
|
767
|
+
|
768
|
+
<!-- HEADER -->
|
769
|
+
<?pl start_placeholder('header_part') ?>
|
770
|
+
<img src="img/logo.png" alt="logo" ?>
|
771
|
+
<?pl stop_placeholder() ?>
|
772
|
+
<!-- /HEADER -->
|
773
|
+
|
774
|
+
<!-- CONTENT -->
|
775
|
+
<?pl push(@_buf, $content_part); ?>
|
776
|
+
<!-- /CONTENT -->
|
777
|
+
|
778
|
+
<!-- FOOTER -->
|
779
|
+
<?pl start_placeholder('footer_part'); ?>
|
780
|
+
<hr />
|
781
|
+
<em>webmaster@example.com</em>
|
782
|
+
<?pl stop_placeholder() ?>
|
783
|
+
<!-- /FOOTER -->
|
784
|
+
|
785
|
+
</body>
|
786
|
+
</html>
|
787
|
+
"js": |
|
788
|
+
<html>
|
789
|
+
<body>
|
790
|
+
|
791
|
+
<!-- HEADER -->
|
792
|
+
<?js startPlaceholder('header_part') ?>
|
793
|
+
<img src="img/logo.png" alt="logo" ?>
|
794
|
+
<?js endPlaceholder() ?>
|
795
|
+
<!-- /HEADER -->
|
796
|
+
|
797
|
+
<!-- CONTENT -->
|
798
|
+
<?js _buf.push(content_part); ?>
|
799
|
+
<!-- /CONTENT -->
|
800
|
+
|
801
|
+
<!-- FOOTER -->
|
802
|
+
<?js startPlaceholder('footer_part') ?>
|
803
|
+
<hr />
|
804
|
+
<em>webmaster@example.com</em>
|
805
|
+
<?js stopPlaceholder() ?>
|
806
|
+
<!-- /FOOTER -->
|
807
|
+
|
808
|
+
</body>
|
809
|
+
</html>
|
810
|
+
|
811
|
+
customlayout*:
|
812
|
+
"python": |
|
813
|
+
<?py _context['_layout'] = 'baselayout.pyhtml' ?>
|
814
|
+
|
815
|
+
<?py start_capture('footer_part') ?>
|
816
|
+
<address style="text-align:right">
|
817
|
+
copyright© 2007 kuwata-lab all rights reserved<br />
|
818
|
+
<a href="webmaster@kuwata-lab.com">webmaster@kuwata-lab.com</a>
|
819
|
+
</address>
|
820
|
+
<?py stop_capture() ?>
|
821
|
+
"ruby": |
|
822
|
+
<?rb _context['_layout'] = 'baselayout.rbhtml' ?>
|
823
|
+
|
824
|
+
<?rb start_capture('footer_part') ?>
|
825
|
+
<address style="text-align:right">
|
826
|
+
copyright© 2007 kuwata-lab all rights reserved<br />
|
827
|
+
<a href="webmaster@kuwata-lab.com">webmaster@kuwata-lab.com</a>
|
828
|
+
</address>
|
829
|
+
<?rb stop_capture() ?>
|
830
|
+
"perl": |
|
831
|
+
<?pl $_context->{_layout} = 'baselayout.plhtml'; ?>
|
832
|
+
|
833
|
+
<?pl start_capture('footer_part') ?>
|
834
|
+
<address style="text-align:right">
|
835
|
+
copyright© 2007 kuwata-lab all rights reserved<br />
|
836
|
+
<a href="webmaster@kuwata-lab.com">webmaster@kuwata-lab.com</a>
|
837
|
+
</address>
|
838
|
+
<?pl stop_capture() ?>
|
839
|
+
"js": |
|
840
|
+
<?js _context._layout = 'baselayout.jshtml'; ?>
|
841
|
+
|
842
|
+
<?js startCapture('footer_part') ?>
|
843
|
+
<address style="text-align:right">
|
844
|
+
copyright© 2007 kuwata-lab all rights reserved<br />
|
845
|
+
<a href="webmaster@kuwata-lab.com">webmaster@kuwata-lab.com</a>
|
846
|
+
</address>
|
847
|
+
<?js stopCapture() ?>
|
848
|
+
|
849
|
+
content*:
|
850
|
+
"python": |
|
851
|
+
<?py _context['_layout'] = 'customlayout.pyhtml' ?>
|
852
|
+
|
853
|
+
<?py start_capture('content_part') ?>
|
854
|
+
<ul>
|
855
|
+
<?py for item in items: ?>
|
856
|
+
<li>${item}</li>
|
857
|
+
<?py #end ?>
|
858
|
+
</ul>
|
859
|
+
<?py stop_capture() ?>
|
860
|
+
"ruby": |
|
861
|
+
<?rb @_layout = 'customlayout.rbhtml' ?>
|
862
|
+
|
863
|
+
<?rb start_capture(:content_part) ?>
|
864
|
+
<ul>
|
865
|
+
<?rb for item in @items ?>
|
866
|
+
<li>${item}</li>
|
867
|
+
<?rb end ?>
|
868
|
+
</ul>
|
869
|
+
<?rb stop_capture() ?>
|
870
|
+
"perl": |
|
871
|
+
<?pl $_context->{_layout} = 'customlayout.plhtml'; ?>
|
872
|
+
|
873
|
+
<?pl start_capture('content_part') ?>
|
874
|
+
<ul>
|
875
|
+
<?pl for my $item (@$items) { ?>
|
876
|
+
<li>[=$item=]</li>
|
877
|
+
<?pl } ?>
|
878
|
+
</ul>
|
879
|
+
<?pl stop_capture() ?>
|
880
|
+
"js": |
|
881
|
+
<?js _context._layout = 'customlayout.pyhtml'; ?>
|
882
|
+
|
883
|
+
<?js start_capture('content_part') ?>
|
884
|
+
<ul>
|
885
|
+
<?js for (var i = 0, n = items.length; i < n; i++) { ?>
|
886
|
+
<li>${items[i]}</li>
|
887
|
+
<?js } ?>
|
888
|
+
</ul>
|
889
|
+
<?js stop_capture() ?>
|
890
|
+
|
891
|
+
context: { items: ['AAA', 'BBB', 'CCC'] }
|
892
|
+
expected: |
|
893
|
+
<html>
|
894
|
+
<body>
|
895
|
+
|
896
|
+
<!-- HEADER -->
|
897
|
+
<img src="img/logo.png" alt="logo" ?>
|
898
|
+
<!-- /HEADER -->
|
899
|
+
|
900
|
+
<!-- CONTENT -->
|
901
|
+
<ul>
|
902
|
+
<li>AAA</li>
|
903
|
+
<li>BBB</li>
|
904
|
+
<li>CCC</li>
|
905
|
+
</ul>
|
906
|
+
<!-- /CONTENT -->
|
907
|
+
|
908
|
+
<!-- FOOTER -->
|
909
|
+
<address style="text-align:right">
|
910
|
+
copyright© 2007 kuwata-lab all rights reserved<br />
|
911
|
+
<a href="webmaster@kuwata-lab.com">webmaster@kuwata-lab.com</a>
|
912
|
+
</address>
|
913
|
+
<!-- /FOOTER -->
|
914
|
+
|
915
|
+
</body>
|
916
|
+
</html>
|
917
|
+
|
918
|
+
|
919
|
+
|
920
|
+
|
921
|
+
|
922
|
+
### -- for local layout test
|
923
|
+
|
924
|
+
#local_layout_test:
|
925
|
+
- name: test_local_layout
|
926
|
+
layout_html*:
|
927
|
+
"python": |
|
928
|
+
<html>
|
929
|
+
<body>
|
930
|
+
#{_content}
|
931
|
+
</body>
|
932
|
+
</html>
|
933
|
+
"ruby": |
|
934
|
+
<html>
|
935
|
+
<body>
|
936
|
+
#{@_content}
|
937
|
+
</body>
|
938
|
+
</html>
|
939
|
+
"perl": |
|
940
|
+
<html>
|
941
|
+
<body>
|
942
|
+
[==$_content=]
|
943
|
+
</body>
|
944
|
+
</html>
|
945
|
+
"js": |
|
946
|
+
<html>
|
947
|
+
<body>
|
948
|
+
#{_content}
|
949
|
+
</body>
|
950
|
+
</html>
|
951
|
+
|
952
|
+
layout_xhtml*:
|
953
|
+
"python": |
|
954
|
+
<?xml version="1.0" encoding="UTF-8" ?>
|
955
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
956
|
+
<body>
|
957
|
+
#{_content}
|
958
|
+
</body>
|
959
|
+
</html>
|
960
|
+
"ruby": |
|
961
|
+
<?xml version="1.0" encoding="UTF-8" ?>
|
962
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
963
|
+
<body>
|
964
|
+
#{@_content}
|
965
|
+
</body>
|
966
|
+
</html>
|
967
|
+
"perl": |
|
968
|
+
<?xml version="1.0" encoding="UTF-8" ?>
|
969
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
970
|
+
<body>
|
971
|
+
[==$_content=]
|
972
|
+
</body>
|
973
|
+
</html>
|
974
|
+
"js": |
|
975
|
+
<?xml version="1.0" encoding="UTF-8" ?>
|
976
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
977
|
+
<body>
|
978
|
+
#{_content}
|
979
|
+
</body>
|
980
|
+
</html>
|
981
|
+
|
982
|
+
content_html*:
|
983
|
+
"python": |
|
984
|
+
<h1>hello #{user}!</h1>
|
985
|
+
"ruby": |
|
986
|
+
<h1>hello #{@user}!</h1>
|
987
|
+
"perl": |
|
988
|
+
<h1>hello [=$user=]!</h1>
|
989
|
+
"js": |
|
990
|
+
<h1>hello #{user}!</h1>
|
991
|
+
|
992
|
+
context*:
|
993
|
+
"python": { user: world }
|
994
|
+
"ruby": { user: world }
|
995
|
+
"perl": { user: world }
|
996
|
+
"js": { user: world }
|
997
|
+
|
998
|
+
expected_nolayout*:
|
999
|
+
"python": |
|
1000
|
+
<h1>hello world!</h1>
|
1001
|
+
"ruby": |
|
1002
|
+
<h1>hello world!</h1>
|
1003
|
+
"perl": |
|
1004
|
+
<h1>hello world!</h1>
|
1005
|
+
"js": |
|
1006
|
+
<h1>hello world!</h1>
|
1007
|
+
|
1008
|
+
expected_html*:
|
1009
|
+
"python": &expected11 |
|
1010
|
+
<html>
|
1011
|
+
<body>
|
1012
|
+
<h1>hello world!</h1>
|
1013
|
+
|
1014
|
+
</body>
|
1015
|
+
</html>
|
1016
|
+
"ruby": *expected11
|
1017
|
+
"perl": *expected11
|
1018
|
+
"js": *expected11
|
1019
|
+
|
1020
|
+
expected_xhtml*:
|
1021
|
+
"python": &expected12 |
|
1022
|
+
<?xml version="1.0" encoding="UTF-8" ?>
|
1023
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
1024
|
+
<body>
|
1025
|
+
<h1>hello world!</h1>
|
1026
|
+
|
1027
|
+
</body>
|
1028
|
+
</html>
|
1029
|
+
"ruby": *expected12
|
1030
|
+
"perl": *expected12
|
1031
|
+
"js": *expected12
|
1032
|
+
|
1033
|
+
|
1034
|
+
### -- for caching test
|
1035
|
+
|
1036
|
+
#caching_test:
|
1037
|
+
- name: test_cachefile
|
1038
|
+
desc: mtime of cachefile
|
1039
|
+
layout*:
|
1040
|
+
"python": |
|
1041
|
+
<html>
|
1042
|
+
<head>
|
1043
|
+
<title>${title}</title>
|
1044
|
+
</head>
|
1045
|
+
<body>
|
1046
|
+
<h1>${title}</h1>
|
1047
|
+
<div id="content">
|
1048
|
+
#{_content}
|
1049
|
+
</div>
|
1050
|
+
</body>
|
1051
|
+
</html>
|
1052
|
+
"ruby": |
|
1053
|
+
<html>
|
1054
|
+
<head>
|
1055
|
+
<title>${@title}</title>
|
1056
|
+
</head>
|
1057
|
+
<body>
|
1058
|
+
<h1>${@title}</h1>
|
1059
|
+
<div id="content">
|
1060
|
+
#{@_content}
|
1061
|
+
</div>
|
1062
|
+
</body>
|
1063
|
+
</html>
|
1064
|
+
"perl": |
|
1065
|
+
<html>
|
1066
|
+
<head>
|
1067
|
+
<title>[=$title=]</title>
|
1068
|
+
</head>
|
1069
|
+
<body>
|
1070
|
+
<h1>[=$title=]</h1>
|
1071
|
+
<div id="content">
|
1072
|
+
[==$_content=]
|
1073
|
+
</div>
|
1074
|
+
</body>
|
1075
|
+
</html>
|
1076
|
+
"js": |
|
1077
|
+
<html>
|
1078
|
+
<head>
|
1079
|
+
<title>${title}</title>
|
1080
|
+
</head>
|
1081
|
+
<body>
|
1082
|
+
<h1>${title}</h1>
|
1083
|
+
<div id="content">
|
1084
|
+
#{_content}
|
1085
|
+
</div>
|
1086
|
+
</body>
|
1087
|
+
</html>
|
1088
|
+
|
1089
|
+
page*:
|
1090
|
+
"python": |
|
1091
|
+
<?py _context['title'] = 'Create Account' ?>
|
1092
|
+
<form action="create" method="post">
|
1093
|
+
<?py include(':form') ?>
|
1094
|
+
<input type="submit" value="Create" />
|
1095
|
+
</form>
|
1096
|
+
"ruby": |
|
1097
|
+
<?rb @title = 'Create Account' ?>
|
1098
|
+
<form action="create" method="post">
|
1099
|
+
<?rb import(:form) ?>
|
1100
|
+
<input type="submit" value="Create" />
|
1101
|
+
</form>
|
1102
|
+
"perl": |
|
1103
|
+
<?pl $_context->{title} = 'Create Account'; ?>
|
1104
|
+
<form action="create" method="post">
|
1105
|
+
<?pl include(':form') ?>
|
1106
|
+
<input type="submit" value="Create" />
|
1107
|
+
</form>
|
1108
|
+
"js": |
|
1109
|
+
<?js _context.title = 'Create Account'; ?>
|
1110
|
+
<form action="create" method="post">
|
1111
|
+
<?js include(':form') ?>
|
1112
|
+
<input type="submit" value="Create" />
|
1113
|
+
</form>
|
1114
|
+
|
1115
|
+
form*:
|
1116
|
+
"python": |5
|
1117
|
+
<p>
|
1118
|
+
Account:
|
1119
|
+
<input type="text" name="account" value="${params.get('account')}" />
|
1120
|
+
</p>
|
1121
|
+
<p>
|
1122
|
+
Password:
|
1123
|
+
<input type="text" name="password" value="${params.get('password')}" />
|
1124
|
+
</p>
|
1125
|
+
"ruby": |5
|
1126
|
+
<p>
|
1127
|
+
Account:
|
1128
|
+
<input type="text" name="account" value="${@params['account']}" />
|
1129
|
+
</p>
|
1130
|
+
<p>
|
1131
|
+
Password:
|
1132
|
+
<input type="text" name="password" value="${@params['password']}" />
|
1133
|
+
</p>
|
1134
|
+
"perl": |5
|
1135
|
+
<p>
|
1136
|
+
Account:
|
1137
|
+
<input type="text" name="account" value="[=$params->{account}=]" />
|
1138
|
+
</p>
|
1139
|
+
<p>
|
1140
|
+
Password:
|
1141
|
+
<input type="text" name="password" value="[=$params->{password}=]" />
|
1142
|
+
</p>
|
1143
|
+
"js": |5
|
1144
|
+
<p>
|
1145
|
+
Account:
|
1146
|
+
<input type="text" name="account" value="${params.account}" />
|
1147
|
+
</p>
|
1148
|
+
<p>
|
1149
|
+
Password:
|
1150
|
+
<input type="text" name="password" value="${params.password}" />
|
1151
|
+
</p>
|
1152
|
+
|
1153
|
+
expected*:
|
1154
|
+
"python": &caching_test_expected |
|
1155
|
+
<html>
|
1156
|
+
<head>
|
1157
|
+
<title>Create Account</title>
|
1158
|
+
</head>
|
1159
|
+
<body>
|
1160
|
+
<h1>Create Account</h1>
|
1161
|
+
<div id="content">
|
1162
|
+
<form action="create" method="post">
|
1163
|
+
<p>
|
1164
|
+
Account:
|
1165
|
+
<input type="text" name="account" value="" />
|
1166
|
+
</p>
|
1167
|
+
<p>
|
1168
|
+
Password:
|
1169
|
+
<input type="text" name="password" value="" />
|
1170
|
+
</p>
|
1171
|
+
<input type="submit" value="Create" />
|
1172
|
+
</form>
|
1173
|
+
|
1174
|
+
</div>
|
1175
|
+
</body>
|
1176
|
+
</html>
|
1177
|
+
"ruby": *caching_test_expected
|
1178
|
+
"perl": *caching_test_expected
|
1179
|
+
"js": *caching_test_expected
|
1180
|
+
|
1181
|
+
|
1182
|
+
### -- for layout inheritance test
|
1183
|
+
|
1184
|
+
#change_layout:
|
1185
|
+
- name: test_change_layout
|
1186
|
+
|
1187
|
+
baselayout*:
|
1188
|
+
"python": |
|
1189
|
+
<html>
|
1190
|
+
<body>
|
1191
|
+
<?py if _context.has_key('title'): ?>
|
1192
|
+
<h1>${title}</h1>
|
1193
|
+
<?py #end ?>
|
1194
|
+
<?py _buf.append(_content) ?>
|
1195
|
+
</body>
|
1196
|
+
</html>
|
1197
|
+
"ruby": |
|
1198
|
+
<html>
|
1199
|
+
<body>
|
1200
|
+
<?rb if @title ?>
|
1201
|
+
<h1>${@title}</h1>
|
1202
|
+
<?rb end ?>
|
1203
|
+
<?rb _buf << @_content ?>
|
1204
|
+
</body>
|
1205
|
+
</html>
|
1206
|
+
"perl": |
|
1207
|
+
<html>
|
1208
|
+
<body>
|
1209
|
+
<?pl if (exists $_context->{title}) { ?>
|
1210
|
+
<h1>[=$title=]</h1>
|
1211
|
+
<?pl } ?>
|
1212
|
+
<?pl push(@_buf, $_content); ?>
|
1213
|
+
</body>
|
1214
|
+
</html>
|
1215
|
+
"js": |
|
1216
|
+
<html>
|
1217
|
+
<body>
|
1218
|
+
<?js if (_context.title) { ?>
|
1219
|
+
<h1>${title}</h1>
|
1220
|
+
<?js } ?>
|
1221
|
+
<?js _buf.append(_content) ?>
|
1222
|
+
</body>
|
1223
|
+
</html>
|
1224
|
+
|
1225
|
+
customlayout*:
|
1226
|
+
"python": |
|
1227
|
+
<?py ## use default layout template name ?>
|
1228
|
+
<?py _context['_layout'] = True ?>
|
1229
|
+
<div id="content">
|
1230
|
+
<?py _buf.append(_content) ?>
|
1231
|
+
</div>
|
1232
|
+
"ruby": |
|
1233
|
+
<?rb ## use default layout template name ?>
|
1234
|
+
<?rb @_layout = true ?>
|
1235
|
+
<div id="content">
|
1236
|
+
<?rb _buf << @_content ?>
|
1237
|
+
</div>
|
1238
|
+
"perl": |
|
1239
|
+
<?pl ## use default layout template name ?>
|
1240
|
+
<?pl $_context->{_layout} = 1; ?>
|
1241
|
+
<div id="content">
|
1242
|
+
<?pl push(@_buf, $_content); ?>
|
1243
|
+
</div>
|
1244
|
+
"js": |
|
1245
|
+
<?js // use default layout template name ?>
|
1246
|
+
<?js _context._layout = 1; ?>
|
1247
|
+
<div id="content">
|
1248
|
+
<?js _buf.push(_content); ?>
|
1249
|
+
</div>
|
1250
|
+
|
1251
|
+
content*:
|
1252
|
+
"python": |
|
1253
|
+
<?py _context['title'] = 'Changing Layout Template Test' ?>
|
1254
|
+
<?py ## specify layout template name ?>
|
1255
|
+
<?py _context['_layout'] = 'customlayout.pyhtml' ?>
|
1256
|
+
foo
|
1257
|
+
bar
|
1258
|
+
baz
|
1259
|
+
"ruby": |
|
1260
|
+
<?rb @title = 'Changing Layout Template Test' ?>
|
1261
|
+
<?rb ## specify layout template name ?>
|
1262
|
+
<?rb @_layout = 'customlayout.rbhtml' ?>
|
1263
|
+
foo
|
1264
|
+
bar
|
1265
|
+
baz
|
1266
|
+
"perl": |
|
1267
|
+
<?pl $_context->{title} = 'Changing Layout Template Test'; ?>
|
1268
|
+
<?pl ## specify layout template name ?>
|
1269
|
+
<?pl $_context->{_layout} = 'customlayout.plhtml'; ?>
|
1270
|
+
foo
|
1271
|
+
bar
|
1272
|
+
baz
|
1273
|
+
"js": |
|
1274
|
+
<?js _context.title = 'Changing Layout Template Test'; ?>
|
1275
|
+
<?js ## specify layout template name ?>
|
1276
|
+
<?js _context._layout = 'customlayout.jshtml'; ?>
|
1277
|
+
foo
|
1278
|
+
bar
|
1279
|
+
baz
|
1280
|
+
|
1281
|
+
expected*:
|
1282
|
+
"python": &expected_change_layout |
|
1283
|
+
<html>
|
1284
|
+
<body>
|
1285
|
+
<h1>Changing Layout Template Test</h1>
|
1286
|
+
<div id="content">
|
1287
|
+
foo
|
1288
|
+
bar
|
1289
|
+
baz
|
1290
|
+
</div>
|
1291
|
+
</body>
|
1292
|
+
</html>
|
1293
|
+
"ruby": *expected_change_layout
|
1294
|
+
"perl": *expected_change_layout
|
1295
|
+
"js": *expected_change_layout
|
1296
|
+
|
1297
|
+
|
1298
|
+
|
1299
|
+
## -- context_scope
|
1300
|
+
- name: test_context_scope
|
1301
|
+
desc: context scope
|
1302
|
+
base*:
|
1303
|
+
"python": |
|
1304
|
+
<?py _context['x1'] = 10 ?>
|
1305
|
+
<?py x2 = 20 ?>
|
1306
|
+
<?py include('part.pyhtml') ?>
|
1307
|
+
[base] _context.get('y1') = #{repr(_context.get('y1'))}
|
1308
|
+
[base] _context.get('y2') = #{repr(_context.get('y2'))}
|
1309
|
+
[base] locals().get('y1') = #{repr(locals().get('y1'))}
|
1310
|
+
[base] locals().get('y2') = #{repr(locals().get('y2'))}
|
1311
|
+
"ruby": |
|
1312
|
+
<?rb @x1 = 10 ?>
|
1313
|
+
<?rb x2 = 20 ?>
|
1314
|
+
<?rb import('part.rbhtml') ?>
|
1315
|
+
[base] @y1 = #{@y1.inspect}
|
1316
|
+
[base] @y2 = #{@y2.inspect}
|
1317
|
+
[base] local_variables() = #{local_variables().inspect()}
|
1318
|
+
"perl": |
|
1319
|
+
<?pl $_context->{x1} = 10; ?>
|
1320
|
+
<?pl my $x2 = 20; ?>
|
1321
|
+
<?pl include('part.plhtml') ?>
|
1322
|
+
[base] _context->{y1} = '[=$_context->{y1}=]'
|
1323
|
+
[base] _context->{y2} = '[=$_context->{y2}=]'
|
1324
|
+
"js": |
|
1325
|
+
part*:
|
1326
|
+
"python": |
|
1327
|
+
[part] _context.get('x1') = #{repr(_context.get('x1'))}
|
1328
|
+
[part] _context.get('x2') = #{repr(_context.get('x2'))}
|
1329
|
+
[part] locals().get('x1') = #{repr(locals().get('x1'))}
|
1330
|
+
[part] locals().get('x2') = #{repr(locals().get('x2'))}
|
1331
|
+
<?py _context['y1'] = 30 ?>
|
1332
|
+
<?py y2 = 40 ?>
|
1333
|
+
"ruby": |
|
1334
|
+
[part] @x1 = #{@x1.inspect}
|
1335
|
+
[part] @x2 = #{@x2.inspect}
|
1336
|
+
[part] local_variables = #{local_variables().inspect}
|
1337
|
+
<?rb @y1 = 30 ?>
|
1338
|
+
<?rb y2 = 40 ?>
|
1339
|
+
"perl": |
|
1340
|
+
[part] _context->{x1} = '[=$_context->{x1}=]'
|
1341
|
+
[part] _context->{x2} = '[=$_context->{x2}=]'
|
1342
|
+
<?pl $_context->{y1} = 30; ?>
|
1343
|
+
<?pl my $y2 = 40; ?>
|
1344
|
+
"js": |
|
1345
|
+
expected*:
|
1346
|
+
"python": |
|
1347
|
+
[part] _context.get('x1') = 10
|
1348
|
+
[part] _context.get('x2') = None
|
1349
|
+
[part] locals().get('x1') = 10
|
1350
|
+
[part] locals().get('x2') = None
|
1351
|
+
[base] _context.get('y1') = 30
|
1352
|
+
[base] _context.get('y2') = None
|
1353
|
+
[base] locals().get('y1') = None
|
1354
|
+
[base] locals().get('y2') = None
|
1355
|
+
# _context.get('x1') = None
|
1356
|
+
# _context.get('x2') = 20
|
1357
|
+
# locals().get('x1') = None
|
1358
|
+
# locals().get('x2') = 20
|
1359
|
+
# _context.get('y1') = None
|
1360
|
+
# _context.get('y2') = None
|
1361
|
+
# locals().get('y1') = 30
|
1362
|
+
# locals().get('y2') = None
|
1363
|
+
"ruby": |
|
1364
|
+
[part] @x1 = 10
|
1365
|
+
[part] @x2 = nil
|
1366
|
+
[part] local_variables = ["_buf", "_context"]
|
1367
|
+
[base] @y1 = 30
|
1368
|
+
[base] @y2 = nil
|
1369
|
+
[base] local_variables() = ["x2", "_buf", "_context"]
|
1370
|
+
"perl": |
|
1371
|
+
[part] _context->{x1} = '10'
|
1372
|
+
[part] _context->{x2} = ''
|
1373
|
+
[base] _context->{y1} = '30'
|
1374
|
+
[base] _context->{y2} = ''
|
1375
|
+
"js": |
|
1376
|
+
|
1377
|
+
|
1378
|
+
## -- template args
|
1379
|
+
- name: test_template_args
|
1380
|
+
content*:
|
1381
|
+
"python": |
|
1382
|
+
<?py #@ARGS a ?>
|
1383
|
+
a = #{repr(a)}
|
1384
|
+
b = #{repr(b)}
|
1385
|
+
"ruby": |
|
1386
|
+
<?rb #@ARGS a ?>
|
1387
|
+
a = #{a}
|
1388
|
+
b = #{b}
|
1389
|
+
"perl": |
|
1390
|
+
<?pl #@ARGS x ?>
|
1391
|
+
x = [=$x=]
|
1392
|
+
y = [=$y=]
|
1393
|
+
"js": |
|
1394
|
+
<?js //@ARGS a ?>
|
1395
|
+
a = #{Tenjin.inspect(a)}
|
1396
|
+
b = #{Tenjin.inspect(b)}
|
1397
|
+
exception*:
|
1398
|
+
"python": NameError
|
1399
|
+
"ruby": NameError
|
1400
|
+
"perl":
|
1401
|
+
"js": |
|
1402
|
+
errormsg*:
|
1403
|
+
"python": name 'b' is not defined
|
1404
|
+
"ruby": "undefined local variable or method `b' for #<Tenjin::Context>"
|
1405
|
+
"perl": |
|
1406
|
+
*** Error: content.plhtml
|
1407
|
+
Global symbol "$y" requires explicit package name at (eval 999) line 3.
|
1408
|
+
"js": |
|
1409
|
+
context: { a: 10, b: 20 }
|
1410
|
+
expected*:
|
1411
|
+
"python": |
|
1412
|
+
a = 10
|
1413
|
+
b = 20
|
1414
|
+
"ruby": |
|
1415
|
+
a = 10
|
1416
|
+
b = 20
|
1417
|
+
"perl":
|
1418
|
+
"js": |
|
1419
|
+
|
1420
|
+
|
1421
|
+
## -- template args are stored into and loaded from cache file?
|
1422
|
+
- name: test_cached_contents
|
1423
|
+
desc: cached script and args are stored into/loaded from cachefile correctly?
|
1424
|
+
input1*:
|
1425
|
+
"python": |
|
1426
|
+
<p>
|
1427
|
+
<?py #@ARGS x,y , z?>
|
1428
|
+
x = #{x}, y = #{y}, z = #{z}
|
1429
|
+
</p>
|
1430
|
+
"ruby": |
|
1431
|
+
<p>
|
1432
|
+
<?rb #@ARGS x,y , z?>
|
1433
|
+
x = #{x}, y = #{y}, z = #{z}
|
1434
|
+
</p>
|
1435
|
+
script1*:
|
1436
|
+
"python": |
|
1437
|
+
_buf.extend(('''<p>\n''', ));
|
1438
|
+
x = _context.get('x'); y = _context.get('y'); z = _context.get('z');
|
1439
|
+
_buf.extend((''' x = ''', to_str(x), ''', y = ''', to_str(y), ''', z = ''', to_str(z), '''
|
1440
|
+
</p>\n''', ));
|
1441
|
+
"ruby": |4
|
1442
|
+
_buf << %Q`<p>\n`
|
1443
|
+
x = @x; y = @y; z = @z;
|
1444
|
+
_buf << %Q` x = #{x}, y = #{y}, z = #{z}
|
1445
|
+
</p>\n`
|
1446
|
+
cache1*:
|
1447
|
+
"python": |
|
1448
|
+
_buf.extend(('''<p>\n''', ));
|
1449
|
+
x = _context.get('x'); y = _context.get('y'); z = _context.get('z');
|
1450
|
+
_buf.extend((''' x = ''', to_str(x), ''', y = ''', to_str(y), ''', z = ''', to_str(z), '''
|
1451
|
+
</p>\n''', ));
|
1452
|
+
"ruby": |
|
1453
|
+
#@ARGS x,y,z
|
1454
|
+
_buf << %Q`<p>\n`
|
1455
|
+
x = @x; y = @y; z = @z;
|
1456
|
+
_buf << %Q` x = #{x}, y = #{y}, z = #{z}
|
1457
|
+
</p>\n`
|
1458
|
+
args1: [ x, y, z ]
|
1459
|
+
input2*:
|
1460
|
+
"python": |
|
1461
|
+
<p>
|
1462
|
+
<?py #@ARGS ?>
|
1463
|
+
x = #{x}, y = #{y}, z = #{z}
|
1464
|
+
</p>
|
1465
|
+
"ruby": |
|
1466
|
+
<p>
|
1467
|
+
<?rb #@ARGS ?>
|
1468
|
+
x = #{x}, y = #{y}, z = #{z}
|
1469
|
+
</p>
|
1470
|
+
script2*:
|
1471
|
+
"python": |
|
1472
|
+
_buf.extend(('''<p>\n''', ));
|
1473
|
+
|
1474
|
+
_buf.extend((''' x = ''', to_str(x), ''', y = ''', to_str(y), ''', z = ''', to_str(z), '''
|
1475
|
+
</p>\n''', ));
|
1476
|
+
"ruby": |4
|
1477
|
+
_buf << %Q`<p>\n`
|
1478
|
+
|
1479
|
+
_buf << %Q` x = #{x}, y = #{y}, z = #{z}
|
1480
|
+
</p>\n`
|
1481
|
+
cache2*:
|
1482
|
+
"python": |
|
1483
|
+
_buf.extend(('''<p>\n''', ));
|
1484
|
+
|
1485
|
+
_buf.extend((''' x = ''', to_str(x), ''', y = ''', to_str(y), ''', z = ''', to_str(z), '''
|
1486
|
+
</p>\n''', ));
|
1487
|
+
"ruby": |4
|
1488
|
+
#@ARGS
|
1489
|
+
_buf << %Q`<p>\n`
|
1490
|
+
|
1491
|
+
_buf << %Q` x = #{x}, y = #{y}, z = #{z}
|
1492
|
+
</p>\n`
|
1493
|
+
args2: [ ]
|
1494
|
+
|
1495
|
+
|
1496
|
+
## -- for template path test
|
1497
|
+
- name: test_template_path
|
1498
|
+
common_layout*:
|
1499
|
+
"python": |
|
1500
|
+
<html>
|
1501
|
+
<body>
|
1502
|
+
#{_content}
|
1503
|
+
<?py include(':footer') ?>
|
1504
|
+
</body>
|
1505
|
+
</html>
|
1506
|
+
"ruby": |
|
1507
|
+
<html>
|
1508
|
+
<body>
|
1509
|
+
#{@_content}
|
1510
|
+
<?rb import(:footer) ?>
|
1511
|
+
</body>
|
1512
|
+
</html>
|
1513
|
+
"perl": |
|
1514
|
+
<html>
|
1515
|
+
<body>
|
1516
|
+
[==$_content=]
|
1517
|
+
<?pl include(':footer'); ?>
|
1518
|
+
</body>
|
1519
|
+
</html>
|
1520
|
+
"js": |
|
1521
|
+
<html>
|
1522
|
+
<body>
|
1523
|
+
#{_content}
|
1524
|
+
<?js include(':footer'); ?>
|
1525
|
+
</body>
|
1526
|
+
</html>
|
1527
|
+
|
1528
|
+
common_body*:
|
1529
|
+
"python": |
|
1530
|
+
<ul>
|
1531
|
+
<?py for item in items: ?>
|
1532
|
+
<li>${item}</li>
|
1533
|
+
<?py #end ?>
|
1534
|
+
</ul>
|
1535
|
+
"ruby": |
|
1536
|
+
<ul>
|
1537
|
+
<?rb for item in @items ?>
|
1538
|
+
<li>${item}</li>
|
1539
|
+
<?rb end ?>
|
1540
|
+
</ul>
|
1541
|
+
"perl": |
|
1542
|
+
<ul>
|
1543
|
+
<?pl for my $item (@$items) { ?>
|
1544
|
+
<li>[=$item=]</li>
|
1545
|
+
<?pl } ?>
|
1546
|
+
</ul>
|
1547
|
+
"js": |
|
1548
|
+
<ul>
|
1549
|
+
<?js for (var i = 0, n = items.length; i < n; i++) { ?>
|
1550
|
+
<li>${items[i]}</li>
|
1551
|
+
<?js } ?>
|
1552
|
+
</ul>
|
1553
|
+
|
1554
|
+
common_footer*:
|
1555
|
+
"python": &common_footer |
|
1556
|
+
<hr />
|
1557
|
+
<address>
|
1558
|
+
<a href="mailto:webmaster@localhost">webmaster@localhost</a>
|
1559
|
+
</address>
|
1560
|
+
"ruby": *common_footer
|
1561
|
+
"perl": *common_footer
|
1562
|
+
"js": *common_footer
|
1563
|
+
|
1564
|
+
user_layout*:
|
1565
|
+
"python": |
|
1566
|
+
<?xml version="1.0" ?>
|
1567
|
+
<html xml:lang="en">
|
1568
|
+
<body>
|
1569
|
+
<?py _buf.append(_content) ?>
|
1570
|
+
<?py include(':footer') ?>
|
1571
|
+
</body>
|
1572
|
+
</html>
|
1573
|
+
"ruby": |
|
1574
|
+
<?xml version="1.0" ?>
|
1575
|
+
<html xml:lang="en">
|
1576
|
+
<body>
|
1577
|
+
<?rb _buf << @_content ?>
|
1578
|
+
<?rb import(:footer) ?>
|
1579
|
+
</body>
|
1580
|
+
</html>
|
1581
|
+
"perl": |
|
1582
|
+
<?xml version="1.0" ?>
|
1583
|
+
<html xml:lang="en">
|
1584
|
+
<body>
|
1585
|
+
[==$_content==]
|
1586
|
+
<?pl include(':footer') ?>
|
1587
|
+
</body>
|
1588
|
+
</html>
|
1589
|
+
"js": |
|
1590
|
+
<?xml version="1.0" ?>
|
1591
|
+
<html xml:lang="en">
|
1592
|
+
<body>
|
1593
|
+
<?js echo(_content) ?>
|
1594
|
+
<?js include(':footer') ?>
|
1595
|
+
</body>
|
1596
|
+
</html>
|
1597
|
+
|
1598
|
+
user_body*:
|
1599
|
+
"python": |
|
1600
|
+
<table>
|
1601
|
+
<?py for item in items: ?>
|
1602
|
+
<tr><td>${item}</td></tr>
|
1603
|
+
<?py #end ?>
|
1604
|
+
</table>
|
1605
|
+
"ruby": |
|
1606
|
+
<table>
|
1607
|
+
<?rb for item in @items ?>
|
1608
|
+
<tr><td>${item}</td></tr>
|
1609
|
+
<?rb end ?>
|
1610
|
+
</table>
|
1611
|
+
"perl": |
|
1612
|
+
<table>
|
1613
|
+
<?pl for my $item (@$items) { ?>
|
1614
|
+
<tr><td>[=$item=]</td></tr>
|
1615
|
+
<?pl } ?>
|
1616
|
+
</table>
|
1617
|
+
"js": |
|
1618
|
+
<table>
|
1619
|
+
<?js for (var i = 0, n = items.length; i < n; i++) { ?>
|
1620
|
+
<tr><td>${items[i]}</td></tr>
|
1621
|
+
<?js } ?>
|
1622
|
+
</table>
|
1623
|
+
|
1624
|
+
user_footer*:
|
1625
|
+
"python": &user_footer |
|
1626
|
+
<div class="footer" style="margin-top: 20px; background-color: gray">
|
1627
|
+
<a href="mailto:webmaster@localhost">webmaster@localhost</a>
|
1628
|
+
</div>
|
1629
|
+
"ruby": *user_footer
|
1630
|
+
"perl": *user_footer
|
1631
|
+
"js": *user_footer
|
1632
|
+
|
1633
|
+
expected_common_common_common*:
|
1634
|
+
"python": &expected41 |
|
1635
|
+
<html>
|
1636
|
+
<body>
|
1637
|
+
<ul>
|
1638
|
+
<li>AAA</li>
|
1639
|
+
<li>BBB</li>
|
1640
|
+
<li>CCC</li>
|
1641
|
+
</ul>
|
1642
|
+
|
1643
|
+
<hr />
|
1644
|
+
<address>
|
1645
|
+
<a href="mailto:webmaster@localhost">webmaster@localhost</a>
|
1646
|
+
</address>
|
1647
|
+
</body>
|
1648
|
+
</html>
|
1649
|
+
"ruby": *expected41
|
1650
|
+
"perl": *expected41
|
1651
|
+
"js": *expected41
|
1652
|
+
|
1653
|
+
expected_user_common_common*:
|
1654
|
+
"python": &expected42 |
|
1655
|
+
<?xml version="1.0" ?>
|
1656
|
+
<html xml:lang="en">
|
1657
|
+
<body>
|
1658
|
+
<ul>
|
1659
|
+
<li>AAA</li>
|
1660
|
+
<li>BBB</li>
|
1661
|
+
<li>CCC</li>
|
1662
|
+
</ul>
|
1663
|
+
<hr />
|
1664
|
+
<address>
|
1665
|
+
<a href="mailto:webmaster@localhost">webmaster@localhost</a>
|
1666
|
+
</address>
|
1667
|
+
</body>
|
1668
|
+
</html>
|
1669
|
+
"ruby": *expected42
|
1670
|
+
"perl": *expected42
|
1671
|
+
"js": *expected42
|
1672
|
+
|
1673
|
+
expected_common_user_common*:
|
1674
|
+
"python": &expected43 |
|
1675
|
+
<html>
|
1676
|
+
<body>
|
1677
|
+
<table>
|
1678
|
+
<tr><td>AAA</td></tr>
|
1679
|
+
<tr><td>BBB</td></tr>
|
1680
|
+
<tr><td>CCC</td></tr>
|
1681
|
+
</table>
|
1682
|
+
|
1683
|
+
<hr />
|
1684
|
+
<address>
|
1685
|
+
<a href="mailto:webmaster@localhost">webmaster@localhost</a>
|
1686
|
+
</address>
|
1687
|
+
</body>
|
1688
|
+
</html>
|
1689
|
+
"ruby": *expected43
|
1690
|
+
"perl": *expected43
|
1691
|
+
"js": *expected43
|
1692
|
+
|
1693
|
+
expected_user_user_common*:
|
1694
|
+
"python": &expected44 |
|
1695
|
+
<?xml version="1.0" ?>
|
1696
|
+
<html xml:lang="en">
|
1697
|
+
<body>
|
1698
|
+
<table>
|
1699
|
+
<tr><td>AAA</td></tr>
|
1700
|
+
<tr><td>BBB</td></tr>
|
1701
|
+
<tr><td>CCC</td></tr>
|
1702
|
+
</table>
|
1703
|
+
<hr />
|
1704
|
+
<address>
|
1705
|
+
<a href="mailto:webmaster@localhost">webmaster@localhost</a>
|
1706
|
+
</address>
|
1707
|
+
</body>
|
1708
|
+
</html>
|
1709
|
+
"ruby": *expected44
|
1710
|
+
"perl": *expected44
|
1711
|
+
"js": *expected44
|
1712
|
+
|
1713
|
+
expected_common_common_user*:
|
1714
|
+
"python": &expected45 |
|
1715
|
+
<html>
|
1716
|
+
<body>
|
1717
|
+
<ul>
|
1718
|
+
<li>AAA</li>
|
1719
|
+
<li>BBB</li>
|
1720
|
+
<li>CCC</li>
|
1721
|
+
</ul>
|
1722
|
+
|
1723
|
+
<div class="footer" style="margin-top: 20px; background-color: gray">
|
1724
|
+
<a href="mailto:webmaster@localhost">webmaster@localhost</a>
|
1725
|
+
</div>
|
1726
|
+
</body>
|
1727
|
+
</html>
|
1728
|
+
"ruby": *expected45
|
1729
|
+
"perl": *expected45
|
1730
|
+
"js": *expected45
|
1731
|
+
|
1732
|
+
expected_user_common_user*:
|
1733
|
+
"python": &expected46 |
|
1734
|
+
<?xml version="1.0" ?>
|
1735
|
+
<html xml:lang="en">
|
1736
|
+
<body>
|
1737
|
+
<ul>
|
1738
|
+
<li>AAA</li>
|
1739
|
+
<li>BBB</li>
|
1740
|
+
<li>CCC</li>
|
1741
|
+
</ul>
|
1742
|
+
<div class="footer" style="margin-top: 20px; background-color: gray">
|
1743
|
+
<a href="mailto:webmaster@localhost">webmaster@localhost</a>
|
1744
|
+
</div>
|
1745
|
+
</body>
|
1746
|
+
</html>
|
1747
|
+
"ruby": *expected46
|
1748
|
+
"perl": *expected46
|
1749
|
+
"js": *expected46
|
1750
|
+
|
1751
|
+
expected_common_user_user*:
|
1752
|
+
"python": &expected47 |
|
1753
|
+
<html>
|
1754
|
+
<body>
|
1755
|
+
<table>
|
1756
|
+
<tr><td>AAA</td></tr>
|
1757
|
+
<tr><td>BBB</td></tr>
|
1758
|
+
<tr><td>CCC</td></tr>
|
1759
|
+
</table>
|
1760
|
+
|
1761
|
+
<div class="footer" style="margin-top: 20px; background-color: gray">
|
1762
|
+
<a href="mailto:webmaster@localhost">webmaster@localhost</a>
|
1763
|
+
</div>
|
1764
|
+
</body>
|
1765
|
+
</html>
|
1766
|
+
"ruby": *expected47
|
1767
|
+
"perl": *expected47
|
1768
|
+
"js": *expected47
|
1769
|
+
|
1770
|
+
expected_user_user_user*:
|
1771
|
+
"python": &expected48 |
|
1772
|
+
<?xml version="1.0" ?>
|
1773
|
+
<html xml:lang="en">
|
1774
|
+
<body>
|
1775
|
+
<table>
|
1776
|
+
<tr><td>AAA</td></tr>
|
1777
|
+
<tr><td>BBB</td></tr>
|
1778
|
+
<tr><td>CCC</td></tr>
|
1779
|
+
</table>
|
1780
|
+
<div class="footer" style="margin-top: 20px; background-color: gray">
|
1781
|
+
<a href="mailto:webmaster@localhost">webmaster@localhost</a>
|
1782
|
+
</div>
|
1783
|
+
</body>
|
1784
|
+
</html>
|
1785
|
+
"ruby": *expected48
|
1786
|
+
"perl": *expected48
|
1787
|
+
"js": *expected48
|
1788
|
+
|
1789
|
+
|
1790
|
+
|
1791
|
+
## -- preprocessor
|
1792
|
+
|
1793
|
+
- name: test_preprocessor
|
1794
|
+
testopts: { preprocess: true }
|
1795
|
+
form*: # <?PY ... ?>
|
1796
|
+
"python": |
|
1797
|
+
<?PY states = { "CA": "California", ?>
|
1798
|
+
<?PY "NY": "New York", ?>
|
1799
|
+
<?PY "FL": "Florida", } ?>
|
1800
|
+
<?PY # ?>
|
1801
|
+
<?py chk = { params['state']: ' checked="checked"' } ?>
|
1802
|
+
<?PY codes = states.keys() ?>
|
1803
|
+
<?PY codes.sort() ?>
|
1804
|
+
<select name="state">
|
1805
|
+
<option value="">-</option>
|
1806
|
+
<?PY for code in codes: ?>
|
1807
|
+
<option value="#{{code}}"#{chk.get(#{{repr(code)}}, '')}>${{states[code]}}</option>
|
1808
|
+
<?PY #endfor ?>
|
1809
|
+
</select>
|
1810
|
+
"ruby": |
|
1811
|
+
<?RB states = { :CA => "California", ?>
|
1812
|
+
<?RB :NY => "New York", ?>
|
1813
|
+
<?RB :FL => "Florida", } ?>
|
1814
|
+
<?rb chk = { @params['state'] => ' checked="checked"' } ?>
|
1815
|
+
<select name="state">
|
1816
|
+
<option value="">-</option>
|
1817
|
+
<?RB for code in states.keys.sort_by{|c| c.to_s} ?>
|
1818
|
+
<option value="#{{code}}"#{chk[#{{code.inspect}}]}>${{states[code]}}</option>
|
1819
|
+
<?RB end ?>
|
1820
|
+
</select>
|
1821
|
+
"perl": |
|
1822
|
+
<?PL my $states = { "CA"=>"California", ?>
|
1823
|
+
<?PL "NY"=>"New York", ?>
|
1824
|
+
<?PL "FL"=>"Florida", }; ?>
|
1825
|
+
<?pl my $chk = { $params->{state} => ' checked="checked"' }; ?>
|
1826
|
+
<select name="state">
|
1827
|
+
<option value="">-</option>
|
1828
|
+
<?PL for my $code (sort(keys %$states)) { ?>
|
1829
|
+
<option value="[*==$code=*]"[==$chk->{[*==$code=*]}=]>[*=$states->{$code}=*]</option>
|
1830
|
+
<?PL } ?>
|
1831
|
+
</select>
|
1832
|
+
"js": |
|
1833
|
+
<?JS var states = { "CA" : "California", ?>
|
1834
|
+
<?JS "NY" : "New York", ?>
|
1835
|
+
<?JS "FL" : "Florida" }; ?>
|
1836
|
+
<?js var chk = {}; ?>
|
1837
|
+
<?js chk[params.state] = ' checked="checked"'; ?>
|
1838
|
+
<select name="state">
|
1839
|
+
<option value="">-</option>
|
1840
|
+
<?JS var codes = []; ?>
|
1841
|
+
<?JS for (var code in states) { codes.push(code); } ?>
|
1842
|
+
<?JS codes.sort(); ?>
|
1843
|
+
<?JS for (var i = 0, n = codes.length; i < n; i++) { ?>
|
1844
|
+
<?JS var code = codes[i]; ?>
|
1845
|
+
<option value="#{{code}}"#{chk.#{{code}}||''}>${{states[code]}}</option>
|
1846
|
+
<?JS } ?>
|
1847
|
+
</select>
|
1848
|
+
|
1849
|
+
create*: # <?py include() ?>
|
1850
|
+
"python": |
|
1851
|
+
<?PY label = '"Create"' ?>
|
1852
|
+
<form action="#{{action}}">
|
1853
|
+
<?py include(':form') ?>
|
1854
|
+
<input type="submit" value="${{label}}">
|
1855
|
+
</form>
|
1856
|
+
"ruby": |
|
1857
|
+
<?RB label = '"Create"' ?>
|
1858
|
+
<form action="#{{@action}}">
|
1859
|
+
<?rb import(:form) ?>
|
1860
|
+
<input type="submit" value="${{label}}">
|
1861
|
+
</form>
|
1862
|
+
"perl": |
|
1863
|
+
<?PL my $label = '"Create"'; ?>
|
1864
|
+
<form action="[=$action=]">
|
1865
|
+
<?pl include(':form') ?>
|
1866
|
+
<input type="submit" value="[*=$label=*]">
|
1867
|
+
</form>
|
1868
|
+
"js": |
|
1869
|
+
<?JS var label = '"Create"'; ?>
|
1870
|
+
<form action="#{{action}}">
|
1871
|
+
<?js include(':form'); ?>
|
1872
|
+
<input type="submit" value="${{label}}">
|
1873
|
+
</form>
|
1874
|
+
|
1875
|
+
update*: # <?PY include() ?>
|
1876
|
+
"python": |
|
1877
|
+
<form action="#{{action}}">
|
1878
|
+
<?PY label = '"Update"' ?>
|
1879
|
+
<?PY include(':form') ?>
|
1880
|
+
<input type="submit" value="${{label}}">
|
1881
|
+
</form>
|
1882
|
+
"ruby": |
|
1883
|
+
<form action="#{{@action}}">
|
1884
|
+
<?RB label = '"Update"' ?>
|
1885
|
+
<?RB import(:form) ?>
|
1886
|
+
<input type="submit" value="${{label}}">
|
1887
|
+
</form>
|
1888
|
+
"perl": |
|
1889
|
+
<form action="[==$action=]">
|
1890
|
+
<?PL my $label = '"Update"'; ?>
|
1891
|
+
<?PL include(':form'); ?>
|
1892
|
+
<input type="submit" value="[*=$label=*]">
|
1893
|
+
</form>
|
1894
|
+
"js": |
|
1895
|
+
<?JS var label = '"Update"' ?>
|
1896
|
+
<form action="#{{action}}">
|
1897
|
+
<?JS include(':form'); ?>
|
1898
|
+
<input type="submit" value="${{label}}">
|
1899
|
+
</form>
|
1900
|
+
|
1901
|
+
layout*:
|
1902
|
+
"python": |
|
1903
|
+
<html>
|
1904
|
+
<body>
|
1905
|
+
<h1>${title}</h1>
|
1906
|
+
<?py echo(_content) ?>
|
1907
|
+
</body>
|
1908
|
+
</html>
|
1909
|
+
"ruby": |
|
1910
|
+
<html>
|
1911
|
+
<body>
|
1912
|
+
<h1>${@title}</h1>
|
1913
|
+
<?rb echo(@_content) ?>
|
1914
|
+
</body>
|
1915
|
+
</html>
|
1916
|
+
"perl": |
|
1917
|
+
<html>
|
1918
|
+
<body>
|
1919
|
+
<h1>[=$title=]</h1>
|
1920
|
+
<?pl echo($_content); ?>
|
1921
|
+
</body>
|
1922
|
+
</html>
|
1923
|
+
"js": |
|
1924
|
+
<html>
|
1925
|
+
<body>
|
1926
|
+
<h1>${title}</h1>
|
1927
|
+
<?js echo(_content); ?>
|
1928
|
+
</body>
|
1929
|
+
</html>
|
1930
|
+
|
1931
|
+
expected1: |
|
1932
|
+
<html>
|
1933
|
+
<body>
|
1934
|
+
<h1>Create</h1>
|
1935
|
+
<form action="create">
|
1936
|
+
<select name="state">
|
1937
|
+
<option value="">-</option>
|
1938
|
+
<option value="CA">California</option>
|
1939
|
+
<option value="FL">Florida</option>
|
1940
|
+
<option value="NY" checked="checked">New York</option>
|
1941
|
+
</select>
|
1942
|
+
<input type="submit" value=""Create"">
|
1943
|
+
</form>
|
1944
|
+
</body>
|
1945
|
+
</html>
|
1946
|
+
|
1947
|
+
expected2: |
|
1948
|
+
<html>
|
1949
|
+
<body>
|
1950
|
+
<h1>Update</h1>
|
1951
|
+
<form action="update">
|
1952
|
+
<select name="state">
|
1953
|
+
<option value="">-</option>
|
1954
|
+
<option value="CA">California</option>
|
1955
|
+
<option value="FL">Florida</option>
|
1956
|
+
<option value="NY" checked="checked">New York</option>
|
1957
|
+
</select>
|
1958
|
+
<input type="submit" value=""Update"">
|
1959
|
+
</form>
|
1960
|
+
</body>
|
1961
|
+
</html>
|
1962
|
+
|
1963
|
+
cache1*:
|
1964
|
+
"python": |
|
1965
|
+
chk = { params['state']: ' checked="checked"' }
|
1966
|
+
_buf.extend(('''<select name="state">
|
1967
|
+
<option value="">-</option>
|
1968
|
+
<option value="CA"''', to_str(chk.get('CA', '')), '''>California</option>
|
1969
|
+
<option value="FL"''', to_str(chk.get('FL', '')), '''>Florida</option>
|
1970
|
+
<option value="NY"''', to_str(chk.get('NY', '')), '''>New York</option>
|
1971
|
+
</select>\n''', ));
|
1972
|
+
"ruby": |
|
1973
|
+
"perl": |
|
1974
|
+
"js": |
|
1975
|
+
var _buf = []; var chk = {};
|
1976
|
+
chk[params.state] = ' checked="checked"';
|
1977
|
+
_buf.push('<select name="state">\n\
|
1978
|
+
<option value="">-</option>\n\
|
1979
|
+
<option value="CA"', chk.CA||'', '>California</option>\n\
|
1980
|
+
<option value="FL"', chk.FL||'', '>Florida</option>\n\
|
1981
|
+
<option value="NY"', chk.NY||'', '>New York</option>\n\
|
1982
|
+
</select>\n');
|
1983
|
+
_buf.join('')
|
1984
|
+
cache2*:
|
1985
|
+
"python": |
|
1986
|
+
_buf.extend(('''<form action="create">\n''', ));
|
1987
|
+
include(':form')
|
1988
|
+
_buf.extend((''' <input type="submit" value=""Create"">
|
1989
|
+
</form>\n''', ));
|
1990
|
+
"ruby": |
|
1991
|
+
"perl": |
|
1992
|
+
"js": |
|
1993
|
+
var _buf = []; _buf.push('<form action="create">\n');
|
1994
|
+
_buf.push(_context._engine.render(':form', _context, false));
|
1995
|
+
_buf.push(' <input type="submit" value=""Create"">\n\
|
1996
|
+
</form>\n');
|
1997
|
+
_buf.join('')
|
1998
|
+
cache3*:
|
1999
|
+
"python": |
|
2000
|
+
_buf.extend(('''<html>
|
2001
|
+
<body>
|
2002
|
+
<h1>''', escape(to_str(title)), '''</h1>\n''', ));
|
2003
|
+
echo(_content)
|
2004
|
+
_buf.extend((''' </body>
|
2005
|
+
</html>\n''', ));
|
2006
|
+
"ruby": |
|
2007
|
+
"perl": |
|
2008
|
+
"js": |
|
2009
|
+
var _buf = []; _buf.push('<html>\n\
|
2010
|
+
<body>\n\
|
2011
|
+
<h1>', escapeXml(title), '</h1>\n');
|
2012
|
+
_buf.push(_content);
|
2013
|
+
_buf.push(' </body>\n\
|
2014
|
+
</html>\n');
|
2015
|
+
_buf.join('')
|
2016
|
+
cache4*:
|
2017
|
+
"python": |
|
2018
|
+
_buf.extend(('''<form action="update">
|
2019
|
+
<select name="state">
|
2020
|
+
<option value="">-</option>
|
2021
|
+
<option value="CA">California</option>
|
2022
|
+
<option value="FL">Florida</option>
|
2023
|
+
<option value="NY" checked="checked">New York</option>
|
2024
|
+
</select>
|
2025
|
+
<input type="submit" value=""Update"">
|
2026
|
+
</form>\n''', ));
|
2027
|
+
"ruby": |
|
2028
|
+
"perl": |
|
2029
|
+
"js": |
|
2030
|
+
var _buf = []; _buf.push('<form action="update">\n\
|
2031
|
+
<select name="state">\n\
|
2032
|
+
<option value="">-</option>\n\
|
2033
|
+
<option value="CA">California</option>\n\
|
2034
|
+
<option value="FL">Florida</option>\n\
|
2035
|
+
<option value="NY" checked="checked">New York</option>\n\
|
2036
|
+
</select>\n\
|
2037
|
+
<input type="submit" value=""Update"">\n\
|
2038
|
+
</form>\n');
|
2039
|
+
_buf.join('')
|