tenjin 0.6.2 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (282) hide show
  1. data/CHANGES.txt +163 -0
  2. data/MIT-LICENSE +16 -17
  3. data/README.txt +5 -5
  4. data/benchmark/Makefile +9 -0
  5. data/benchmark/bench.rb +3 -2
  6. data/bin/rbtenjin +6 -3
  7. data/doc/docstyle.css +25 -4
  8. data/doc/users-guide.html +2088 -1563
  9. data/lib/tenjin.rb +784 -158
  10. data/public_html/_layout.rbhtml +33 -0
  11. data/public_html/css/style.css +77 -0
  12. data/public_html/env.rbhtml +15 -0
  13. data/public_html/favicon.ico +0 -0
  14. data/public_html/hello.rbhtml +14 -0
  15. data/public_html/index.rbhtml +39 -0
  16. data/public_html/rbtenjin.cgi +188 -0
  17. data/tenjin.gemspec +9 -6
  18. data/test/data/examples/preprocessing/main.rb +1 -1
  19. data/test/data/examples/preprocessing/select.rbhtml +1 -1
  20. data/test/data/faq/{ex11-bench.rb → ex10-bench.rb} +3 -3
  21. data/test/data/faq/ex10-content.rbhtml +8 -11
  22. data/test/data/faq/{ex11-layout1.rbhtml → ex10-layout1.rbhtml} +0 -0
  23. data/test/data/faq/{ex11-layout2.rbhtml → ex10-layout2.rbhtml} +0 -0
  24. data/test/data/faq/{ex11.rb → ex10.rb} +1 -1
  25. data/test/data/faq/{ex11.rbhtml → ex10.rbhtml} +0 -0
  26. data/test/data/faq/{ex11.source → ex10.source} +2 -2
  27. data/test/data/faq/{ex11_arraybuffer.result → ex10_arraybuffer.result} +1 -1
  28. data/test/data/faq/{ex5.rbhtml → ex2.rbhtml} +0 -0
  29. data/test/data/faq/{ex5_template_args.source → ex2_template_args.source} +1 -1
  30. data/test/data/faq/{ex7-expr-pattern.rb → ex4-expr-pattern.rb} +1 -1
  31. data/test/data/faq/{ex7-expr-pattern.rbhtml → ex4-expr-pattern.rbhtml} +0 -0
  32. data/test/data/faq/{ex7_expr_pattern.result → ex4_expr_pattern.result} +1 -1
  33. data/test/data/faq/{ex6-content.rhtml → ex5-content.rhtml} +0 -0
  34. data/test/data/faq/{ex6-layout.rhtml → ex5-layout.rhtml} +0 -0
  35. data/test/data/faq/{ex6.rb → ex5.rb} +2 -2
  36. data/test/data/faq/{ex6_eruby.result → ex5_eruby.result} +1 -1
  37. data/test/data/faq/{ex2-content.rbhtml → ex6-content.rbhtml} +0 -0
  38. data/test/data/faq/{ex2-layout.rbhtml → ex6-layout.rbhtml} +0 -0
  39. data/test/data/faq/{ex2_removenl.result → ex6_removenl.result} +1 -1
  40. data/test/data/faq/ex7-m18n.rb +48 -0
  41. data/test/data/faq/{ex8-m18n.rbhtml → ex7-m18n.rbhtml} +0 -0
  42. data/test/data/faq/{ex8_m18n.result → ex7_m18n.result} +1 -1
  43. data/test/data/faq/ex8-baselayout.rbhtml +8 -0
  44. data/test/data/faq/ex8-content.rbhtml +6 -0
  45. data/test/data/faq/{ex9-mylayout.rbhtml → ex8-mylayout.rbhtml} +0 -0
  46. data/test/data/faq/{ex9_changelayout.result → ex8_changelayout.result} +1 -1
  47. data/test/data/faq/ex9-baselayout.rbhtml +24 -5
  48. data/test/data/faq/ex9-content.rbhtml +12 -6
  49. data/test/data/faq/{ex10-customlayout.rbhtml → ex9-customlayout.rbhtml} +1 -1
  50. data/test/data/faq/{ex10_inherit.result → ex9_inherit.result} +1 -1
  51. data/test/data/faq/helpers1.rb +17 -0
  52. data/test/data/faq/helpers1.rbhtml +4 -0
  53. data/test/data/faq/helpers1.result +11 -0
  54. data/test/data/faq/helpers2.rb +21 -0
  55. data/test/data/faq/helpers2.rbhtml +4 -0
  56. data/test/data/faq/helpers2.result +11 -0
  57. data/test/data/faq/weekday1.rb +6 -0
  58. data/test/data/faq/weekday1.rbhtml +9 -0
  59. data/test/data/faq/weekday1.result +23 -0
  60. data/test/data/faq/weekday2.rb +8 -0
  61. data/test/data/faq/weekday2.rbhtml +10 -0
  62. data/test/data/faq/weekday2.result +24 -0
  63. data/test/data/faq/weekday3.rb +22 -0
  64. data/test/data/faq/weekday3.rbhtml +3 -0
  65. data/test/data/faq/weekday3.result +28 -0
  66. data/test/data/users_guide/test_010/main.rb +14 -0
  67. data/test/data/users_guide/test_010/result.output +13 -0
  68. data/test/data/users_guide/test_010/views/page.rbhtml +11 -0
  69. data/test/data/users_guide/test_011/main.rb +14 -0
  70. data/test/data/users_guide/test_011/result.output +2 -0
  71. data/test/data/users_guide/test_011/views/page.rbhtml +11 -0
  72. data/test/data/users_guide/test_020/main.rb +14 -0
  73. data/test/data/users_guide/test_020/result.output +13 -0
  74. data/test/data/users_guide/test_020/views/page.rbhtml +11 -0
  75. data/test/data/users_guide/test_021/main.rb +12 -0
  76. data/test/data/users_guide/test_021/result.output +12 -0
  77. data/test/data/users_guide/test_021/views/page.rbhtml +11 -0
  78. data/test/data/users_guide/test_030/main.rb +14 -0
  79. data/test/data/users_guide/test_030/result.output +23 -0
  80. data/test/data/users_guide/test_030/views/_layout.rbhtml +10 -0
  81. data/test/data/users_guide/test_030/views/page.rbhtml +11 -0
  82. data/test/data/users_guide/test_040/main.rb +14 -0
  83. data/test/data/users_guide/test_040/result.output +23 -0
  84. data/test/data/users_guide/test_040/views/_layout.rbhtml +10 -0
  85. data/test/data/users_guide/test_040/views/page.rbhtml +12 -0
  86. data/test/data/users_guide/test_050/main.rb +14 -0
  87. data/test/data/users_guide/test_050/result.output +14 -0
  88. data/test/data/users_guide/test_050/views/_layout.rbhtml +10 -0
  89. data/test/data/users_guide/test_050/views/page.rbhtml +13 -0
  90. data/test/data/users_guide/test_051/main.rb +14 -0
  91. data/test/data/users_guide/test_051/result.output +12 -0
  92. data/test/data/users_guide/test_051/views/_layout.rbhtml +11 -0
  93. data/test/data/users_guide/test_051/views/page.rbhtml +13 -0
  94. data/test/data/users_guide/test_060/main.rb +14 -0
  95. data/test/data/users_guide/test_060/result.output +29 -0
  96. data/test/data/users_guide/test_060/views/_footer.rbhtml +3 -0
  97. data/test/data/users_guide/test_060/views/_header.rbhtml +3 -0
  98. data/test/data/users_guide/test_060/views/_layout.rbhtml +13 -0
  99. data/test/data/users_guide/test_060/views/page.rbhtml +13 -0
  100. data/test/data/users_guide/test_070/main.rb +14 -0
  101. data/test/data/users_guide/test_070/result.output +29 -0
  102. data/test/data/users_guide/test_070/views/_footer.rbhtml +3 -0
  103. data/test/data/users_guide/test_070/views/_header.rbhtml +3 -0
  104. data/test/data/users_guide/test_070/views/_layout.rbhtml +13 -0
  105. data/test/data/users_guide/test_070/views/page.rbhtml +13 -0
  106. data/test/data/users_guide/test_capturing/main.rb +24 -0
  107. data/test/data/users_guide/test_capturing/result.output +28 -0
  108. data/test/data/users_guide/test_capturing/views/_layout.rbhtml +21 -0
  109. data/test/data/users_guide/test_capturing/views/blog-post.rbhtml +13 -0
  110. data/test/data/users_guide/test_context/context.rb +5 -0
  111. data/test/data/users_guide/test_context/context.yaml +4 -0
  112. data/test/data/users_guide/test_context/example.rbhtml +5 -0
  113. data/test/data/users_guide/test_context/result1.output +6 -0
  114. data/test/data/users_guide/test_context/result2.output +6 -0
  115. data/test/data/users_guide/test_context/result3.output +6 -0
  116. data/test/data/users_guide/test_context/result4.output +6 -0
  117. data/test/data/users_guide/test_convert/example.rbhtml +5 -0
  118. data/test/data/users_guide/test_convert/result1.output +7 -0
  119. data/test/data/users_guide/test_convert/result2.output +6 -0
  120. data/test/data/users_guide/test_escape/main.rb +4 -0
  121. data/test/data/users_guide/test_escape/result.output +5 -0
  122. data/test/data/users_guide/test_escape/views/page.rbhtml +4 -0
  123. data/test/data/users_guide/test_execute/example.rbhtml +6 -0
  124. data/test/data/users_guide/test_execute/result.output +6 -0
  125. data/test/data/users_guide/test_fragmentcache/cache.d/items/1 +5 -0
  126. data/test/data/users_guide/test_fragmentcache/main.rb +21 -0
  127. data/test/data/users_guide/test_fragmentcache/result.output +8 -0
  128. data/test/data/users_guide/test_fragmentcache/result2.output +6 -0
  129. data/test/data/users_guide/test_fragmentcache/views/items.rbhtml +10 -0
  130. data/test/data/users_guide/test_logging/ex-logger.rb +11 -0
  131. data/test/data/users_guide/test_logging/example.rbhtml +0 -0
  132. data/test/data/users_guide/test_logging/result1.output +3 -0
  133. data/test/data/users_guide/test_logging/result2.output +2 -0
  134. data/test/data/users_guide/test_m17n/m17n.rb +44 -0
  135. data/test/data/users_guide/test_m17n/m17n.rbhtml +5 -0
  136. data/test/data/users_guide/test_m17n/result.output +9 -0
  137. data/test/data/users_guide/test_m17n/result_en.output +4 -0
  138. data/test/data/users_guide/test_m17n/result_fr.output +4 -0
  139. data/test/data/users_guide/test_nested/main.rb +8 -0
  140. data/test/data/users_guide/test_nested/result.output +15 -0
  141. data/test/data/users_guide/test_nested/views/_blog_layout.rbhtml +5 -0
  142. data/test/data/users_guide/{layout8_html.rbhtml → test_nested/views/_site_layout.rbhtml} +0 -0
  143. data/test/data/users_guide/test_nested/views/blog_post.rbhtml +4 -0
  144. data/test/data/users_guide/test_preprocessing/pp-example1.rb +14 -0
  145. data/test/data/users_guide/test_preprocessing/result1a.output +11 -0
  146. data/test/data/users_guide/test_preprocessing/result1b.output +5 -0
  147. data/test/data/users_guide/test_preprocessing/result1c.output +6 -0
  148. data/test/data/users_guide/test_preprocessing/result2a.output +10 -0
  149. data/test/data/users_guide/test_preprocessing/result2b.output +10 -0
  150. data/test/data/users_guide/test_preprocessing/result3a.output +2 -0
  151. data/test/data/users_guide/test_preprocessing/result3b.output +2 -0
  152. data/test/data/users_guide/test_preprocessing/views/pp-example1.rbhtml +4 -0
  153. data/test/data/users_guide/{example12.rbhtml → test_preprocessing/views/pp-example2.rbhtml} +4 -4
  154. data/test/data/users_guide/test_preprocessing/views/pp-example3.rbhtml +7 -0
  155. data/test/data/users_guide/test_retrieve/example.rbhtml +10 -0
  156. data/test/data/users_guide/test_retrieve/result1.output +11 -0
  157. data/test/data/users_guide/test_retrieve/result2.output +11 -0
  158. data/test/data/users_guide/test_retrieve/result3.output +11 -0
  159. data/test/data/users_guide/test_retrieve/result4.output +8 -0
  160. data/test/data/users_guide/test_retrieve/result5.output +5 -0
  161. data/test/data/users_guide/test_safe/result.output +6 -0
  162. data/test/data/users_guide/test_safe/safe-test.rb +21 -0
  163. data/test/data/users_guide/test_safehelper/main.rb +16 -0
  164. data/test/data/users_guide/test_safehelper/result.output +8 -0
  165. data/test/data/users_guide/{example3.rbhtml → test_syntax_check/example.rbhtml} +0 -0
  166. data/test/data/users_guide/test_syntax_check/result.output +2 -0
  167. data/test/data/users_guide/test_trace/layout.rbhtml +7 -0
  168. data/test/data/users_guide/test_trace/main.rbhtml +5 -0
  169. data/test/data/users_guide/test_trace/result.output +16 -0
  170. data/test/data/users_guide/test_trace/trace-example.rb +4 -0
  171. data/test/oktest.rb +755 -0
  172. data/test/test_all.rb +24 -14
  173. data/test/test_engine.rb +628 -63
  174. data/test/test_engine.yaml +40 -3
  175. data/test/test_examples.rb +14 -12
  176. data/test/test_faq.rb +17 -12
  177. data/test/test_htmlhelper.rb +104 -33
  178. data/test/test_main.rb +32 -21
  179. data/test/test_main.yaml +2 -2
  180. data/test/test_safe.rb +206 -0
  181. data/test/test_store.rb +220 -0
  182. data/test/test_tcache.rb +94 -0
  183. data/test/test_template.rb +65 -23
  184. data/test/test_template.yaml +7 -7
  185. data/test/test_users_guide.rb +75 -29
  186. data/test/testcase-helper.rb +20 -18
  187. data/test/testunit-assertions.rb +71 -0
  188. metadata +185 -159
  189. data/doc-api/classes/Tenjin.html +0 -141
  190. data/doc-api/classes/Tenjin/ArrayBufferTemplate.html +0 -270
  191. data/doc-api/classes/Tenjin/BaseContext.html +0 -329
  192. data/doc-api/classes/Tenjin/Context.html +0 -126
  193. data/doc-api/classes/Tenjin/ContextHelper.html +0 -461
  194. data/doc-api/classes/Tenjin/Engine.html +0 -616
  195. data/doc-api/classes/Tenjin/ErubisTemplate.html +0 -166
  196. data/doc-api/classes/Tenjin/HtmlHelper.html +0 -359
  197. data/doc-api/classes/Tenjin/Preprocessor.html +0 -242
  198. data/doc-api/classes/Tenjin/Template.html +0 -916
  199. data/doc-api/created.rid +0 -1
  200. data/doc-api/files/README_txt.html +0 -188
  201. data/doc-api/files/lib/tenjin_rb.html +0 -136
  202. data/doc-api/fr_class_index.html +0 -36
  203. data/doc-api/fr_file_index.html +0 -28
  204. data/doc-api/fr_method_index.html +0 -91
  205. data/doc-api/index.html +0 -24
  206. data/doc-api/rdoc-style.css +0 -208
  207. data/doc/examples.html +0 -312
  208. data/doc/faq.html +0 -909
  209. data/examples/preprocessing/select.rbhtml.cache +0 -17
  210. data/test/Rookbook.yaml +0 -14
  211. data/test/assert-text-equal.rb +0 -45
  212. data/test/data/faq/ex10-baselayout.rbhtml +0 -27
  213. data/test/data/faq/ex11-content.rbhtml +0 -9
  214. data/test/data/faq/ex8-m18n.rb +0 -77
  215. data/test/data/users_guide/content6.rbhtml +0 -3
  216. data/test/data/users_guide/content7.rbhtml +0 -5
  217. data/test/data/users_guide/content8.rbhtml +0 -2
  218. data/test/data/users_guide/contextdata.rb +0 -7
  219. data/test/data/users_guide/datafile.rb +0 -5
  220. data/test/data/users_guide/datafile.yaml +0 -10
  221. data/test/data/users_guide/ex.rbhtml +0 -6
  222. data/test/data/users_guide/ex.result +0 -7
  223. data/test/data/users_guide/ex.script +0 -5
  224. data/test/data/users_guide/ex_script.result +0 -7
  225. data/test/data/users_guide/ex_source.result +0 -8
  226. data/test/data/users_guide/example1.rbhtml +0 -12
  227. data/test/data/users_guide/example1.result +0 -17
  228. data/test/data/users_guide/example10.rbhtml +0 -4
  229. data/test/data/users_guide/example10_template_args.result +0 -6
  230. data/test/data/users_guide/example11.rbhtml +0 -5
  231. data/test/data/users_guide/example11_template_args_result +0 -2
  232. data/test/data/users_guide/example12_preprocessed.result +0 -10
  233. data/test/data/users_guide/example12_preprocessed_source.result +0 -10
  234. data/test/data/users_guide/example13.rbhtml +0 -6
  235. data/test/data/users_guide/example13_preprocessed.result +0 -2
  236. data/test/data/users_guide/example13_preprocessed_source.result +0 -2
  237. data/test/data/users_guide/example14.rb +0 -32
  238. data/test/data/users_guide/example14.rbhtml +0 -6
  239. data/test/data/users_guide/example14_tmplclass.result +0 -15
  240. data/test/data/users_guide/example15.rb +0 -10
  241. data/test/data/users_guide/example15_escapefunc.result +0 -14
  242. data/test/data/users_guide/example16.rbhtml +0 -4
  243. data/test/data/users_guide/example16a.rb +0 -10
  244. data/test/data/users_guide/example16a.result +0 -4
  245. data/test/data/users_guide/example16b.rb +0 -13
  246. data/test/data/users_guide/example16b.result +0 -4
  247. data/test/data/users_guide/example16c.rb +0 -12
  248. data/test/data/users_guide/example16c.result +0 -4
  249. data/test/data/users_guide/example16d.rb +0 -27
  250. data/test/data/users_guide/example16d.result +0 -4
  251. data/test/data/users_guide/example1_S.result +0 -14
  252. data/test/data/users_guide/example1_SXNC.result +0 -10
  253. data/test/data/users_guide/example1_source.result +0 -14
  254. data/test/data/users_guide/example2.rbhtml +0 -3
  255. data/test/data/users_guide/example2_sb.result2 +0 -9
  256. data/test/data/users_guide/example3_syntaxcheck.result +0 -2
  257. data/test/data/users_guide/example4.rbhtml +0 -13
  258. data/test/data/users_guide/example4_datafile_rb.result +0 -13
  259. data/test/data/users_guide/example4_yaml.result +0 -13
  260. data/test/data/users_guide/example5.rbhtml +0 -9
  261. data/test/data/users_guide/example5_datastr_rb.result +0 -9
  262. data/test/data/users_guide/example5_datastr_yaml.result +0 -9
  263. data/test/data/users_guide/example6.rbhtml +0 -19
  264. data/test/data/users_guide/example6_layout.result +0 -29
  265. data/test/data/users_guide/example6_nested.result +0 -28
  266. data/test/data/users_guide/example7_layout2.result +0 -13
  267. data/test/data/users_guide/example8_layout3.result +0 -8
  268. data/test/data/users_guide/example9.rbhtml +0 -18
  269. data/test/data/users_guide/example9_capture.result +0 -26
  270. data/test/data/users_guide/footer.html +0 -5
  271. data/test/data/users_guide/footer.rbhtml +0 -4
  272. data/test/data/users_guide/layout6.rbhtml +0 -17
  273. data/test/data/users_guide/layout7.rbhtml +0 -9
  274. data/test/data/users_guide/layout8_xhtml.rbhtml +0 -6
  275. data/test/data/users_guide/layout9.rbhtml +0 -25
  276. data/test/data/users_guide/sidemenu.rbhtml +0 -5
  277. data/test/data/users_guide/user_app.cgi +0 -39
  278. data/test/data/users_guide/user_app.result +0 -30
  279. data/test/data/users_guide/user_create.rbhtml +0 -6
  280. data/test/data/users_guide/user_edit.rbhtml +0 -7
  281. data/test/data/users_guide/user_form.rbhtml +0 -10
  282. data/test/data/users_guide/user_layout.rbhtml +0 -16
@@ -1,24 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
5
-
6
- <!--
7
-
8
- RDoc Documentation
9
-
10
- -->
11
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
12
- <head>
13
- <title>RDoc Documentation</title>
14
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
15
- </head>
16
- <frameset rows="20%, 80%">
17
- <frameset cols="25%,35%,45%">
18
- <frame src="fr_file_index.html" title="Files" name="Files" />
19
- <frame src="fr_class_index.html" name="Classes" />
20
- <frame src="fr_method_index.html" name="Methods" />
21
- </frameset>
22
- <frame src="files/README_txt.html" name="docwin" />
23
- </frameset>
24
- </html>
@@ -1,208 +0,0 @@
1
-
2
- body {
3
- font-family: Verdana,Arial,Helvetica,sans-serif;
4
- font-size: 90%;
5
- margin: 0;
6
- margin-left: 40px;
7
- padding: 0;
8
- background: white;
9
- }
10
-
11
- h1,h2,h3,h4 { margin: 0; color: #efefef; background: transparent; }
12
- h1 { font-size: 150%; }
13
- h2,h3,h4 { margin-top: 1em; }
14
-
15
- a { background: #eef; color: #039; text-decoration: none; }
16
- a:hover { background: #039; color: #eef; }
17
-
18
- /* Override the base stylesheet's Anchor inside a table cell */
19
- td > a {
20
- background: transparent;
21
- color: #039;
22
- text-decoration: none;
23
- }
24
-
25
- /* and inside a section title */
26
- .section-title > a {
27
- background: transparent;
28
- color: #eee;
29
- text-decoration: none;
30
- }
31
-
32
- /* === Structural elements =================================== */
33
-
34
- div#index {
35
- margin: 0;
36
- margin-left: -40px;
37
- padding: 0;
38
- font-size: 90%;
39
- }
40
-
41
-
42
- div#index a {
43
- margin-left: 0.7em;
44
- }
45
-
46
- div#index .section-bar {
47
- margin-left: 0px;
48
- padding-left: 0.7em;
49
- background: #ccc;
50
- font-size: small;
51
- }
52
-
53
-
54
- div#classHeader, div#fileHeader {
55
- width: auto;
56
- color: white;
57
- padding: 0.5em 1.5em 0.5em 1.5em;
58
- margin: 0;
59
- margin-left: -40px;
60
- border-bottom: 3px solid #006;
61
- }
62
-
63
- div#classHeader a, div#fileHeader a {
64
- background: inherit;
65
- color: white;
66
- }
67
-
68
- div#classHeader td, div#fileHeader td {
69
- background: inherit;
70
- color: white;
71
- }
72
-
73
-
74
- div#fileHeader {
75
- background: #057;
76
- }
77
-
78
- div#classHeader {
79
- background: #048;
80
- }
81
-
82
-
83
- .class-name-in-header {
84
- font-size: 180%;
85
- font-weight: bold;
86
- }
87
-
88
-
89
- div#bodyContent {
90
- padding: 0 1.5em 0 1.5em;
91
- }
92
-
93
- div#description {
94
- padding: 0.5em 1.5em;
95
- background: #efefef;
96
- border: 1px dotted #999;
97
- }
98
-
99
- div#description h1,h2,h3,h4,h5,h6 {
100
- color: #125;;
101
- background: transparent;
102
- }
103
-
104
- div#validator-badges {
105
- text-align: center;
106
- }
107
- div#validator-badges img { border: 0; }
108
-
109
- div#copyright {
110
- color: #333;
111
- background: #efefef;
112
- font: 0.75em sans-serif;
113
- margin-top: 5em;
114
- margin-bottom: 0;
115
- padding: 0.5em 2em;
116
- }
117
-
118
-
119
- /* === Classes =================================== */
120
-
121
- table.header-table {
122
- color: white;
123
- font-size: small;
124
- }
125
-
126
- .type-note {
127
- font-size: small;
128
- color: #DEDEDE;
129
- }
130
-
131
- .xxsection-bar {
132
- background: #eee;
133
- color: #333;
134
- padding: 3px;
135
- }
136
-
137
- .section-bar {
138
- color: #333;
139
- border-bottom: 1px solid #999;
140
- margin-left: -20px;
141
- }
142
-
143
-
144
- .section-title {
145
- background: #79a;
146
- color: #eee;
147
- padding: 3px;
148
- margin-top: 2em;
149
- margin-left: -30px;
150
- border: 1px solid #999;
151
- }
152
-
153
- .top-aligned-row { vertical-align: top }
154
- .bottom-aligned-row { vertical-align: bottom }
155
-
156
- /* --- Context section classes ----------------------- */
157
-
158
- .context-row { }
159
- .context-item-name { font-family: monospace; font-weight: bold; color: black; }
160
- .context-item-value { font-size: small; color: #448; }
161
- .context-item-desc { color: #333; padding-left: 2em; }
162
-
163
- /* --- Method classes -------------------------- */
164
- .method-detail {
165
- background: #efefef;
166
- padding: 0;
167
- margin-top: 0.5em;
168
- margin-bottom: 1em;
169
- border: 1px dotted #ccc;
170
- }
171
- .method-heading {
172
- color: black;
173
- background: #ccc;
174
- border-bottom: 1px solid #666;
175
- padding: 0.2em 0.5em 0 0.5em;
176
- }
177
- .method-signature { color: black; background: inherit; }
178
- .method-name { font-weight: bold; }
179
- .method-args { font-style: italic; }
180
- .method-description { padding: 0 0.5em 0 0.5em; }
181
-
182
- /* --- Source code sections -------------------- */
183
-
184
- a.source-toggle { font-size: 90%; }
185
- div.method-source-code {
186
- background: #262626;
187
- color: #ffdead;
188
- margin: 1em;
189
- padding: 0.5em;
190
- border: 1px dashed #999;
191
- overflow: hidden;
192
- }
193
-
194
- div.method-source-code pre { color: #ffdead; overflow: hidden; }
195
-
196
- /* --- Ruby keyword styles --------------------- */
197
-
198
- .standalone-code { background: #221111; color: #ffdead; overflow: hidden; }
199
-
200
- .ruby-constant { color: #7fffd4; background: transparent; }
201
- .ruby-keyword { color: #00ffff; background: transparent; }
202
- .ruby-ivar { color: #eedd82; background: transparent; }
203
- .ruby-operator { color: #00ffee; background: transparent; }
204
- .ruby-identifier { color: #ffdead; background: transparent; }
205
- .ruby-node { color: #ffa07a; background: transparent; }
206
- .ruby-comment { color: #b22222; font-weight: bold; background: transparent; }
207
- .ruby-regexp { color: #ffa07a; background: transparent; }
208
- .ruby-value { color: #7fffd4; background: transparent; }
@@ -1,312 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
- <html>
3
- <head>
4
- <meta http-equiv="Content-Type" content="text/html">
5
- <title>rbTenjin Examples</title>
6
- <meta name="generator" content="kwaser">
7
- <meta http-equiv="Content-Style-Type" content="text/css">
8
- <link rel="stylesheet" href="docstyle.css" type="text/css">
9
- </head>
10
- <body>
11
-
12
- <blockquote>
13
- <div class="mainbody">
14
-
15
- <div align="left"><h1>rbTenjin Examples</h1></div>
16
- <div align="left">
17
- last update: $Date: 2007-10-23 15:29:14 +0900 (Tue, 23 Oct 2007) $<br>
18
- </div>
19
-
20
- <p>Release: 0.6.2
21
- </p>
22
- <p>Table of Contents:
23
- <ul>
24
- <li><a href="#bordered-table">Bordered Table</a>
25
- </li>
26
- <li><a href="#form">Form</a>
27
- </li>
28
- <li><a href="#preprocessing">Preprocessing</a>
29
- </li>
30
- </ul>
31
- </p>
32
- <a name="bordered-table"></a>
33
- <h2 class="section1">Bordered Table</h2>
34
- <a name="table/table.rbhtml"></a>
35
- <div class="program_caption">
36
- Template: 'table.rbhtml'</div>
37
- <pre class="program">&lt;html&gt;
38
- &lt;body&gt;
39
- &lt;h1&gt;<strong>${@title}</strong>&lt;/h1&gt;
40
- &lt;table&gt;
41
- <strong>&lt;?rb i = 0 ?&gt;</strong>
42
- <strong>&lt;?rb for item in @items ?&gt;</strong>
43
- <strong>&lt;?rb i += 1 ?&gt;</strong>
44
- <strong>&lt;?rb color = i % 2 == 0 ? '#FFCCCC' : '#CCCCFF' ?&gt;</strong>
45
- &lt;tr bgcolor="<strong>#{color}</strong>"&gt;
46
- &lt;td&gt;<strong>#{i}</strong>&lt;/td&gt;
47
- &lt;td&gt;<strong>${item}</strong>&lt;/td&gt;
48
- &lt;/tr&gt;
49
- <strong>&lt;?rb end ?&gt;</strong>
50
- &lt;/table&gt;
51
- &lt;/body&gt;
52
- &lt;/html&gt;
53
- </pre>
54
- <a name="table/table_s.result"></a>
55
- <div class="terminal_caption">
56
- Convert into Ruby script:</div>
57
- <pre class="terminal">$ rbtenjin -a convert table.rbhtml
58
- _buf = ''; _buf &lt;&lt; %Q`&lt;html&gt;
59
- &lt;body&gt;
60
- &lt;h1&gt;<strong>#{escape((@title).to_s)}</strong>&lt;/h1&gt;
61
- &lt;table&gt;\n`
62
- <strong>i = 0</strong>
63
- <strong>for item in @items</strong>
64
- <strong>i += 1</strong>
65
- <strong>color = i % 2 == 0 ? '#FFCCCC' : '#CCCCFF'</strong>
66
- _buf &lt;&lt; %Q` &lt;tr bgcolor="<strong>#{color}</strong>"&gt;
67
- &lt;td&gt;<strong>#{i}</strong>&lt;/td&gt;
68
- &lt;td&gt;<strong>#{escape((item).to_s)}</strong>&lt;/td&gt;
69
- &lt;/tr&gt;\n`
70
- <strong>end</strong>
71
- _buf &lt;&lt; %Q` &lt;/table&gt;
72
- &lt;/body&gt;
73
- &lt;/html&gt;\n`
74
- _buf.to_s
75
- </pre>
76
- <a name="table/table.rb"></a>
77
- <div class="program_caption">
78
- Main program: 'table.rb'</div>
79
- <pre class="program">## create Engine object
80
- require 'tenjin'
81
- <strong>engine = Tenjin::Engine.new()</strong>
82
-
83
- ## render template with context data
84
- context = { :title =&gt; 'Bordered Table Example',
85
- :items =&gt; [ '&lt;AAA&gt;', 'B&amp;B', '"CCC"' ] }
86
- <strong>output = engine.render('table.rbhtml', context)</strong>
87
- puts output
88
- </pre>
89
- <a name="table/table.result"></a>
90
- <div class="terminal_caption">
91
- Result:</div>
92
- <pre class="terminal">$ ruby table.rb
93
- &lt;html&gt;
94
- &lt;body&gt;
95
- &lt;h1&gt;Bordered Table Example&lt;/h1&gt;
96
- &lt;table&gt;
97
- &lt;tr bgcolor="<strong>#CCCCFF</strong>"&gt;
98
- &lt;td&gt;<strong>1</strong>&lt;/td&gt;
99
- &lt;td&gt;<strong>&amp;lt;AAA&amp;gt;</strong>&lt;/td&gt;
100
- &lt;/tr&gt;
101
- &lt;tr bgcolor="<strong>#FFCCCC</strong>"&gt;
102
- &lt;td&gt;<strong>2</strong>&lt;/td&gt;
103
- &lt;td&gt;<strong>B&amp;amp;B</strong>&lt;/td&gt;
104
- &lt;/tr&gt;
105
- &lt;tr bgcolor="<strong>#CCCCFF</strong>"&gt;
106
- &lt;td&gt;<strong>3</strong>&lt;/td&gt;
107
- &lt;td&gt;<strong>&amp;quot;CCC&amp;quot;</strong>&lt;/td&gt;
108
- &lt;/tr&gt;
109
- &lt;/table&gt;
110
- &lt;/body&gt;
111
- &lt;/html&gt;
112
- </pre>
113
- <br>
114
-
115
-
116
- <a name="form"></a>
117
- <h2 class="section1">Form</h2>
118
- <a name="form/form.rbhtml"></a>
119
- <div class="program_caption">
120
- Template: 'form.rbhtml':</div>
121
- <pre class="program"><strong>&lt;?rb #@ARGS action, params, label ?&gt;</strong>
122
- &lt;form action="<strong>${@action}</strong>" method="post"&gt;
123
- &lt;p&gt;
124
- &lt;label&gt;Name:&lt;/label&gt;
125
- &lt;input type="text" name="name" value="<strong>${@params[:name]}</strong>" /&gt;
126
- &lt;/p&gt;
127
- &lt;p&gt;
128
- &lt;label&gt;Gender:&lt;/label&gt;
129
- <strong>&lt;?rb gender = @params[:gender] ?&gt;</strong>
130
- &lt;input type="radio" name="gender" value="M" <strong>#{checked(gender=='M')}</strong> /&gt;Man
131
- &lt;input type="radio" name="gender" value="W" <strong>#{checked(gender=='W')}</strong> /&gt;Woman
132
- &lt;/p&gt;
133
- &lt;input type="submit" value="<strong>${@label}</strong>" /&gt;
134
- &lt;/form&gt;
135
- </pre>
136
- <a name="form/create.rbhtml"></a>
137
- <div class="program_caption">
138
- Template: 'create.rbhtml':</div>
139
- <pre class="program">&lt;?rb @title = 'Create user' ?&gt;
140
- &lt;?rb @label = 'Create' ?&gt;
141
- &lt;?rb @action = 'action.cgi' ?&gt;
142
- <strong>&lt;?rb import(:form) ?&gt;</strong>
143
- </pre>
144
- <a name="form/update.rbhtml"></a>
145
- <div class="program_caption">
146
- Template: 'update.rbhtml':</div>
147
- <pre class="program">&lt;?rb @title = 'Update user' ?&gt;
148
- &lt;?rb @label = 'Update' ?&gt;
149
- &lt;?rb @action = 'update.cgi' ?&gt;
150
- <strong>&lt;?rb import(:form) ?&gt;</strong>
151
- </pre>
152
- <a name="form/layout.rbhtml"></a>
153
- <div class="program_caption">
154
- Layout template: 'layout.rbhtml'</div>
155
- <pre class="program">&lt;html&gt;
156
- &lt;body&gt;
157
- &lt;h1&gt;${@title}&lt;/h1&gt;
158
- &lt;div class="main-content"&gt;
159
- <strong>#{@_content}</strong>
160
- &lt;/div&gt;
161
- &lt;/body&gt;
162
- &lt;/html&gt;
163
- </pre>
164
- <a name="form/main.rb"></a>
165
- <div class="program_caption">
166
- Main program: 'main.rb':</div>
167
- <pre class="program">## create Engine object
168
- require 'tenjin'
169
- <strong>engine = Tenjin::Engine.new(:postfix=&gt;'.rbhtml', :layout=&gt;'layout.rbhtml')</strong>
170
-
171
- ## render template with context data
172
- params = { :name=&gt;'Foo', :gender=&gt;'M' }
173
- context = { :params=&gt;params }
174
- <strong>output = engine.render(:update, context)</strong> # :update == 'update'+postfix
175
- puts output
176
- </pre>
177
- <a name="form/main.result"></a>
178
- <div class="terminal_caption">
179
- Result:</div>
180
- <pre class="terminal">$ ruby main.rb
181
- &lt;html&gt;
182
- &lt;body&gt;
183
- &lt;h1&gt;<strong>Update user</strong>&lt;/h1&gt;
184
- &lt;div class="main-content"&gt;
185
- &lt;form action="<strong>update.cgi</strong>" method="post"&gt;
186
- &lt;p&gt;
187
- &lt;label&gt;Name:&lt;/label&gt;
188
- &lt;input type="text" name="name" value="<strong>Foo</strong>" /&gt;
189
- &lt;/p&gt;
190
- &lt;p&gt;
191
- &lt;label&gt;Gender:&lt;/label&gt;
192
- &lt;input type="radio" name="gender" value="M" <strong> checked="checked"</strong> /&gt;Man
193
- &lt;input type="radio" name="gender" value="W" /&gt;Woman
194
- &lt;/p&gt;
195
- &lt;input type="submit" value="<strong>Update</strong>" /&gt;
196
- &lt;/form&gt;
197
-
198
- &lt;/div&gt;
199
- &lt;/body&gt;
200
- &lt;/html&gt;
201
- </pre>
202
- <br>
203
-
204
-
205
- <a name="preprocessing"></a>
206
- <h2 class="section1">Preprocessing</h2>
207
- <a name="preprocessing/helper.rb"></a>
208
- <div class="program_caption">
209
- Library: 'helper.rb'</div>
210
- <pre class="program">LANGUAGES = [
211
- ['en', 'Engilish'],
212
- ['fr', 'French'],
213
- ['de', 'German'],
214
- ['es', 'Spanish'],
215
- ['ch', 'Chinese'],
216
- ['ja', 'Japanese'],
217
- ]
218
-
219
- def link_to(label, options={})
220
- action, id = options[:action], options[:id]
221
- url = '/app'
222
- url &lt;&lt; '/' &lt;&lt; action if action &amp;&amp; !action.empty?
223
- url &lt;&lt; '/' &lt;&lt; id if id
224
- return "&lt;a href=\"#{CGI::escape(url).gsub(/%2F/i, '/')}\"&gt;#{label}&lt;/a&gt;"
225
- end
226
- </pre>
227
- <a name="preprocessing/select.rbhtml"></a>
228
- <div class="program_caption">
229
- Template: 'select.rbhtml'</div>
230
- <pre class="program">&lt;?RB require 'helper' ?&gt;
231
- &lt;form&gt;
232
- &lt;label&gt;Select your language:&lt;/label&gt;
233
- &lt;select name="lang"&gt;
234
- &lt;?rb table = { @params[:lang] =&gt; ' selected="selected"' } ?&gt;
235
- <strong>&lt;?RB for val, name in LANGUAGES ?&gt;</strong>
236
- &lt;option value="${{val}}" #{table[#{{val.inspect}}]}&gt;${{name}}&lt;/option&gt;
237
- <strong>&lt;?RB end ?&gt;</strong>
238
- &lt;/select&gt;
239
- &lt;input type="submit" value="OK" /&gt;
240
- &lt;/form&gt;
241
- &lt;p&gt;
242
- <strong>#{{</strong>link_to('Back', :action=&gt;'index')<strong>}}</strong> |
243
- <strong>#{{</strong>link_to('Show '+<strong>_P('@params[:name]')</strong>, :action=&gt;'show', :id=&gt;<strong>_p('@params[:id]')</strong>)<strong>}}</strong>
244
- &lt;/p&gt;
245
- </pre>
246
- <a name="preprocessing/select_P.result"></a>
247
- <div class="terminal_caption">
248
- Preprocessed code:</div>
249
- <pre class="terminal">$ rbtenjin -a preprocess select.rbhtml
250
- &lt;form&gt;
251
- &lt;label&gt;Select your language:&lt;/label&gt;
252
- &lt;select name="lang"&gt;
253
- &lt;?rb table = { @params[:lang] =&gt; ' selected="selected"' } ?&gt;
254
- &lt;option value="en" #{table["en"]}&gt;Engilish&lt;/option&gt;
255
- &lt;option value="fr" #{table["fr"]}&gt;French&lt;/option&gt;
256
- &lt;option value="de" #{table["de"]}&gt;German&lt;/option&gt;
257
- &lt;option value="es" #{table["es"]}&gt;Spanish&lt;/option&gt;
258
- &lt;option value="ch" #{table["ch"]}&gt;Chinese&lt;/option&gt;
259
- &lt;option value="ja" #{table["ja"]}&gt;Japanese&lt;/option&gt;
260
- &lt;/select&gt;
261
- &lt;input type="submit" value="OK" /&gt;
262
- &lt;/form&gt;
263
- &lt;p&gt;
264
- &lt;a href="/app/index"&gt;Back&lt;/a&gt; |
265
- &lt;a href="/app/show/<strong>#{@params[:id]}</strong>"&gt;Show <strong>${@params[:name]}</strong>&lt;/a&gt;
266
- &lt;/p&gt;
267
- </pre>
268
- <a name="preprocessing/main.rb"></a>
269
- <div class="program_caption">
270
- Main program: 'main.rb'</div>
271
- <pre class="program">require 'helper'
272
-
273
- ## create engine
274
- require 'tenjin'
275
- engine = Tenjin::Engine.new(:postfix=&gt;'.rbhtml', <strong>:preprocess=&gt;true</strong>)
276
-
277
- ## render template with context data
278
- params = { :id=&gt;1234, :name=&gt;'Foo', :lang=&gt;'ch' }
279
- context = { :params =&gt; params }
280
- output = engine.render(:select, context)
281
- puts output
282
- </pre>
283
- <a name="preprocessing/main.result"></a>
284
- <div class="terminal_caption">
285
- Result:</div>
286
- <pre class="terminal">$ ruby main.rb
287
- &lt;form&gt;
288
- &lt;label&gt;Select your language:&lt;/label&gt;
289
- &lt;select name="lang"&gt;
290
- &lt;option value="en" &gt;Engilish&lt;/option&gt;
291
- &lt;option value="fr" &gt;French&lt;/option&gt;
292
- &lt;option value="de" &gt;German&lt;/option&gt;
293
- &lt;option value="es" &gt;Spanish&lt;/option&gt;
294
- &lt;option value="ch" selected="selected"&gt;Chinese&lt;/option&gt;
295
- &lt;option value="ja" &gt;Japanese&lt;/option&gt;
296
- &lt;/select&gt;
297
- &lt;input type="submit" value="OK" /&gt;
298
- &lt;/form&gt;
299
- &lt;p&gt;
300
- &lt;a href="/app/index"&gt;Back&lt;/a&gt; |
301
- &lt;a href="/app/show/1234"&gt;Show Foo&lt;/a&gt;
302
- &lt;/p&gt;
303
- </pre>
304
- <br>
305
-
306
-
307
-
308
- </div>
309
- </blockquote>
310
-
311
- </body>
312
- </html>