ghazel-erubis 2.6.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (298) hide show
  1. data/CHANGES.txt +744 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.txt +102 -0
  4. data/benchmark/Makefile +6 -0
  5. data/benchmark/bench.rb +313 -0
  6. data/benchmark/bench_context.yaml +141 -0
  7. data/benchmark/templates/_footer.html +4 -0
  8. data/benchmark/templates/_header.html +52 -0
  9. data/benchmark/templates/bench_erb.rhtml +29 -0
  10. data/benchmark/templates/bench_erubis.rhtml +29 -0
  11. data/benchmark/templates/bench_eruby.rhtml +29 -0
  12. data/bin/erubis +10 -0
  13. data/contrib/erubis +3330 -0
  14. data/contrib/erubis-run.rb +132 -0
  15. data/contrib/inline-require +179 -0
  16. data/doc/docstyle.css +188 -0
  17. data/doc/users-guide.html +3285 -0
  18. data/doc-api/classes/ActionView/TemplateHandlers/ErubisHandler.html +209 -0
  19. data/doc-api/classes/ActionView.html +105 -0
  20. data/doc-api/classes/ERB.html +101 -0
  21. data/doc-api/classes/Erubis/ArrayBufferEnhancer.html +175 -0
  22. data/doc-api/classes/Erubis/ArrayBufferEruby.html +120 -0
  23. data/doc-api/classes/Erubis/ArrayEnhancer.html +174 -0
  24. data/doc-api/classes/Erubis/ArrayEruby.html +120 -0
  25. data/doc-api/classes/Erubis/Basic/Converter.html +327 -0
  26. data/doc-api/classes/Erubis/Basic/Engine.html +130 -0
  27. data/doc-api/classes/Erubis/Basic.html +112 -0
  28. data/doc-api/classes/Erubis/BiPatternEnhancer.html +215 -0
  29. data/doc-api/classes/Erubis/BiPatternEruby.html +120 -0
  30. data/doc-api/classes/Erubis/CGenerator.html +386 -0
  31. data/doc-api/classes/Erubis/CommandOptionError.html +113 -0
  32. data/doc-api/classes/Erubis/Context.html +344 -0
  33. data/doc-api/classes/Erubis/Converter.html +283 -0
  34. data/doc-api/classes/Erubis/DeleteIndentEnhancer.html +150 -0
  35. data/doc-api/classes/Erubis/DeleteIndentEruby.html +120 -0
  36. data/doc-api/classes/Erubis/Ec.html +126 -0
  37. data/doc-api/classes/Erubis/Ejava.html +126 -0
  38. data/doc-api/classes/Erubis/Ejavascript.html +126 -0
  39. data/doc-api/classes/Erubis/Engine.html +305 -0
  40. data/doc-api/classes/Erubis/Eperl.html +126 -0
  41. data/doc-api/classes/Erubis/Ephp.html +126 -0
  42. data/doc-api/classes/Erubis/ErboutEnhancer.html +175 -0
  43. data/doc-api/classes/Erubis/ErboutEruby.html +120 -0
  44. data/doc-api/classes/Erubis/ErubisError.html +117 -0
  45. data/doc-api/classes/Erubis/Eruby.html +132 -0
  46. data/doc-api/classes/Erubis/EscapeEnhancer.html +165 -0
  47. data/doc-api/classes/Erubis/EscapedEc.html +120 -0
  48. data/doc-api/classes/Erubis/EscapedEjava.html +120 -0
  49. data/doc-api/classes/Erubis/EscapedEjavascript.html +120 -0
  50. data/doc-api/classes/Erubis/EscapedEperl.html +120 -0
  51. data/doc-api/classes/Erubis/EscapedEphp.html +120 -0
  52. data/doc-api/classes/Erubis/EscapedEruby.html +127 -0
  53. data/doc-api/classes/Erubis/EscapedEscheme.html +120 -0
  54. data/doc-api/classes/Erubis/Escheme.html +126 -0
  55. data/doc-api/classes/Erubis/Evaluator.html +212 -0
  56. data/doc-api/classes/Erubis/FastEruby.html +131 -0
  57. data/doc-api/classes/Erubis/Generator.html +416 -0
  58. data/doc-api/classes/Erubis/HeaderFooterEnhancer.html +267 -0
  59. data/doc-api/classes/Erubis/HeaderFooterEruby.html +120 -0
  60. data/doc-api/classes/Erubis/Helpers/RailsFormHelper.html +787 -0
  61. data/doc-api/classes/Erubis/Helpers/RailsHelper/TemplateConverter.html +213 -0
  62. data/doc-api/classes/Erubis/Helpers/RailsHelper.html +349 -0
  63. data/doc-api/classes/Erubis/Helpers.html +116 -0
  64. data/doc-api/classes/Erubis/InterpolationEnhancer.html +306 -0
  65. data/doc-api/classes/Erubis/InterpolationEruby.html +120 -0
  66. data/doc-api/classes/Erubis/JavaGenerator.html +359 -0
  67. data/doc-api/classes/Erubis/JavascriptGenerator.html +386 -0
  68. data/doc-api/classes/Erubis/Main.html +341 -0
  69. data/doc-api/classes/Erubis/NoCodeEnhancer.html +249 -0
  70. data/doc-api/classes/Erubis/NoCodeEruby.html +120 -0
  71. data/doc-api/classes/Erubis/NoTextEnhancer.html +159 -0
  72. data/doc-api/classes/Erubis/NoTextEruby.html +120 -0
  73. data/doc-api/classes/Erubis/NotSupportedError.html +119 -0
  74. data/doc-api/classes/Erubis/OptimizedEruby.html +163 -0
  75. data/doc-api/classes/Erubis/OptimizedGenerator.html +439 -0
  76. data/doc-api/classes/Erubis/OptimizedXmlEruby.html +163 -0
  77. data/doc-api/classes/Erubis/PI/Converter.html +266 -0
  78. data/doc-api/classes/Erubis/PI/Ec.html +166 -0
  79. data/doc-api/classes/Erubis/PI/Ejava.html +166 -0
  80. data/doc-api/classes/Erubis/PI/Ejavascript.html +166 -0
  81. data/doc-api/classes/Erubis/PI/Engine.html +122 -0
  82. data/doc-api/classes/Erubis/PI/Eperl.html +166 -0
  83. data/doc-api/classes/Erubis/PI/Ephp.html +166 -0
  84. data/doc-api/classes/Erubis/PI/Eruby.html +155 -0
  85. data/doc-api/classes/Erubis/PI/Escheme.html +166 -0
  86. data/doc-api/classes/Erubis/PI/TinyEruby.html +293 -0
  87. data/doc-api/classes/Erubis/PI.html +124 -0
  88. data/doc-api/classes/Erubis/PercentLineEnhancer.html +179 -0
  89. data/doc-api/classes/Erubis/PercentLineEruby.html +120 -0
  90. data/doc-api/classes/Erubis/PerlGenerator.html +344 -0
  91. data/doc-api/classes/Erubis/PhpGenerator.html +350 -0
  92. data/doc-api/classes/Erubis/PreprocessingEruby.html +183 -0
  93. data/doc-api/classes/Erubis/PreprocessingHelper.html +212 -0
  94. data/doc-api/classes/Erubis/PrintEnabledEnhancer.html +212 -0
  95. data/doc-api/classes/Erubis/PrintEnabledEruby.html +120 -0
  96. data/doc-api/classes/Erubis/PrintOutEnhancer.html +244 -0
  97. data/doc-api/classes/Erubis/PrintOutEruby.html +120 -0
  98. data/doc-api/classes/Erubis/PrintOutSimplifiedEruby.html +121 -0
  99. data/doc-api/classes/Erubis/RubyEvaluator.html +227 -0
  100. data/doc-api/classes/Erubis/RubyGenerator.html +327 -0
  101. data/doc-api/classes/Erubis/SchemeGenerator.html +382 -0
  102. data/doc-api/classes/Erubis/SimplifiedEruby.html +120 -0
  103. data/doc-api/classes/Erubis/SimplifyEnhancer.html +191 -0
  104. data/doc-api/classes/Erubis/StdoutEnhancer.html +173 -0
  105. data/doc-api/classes/Erubis/StdoutEruby.html +120 -0
  106. data/doc-api/classes/Erubis/StdoutSimplifiedEruby.html +121 -0
  107. data/doc-api/classes/Erubis/StringBufferEnhancer.html +174 -0
  108. data/doc-api/classes/Erubis/StringBufferEruby.html +120 -0
  109. data/doc-api/classes/Erubis/StringIOEruby.html +120 -0
  110. data/doc-api/classes/Erubis/TinyEruby.html +298 -0
  111. data/doc-api/classes/Erubis/XmlEruby.html +130 -0
  112. data/doc-api/classes/Erubis/XmlHelper.html +255 -0
  113. data/doc-api/classes/Erubis.html +353 -0
  114. data/doc-api/created.rid +1 -0
  115. data/doc-api/files/README_txt.html +247 -0
  116. data/doc-api/files/erubis/context_rb.html +107 -0
  117. data/doc-api/files/erubis/converter_rb.html +114 -0
  118. data/doc-api/files/erubis/engine/ec_rb.html +115 -0
  119. data/doc-api/files/erubis/engine/ejava_rb.html +115 -0
  120. data/doc-api/files/erubis/engine/ejavascript_rb.html +115 -0
  121. data/doc-api/files/erubis/engine/enhanced_rb.html +115 -0
  122. data/doc-api/files/erubis/engine/eperl_rb.html +115 -0
  123. data/doc-api/files/erubis/engine/ephp_rb.html +115 -0
  124. data/doc-api/files/erubis/engine/eruby_rb.html +115 -0
  125. data/doc-api/files/erubis/engine/escheme_rb.html +115 -0
  126. data/doc-api/files/erubis/engine/optimized_rb.html +114 -0
  127. data/doc-api/files/erubis/engine_rb.html +117 -0
  128. data/doc-api/files/erubis/enhancer_rb.html +107 -0
  129. data/doc-api/files/erubis/error_rb.html +107 -0
  130. data/doc-api/files/erubis/evaluator_rb.html +115 -0
  131. data/doc-api/files/erubis/generator_rb.html +114 -0
  132. data/doc-api/files/erubis/helper_rb.html +107 -0
  133. data/doc-api/files/erubis/helpers/rails_form_helper_rb.html +107 -0
  134. data/doc-api/files/erubis/helpers/rails_helper_rb.html +116 -0
  135. data/doc-api/files/erubis/local-setting_rb.html +107 -0
  136. data/doc-api/files/erubis/main_rb.html +127 -0
  137. data/doc-api/files/erubis/preprocessing_rb.html +114 -0
  138. data/doc-api/files/erubis/tiny_rb.html +107 -0
  139. data/doc-api/files/erubis_rb.html +118 -0
  140. data/doc-api/fr_class_index.html +122 -0
  141. data/doc-api/fr_file_index.html +51 -0
  142. data/doc-api/fr_method_index.html +251 -0
  143. data/doc-api/index.html +24 -0
  144. data/doc-api/rdoc-style.css +208 -0
  145. data/examples/basic/Makefile +53 -0
  146. data/examples/basic/example.ec +42 -0
  147. data/examples/basic/example.ejava +45 -0
  148. data/examples/basic/example.ejs +16 -0
  149. data/examples/basic/example.eperl +16 -0
  150. data/examples/basic/example.ephp +17 -0
  151. data/examples/basic/example.eruby +15 -0
  152. data/examples/basic/example.escheme +26 -0
  153. data/examples/pi/Makefile +54 -0
  154. data/examples/pi/example.ec +42 -0
  155. data/examples/pi/example.ejava +45 -0
  156. data/examples/pi/example.ejs +16 -0
  157. data/examples/pi/example.eperl +16 -0
  158. data/examples/pi/example.ephp +17 -0
  159. data/examples/pi/example.eruby +15 -0
  160. data/examples/pi/example.escheme +26 -0
  161. data/lib/erubis/context.rb +83 -0
  162. data/lib/erubis/converter.rb +357 -0
  163. data/lib/erubis/engine/ec.rb +117 -0
  164. data/lib/erubis/engine/ejava.rb +110 -0
  165. data/lib/erubis/engine/ejavascript.rb +119 -0
  166. data/lib/erubis/engine/enhanced.rb +121 -0
  167. data/lib/erubis/engine/eperl.rb +95 -0
  168. data/lib/erubis/engine/ephp.rb +99 -0
  169. data/lib/erubis/engine/eruby.rb +124 -0
  170. data/lib/erubis/engine/escheme.rb +114 -0
  171. data/lib/erubis/engine/optimized.rb +127 -0
  172. data/lib/erubis/engine.rb +120 -0
  173. data/lib/erubis/enhancer.rb +680 -0
  174. data/lib/erubis/error.rb +23 -0
  175. data/lib/erubis/evaluator.rb +88 -0
  176. data/lib/erubis/generator.rb +85 -0
  177. data/lib/erubis/helper.rb +47 -0
  178. data/lib/erubis/helpers/rails_form_helper.rb +197 -0
  179. data/lib/erubis/helpers/rails_helper.rb +353 -0
  180. data/lib/erubis/local-setting.rb +9 -0
  181. data/lib/erubis/main.rb +489 -0
  182. data/lib/erubis/preprocessing.rb +58 -0
  183. data/lib/erubis/tiny.rb +144 -0
  184. data/lib/erubis.rb +72 -0
  185. data/setup.rb +1331 -0
  186. data/test/assert-text-equal.rb +44 -0
  187. data/test/data/users-guide/Example.ejava +55 -0
  188. data/test/data/users-guide/array_example.result +9 -0
  189. data/test/data/users-guide/arraybuffer_example.result +9 -0
  190. data/test/data/users-guide/bipattern-example.rhtml +4 -0
  191. data/test/data/users-guide/bipattern_example.result +6 -0
  192. data/test/data/users-guide/context.rb +6 -0
  193. data/test/data/users-guide/context.yaml +8 -0
  194. data/test/data/users-guide/def_method.rb +14 -0
  195. data/test/data/users-guide/def_method.result +3 -0
  196. data/test/data/users-guide/escape_example.result +9 -0
  197. data/test/data/users-guide/example.ec +27 -0
  198. data/test/data/users-guide/example.ejs +20 -0
  199. data/test/data/users-guide/example.eperl +18 -0
  200. data/test/data/users-guide/example.ephp +18 -0
  201. data/test/data/users-guide/example.eruby +6 -0
  202. data/test/data/users-guide/example.escheme +28 -0
  203. data/test/data/users-guide/example1.eruby +6 -0
  204. data/test/data/users-guide/example1.rb +17 -0
  205. data/test/data/users-guide/example1.result +16 -0
  206. data/test/data/users-guide/example10.rb +4 -0
  207. data/test/data/users-guide/example10.result +17 -0
  208. data/test/data/users-guide/example10.xhtml +14 -0
  209. data/test/data/users-guide/example10_x.result +17 -0
  210. data/test/data/users-guide/example11.php +20 -0
  211. data/test/data/users-guide/example11.result +23 -0
  212. data/test/data/users-guide/example11.rhtml +21 -0
  213. data/test/data/users-guide/example11_C.result +10 -0
  214. data/test/data/users-guide/example11_N.result +16 -0
  215. data/test/data/users-guide/example11_U.result +16 -0
  216. data/test/data/users-guide/example11_php.result +15 -0
  217. data/test/data/users-guide/example1_x.result +9 -0
  218. data/test/data/users-guide/example2.eruby +7 -0
  219. data/test/data/users-guide/example2.rb +10 -0
  220. data/test/data/users-guide/example2.result +27 -0
  221. data/test/data/users-guide/example2_trim.result +10 -0
  222. data/test/data/users-guide/example2_x.result +10 -0
  223. data/test/data/users-guide/example3.eruby +6 -0
  224. data/test/data/users-guide/example3.rb +10 -0
  225. data/test/data/users-guide/example31.result +22 -0
  226. data/test/data/users-guide/example32.result +4 -0
  227. data/test/data/users-guide/example3_e.result +8 -0
  228. data/test/data/users-guide/example4.eruby +3 -0
  229. data/test/data/users-guide/example4.rb +11 -0
  230. data/test/data/users-guide/example4.result +10 -0
  231. data/test/data/users-guide/example4_x.result +5 -0
  232. data/test/data/users-guide/example5.eruby +6 -0
  233. data/test/data/users-guide/example5.rb +16 -0
  234. data/test/data/users-guide/example5.result +7 -0
  235. data/test/data/users-guide/example6.rb +12 -0
  236. data/test/data/users-guide/example6.result +7 -0
  237. data/test/data/users-guide/example7.eruby +8 -0
  238. data/test/data/users-guide/example71.result +13 -0
  239. data/test/data/users-guide/example72.result +13 -0
  240. data/test/data/users-guide/example8.eruby +6 -0
  241. data/test/data/users-guide/example8_ruby.result +7 -0
  242. data/test/data/users-guide/example8_yaml.result +7 -0
  243. data/test/data/users-guide/example9.eruby +3 -0
  244. data/test/data/users-guide/example9.rb +8 -0
  245. data/test/data/users-guide/example9.result +9 -0
  246. data/test/data/users-guide/example91.result +5 -0
  247. data/test/data/users-guide/example92.result +4 -0
  248. data/test/data/users-guide/example_c.result +29 -0
  249. data/test/data/users-guide/example_java.result +56 -0
  250. data/test/data/users-guide/example_js.result +22 -0
  251. data/test/data/users-guide/example_perl.result +20 -0
  252. data/test/data/users-guide/example_php.result +19 -0
  253. data/test/data/users-guide/example_scheme.result +30 -0
  254. data/test/data/users-guide/example_scheme_display.result +29 -0
  255. data/test/data/users-guide/fasteruby.rb +11 -0
  256. data/test/data/users-guide/fasteruby.result +38 -0
  257. data/test/data/users-guide/fasteruby.rhtml +15 -0
  258. data/test/data/users-guide/headerfooter-example.eruby +9 -0
  259. data/test/data/users-guide/headerfooter-example2.rb +8 -0
  260. data/test/data/users-guide/headerfooter-example2.rhtml +10 -0
  261. data/test/data/users-guide/headerfooter_example.result +11 -0
  262. data/test/data/users-guide/headerfooter_example2.result +13 -0
  263. data/test/data/users-guide/interpolation_example.result +9 -0
  264. data/test/data/users-guide/main_program1.rb +8 -0
  265. data/test/data/users-guide/main_program1.result +6 -0
  266. data/test/data/users-guide/main_program2.rb +8 -0
  267. data/test/data/users-guide/main_program2.result +6 -0
  268. data/test/data/users-guide/nocode-example.eruby +14 -0
  269. data/test/data/users-guide/nocode-php.result +20 -0
  270. data/test/data/users-guide/nocode_example.result +15 -0
  271. data/test/data/users-guide/normal-eruby-test.eruby +9 -0
  272. data/test/data/users-guide/normal_eruby_test.result +11 -0
  273. data/test/data/users-guide/notext-example.eruby +14 -0
  274. data/test/data/users-guide/notext-example.php +19 -0
  275. data/test/data/users-guide/notext-php.result +20 -0
  276. data/test/data/users-guide/notext_example.result +16 -0
  277. data/test/data/users-guide/percentline-example.rhtml +4 -0
  278. data/test/data/users-guide/percentline_example.result +7 -0
  279. data/test/data/users-guide/printenable_example.result +4 -0
  280. data/test/data/users-guide/printenabled-example.eruby +3 -0
  281. data/test/data/users-guide/printenabled-example.rb +8 -0
  282. data/test/data/users-guide/printstatement_example.result +8 -0
  283. data/test/data/users-guide/simplify_example.result +9 -0
  284. data/test/data/users-guide/stderr.log +3 -0
  285. data/test/data/users-guide/stdout_exmple.result +9 -0
  286. data/test/data/users-guide/stringbuffer_example.result +9 -0
  287. data/test/data/users-guide/tail_260.result +4 -0
  288. data/test/data/users-guide/tailnewline.rhtml +3 -0
  289. data/test/data/users-guide/template1.rhtml +4 -0
  290. data/test/data/users-guide/template2.rhtml +4 -0
  291. data/test/test-engines.rb +369 -0
  292. data/test/test-enhancers.rb +570 -0
  293. data/test/test-erubis.rb +883 -0
  294. data/test/test-main.rb +721 -0
  295. data/test/test-users-guide.rb +57 -0
  296. data/test/test.rb +29 -0
  297. data/test/testutil.rb +96 -0
  298. metadata +360 -0
data/CHANGES.txt ADDED
@@ -0,0 +1,744 @@
1
+ # -*- coding: utf-8 -*-
2
+ # $Release: 2.6.5 $
3
+ # copyright(c) 2006-2009 kuwata-lab.com all rights reserved.
4
+
5
+
6
+ - release: 2.6.5
7
+ date: 2009-07-20
8
+ bugfixes:
9
+
10
+ - |
11
+ Fixed bug around '-z' option.
12
+
13
+
14
+ - release: 2.6.4
15
+ date: 2009-02-18
16
+ enhancemens:
17
+
18
+ - |
19
+ Rails 2.2 and 2.3 support.
20
+
21
+
22
+
23
+ - release: 2.6.3
24
+ date: 2009-02-07
25
+ bugfixes:
26
+
27
+ - Enhancer name was not displayed in Ruby 1.9.1 when it was missing.
28
+
29
+ - Command option argument name was not displayed correctly as a part of error message.
30
+
31
+ - MethoNotFound error was raised when invalid option was specified.
32
+
33
+
34
+ - release: 2.6.2
35
+ date: 2008-06-12
36
+ enhancements:
37
+
38
+ - |
39
+ Ruby 1.9 support.
40
+
41
+ bugfixes:
42
+
43
+ - |
44
+ Fixed installation problem on Windows (Thanks to Tim Morgan and Allen).
45
+
46
+
47
+ - release: 2.6.1
48
+ date: 2008-06-06
49
+ enhancements:
50
+
51
+ - |
52
+ Rails 2.1 support. (special thanks José Valim)
53
+
54
+
55
+
56
+ - release: 2.6.0
57
+ date: 2008-05-05
58
+ enhancements:
59
+
60
+ - |
61
+ Improved support of Ruby on Rails 2.0.2.
62
+ New class ActionView::TemplateHandlers::Erubis is defined and
63
+ registered as default handler of *.html.erb and *.rhtml.
64
+
65
+ - |
66
+ '<%% %>' and '<%%= %>' are converted into '<% %>' and '<%= %>' respectively.
67
+ This is for compatibility with ERB.
68
+
69
+ ex1.rhtml:
70
+ <ul>
71
+ <%% for item in @list %>
72
+ <li><%%= item %></li>
73
+ <%% end %>
74
+ </ul>
75
+
76
+ result:
77
+ $ erubis ex1.rhtml
78
+ <ul>
79
+ <% for item in @list %>
80
+ <li><%= item %></li>
81
+ <% end %>
82
+ </ul>
83
+
84
+ - |
85
+ '<%= -%>' removes tail spaces and newlines.
86
+ This is for compatibiliy with ERB when trim mode is '-'.
87
+ '<%= =%>' also removes tail spaces and newlines, and this is
88
+ Erubis-original enhancement (cooler than '<%= -%>', isn't it?).
89
+
90
+ ex2.rhtml:
91
+ <div>
92
+ <%= @var -%> # or <%= @var =%>
93
+ </div>
94
+
95
+ result (version 2.6.0):
96
+ $ erubis -c '{var: "AAA\n"}' ex2.rhtml
97
+ <div>
98
+ AAA
99
+ </div>
100
+
101
+ result (version 2.5.0):
102
+ $ erubis -c '{var: "AAA\n"}' ex2.rhtml
103
+ <div>
104
+ AAA
105
+
106
+ </div>
107
+
108
+ - |
109
+ Erubis::Eruby.load_file() now allows you to change cache filename.
110
+
111
+ ex.
112
+ eruby = Erubis::Eruby.load_file("ex3.rhtml",
113
+ :cachename=>'ex3.rhtml.cache')
114
+
115
+
116
+ - release: 2.5.0
117
+ date: 2008-01-30
118
+ enhancements:
119
+
120
+ - |
121
+ Ruby on Rails 2.0 support.
122
+ If you are using preprocessing, notice that _?('foo.id') will be NG
123
+ because it contains period ('.') character.
124
+
125
+ --------------------
126
+ <!-- NG in Rails 2.0 -->
127
+ [%= link_to 'Edit', edit_user_path(_?('@user.id')) %]
128
+ [%= link_to 'Show', @user %]
129
+ [%= link_to 'Delete', @user, :confirm=>'OK?', :method=>:delete %]
130
+
131
+ <!-- OK in Rails 2.0 -->
132
+ <%= user_id = @user.id %>
133
+ [%= link_to 'Edit', edit_user_path(_?('user_id')) %]
134
+ [%= link_to 'Show', :action=>'show', :id=>_?('user_id') %]
135
+ [%= link_to 'Delete', {:action=>'destroy', :id=>_?('user_id')},
136
+ {:confirm=>'OK?', :method=>:delete} %]
137
+ --------------------
138
+
139
+ - |
140
+ (experimental)
141
+ Rails form helper methods for preprocessing are added.
142
+ These helper methos are available with preprocessing.
143
+
144
+ ex. _form.rhtml
145
+ --------------------
146
+ Name: <%= text_field :user, :name %>
147
+ Name: [%= pp_text_field :user, :name %]
148
+ --------------------
149
+
150
+ preprocessed:
151
+ --------------------
152
+ Name: <%= text_field :user, :name %>
153
+ Name: <input id="stock_name" name="stock[name]" size="30" type="text" value="<%=h @stock.name%>" />
154
+ --------------------
155
+
156
+ Ruby code:
157
+ --------------------
158
+ _buf << '
159
+ Name: '; _buf << ( text_field :stock, :name ).to_s; _buf << '
160
+ Name: <input id="stock_name" name="stock[name]" size="30" type="text" value="'; _buf << (h @stock.name).to_s; _buf << '" />
161
+ ';
162
+ --------------------
163
+
164
+ This shows that text_filed() is called every time when rendering,
165
+ but pp_text_filed() is called only once when loading template,
166
+ so pp_text_field() with prepocessing is much faster than text_field().
167
+
168
+ See User's guide for details.
169
+ http://www.kuwata-lab.com/erubis/users-guide.05.html#rails-formhelpers
170
+
171
+ #
172
+ - release: 2.4.1
173
+ date: 2007-09-25
174
+ enhancements:
175
+
176
+ - |
177
+ Add new section 'evaluate(context) v.s. result(binding)' to user's guide.
178
+ This section describes why Erubis::Eruby#evaluate(context) is recommended
179
+ rather than Erubis::Eruby#result(binding).
180
+ User's Guide > Other Topics > evaluate(context) v.s. result(binding)
181
+ http://www.kuwata-lab.com/erubis/users-guide.06.html#topics-context-vs-binding
182
+
183
+ - |
184
+ Add new command-line property '--docwrite={true|false}' to
185
+ Erubis::Ejavascript.
186
+ If this property is true then 'document.write(_buf.join(""));' is used
187
+ as postamble and if it is false then '_buf.join("")' is used.
188
+ Default is true for compatibility reason but it will be false in the
189
+ future release.
190
+ (This feature was proposed by D.Dribin. Thank you.)
191
+
192
+ bugfix:
193
+
194
+ - |
195
+ When using Erubis::Eruby#evaluate(), changing local variables in
196
+ templates have affected to variables accessible with TOPLEVEL_BINDING.
197
+ It means that if you change variables in templates, it is possible to
198
+ change variables in main program.
199
+ This was a bug and is now fixed not to affect to variables in main
200
+ program.
201
+
202
+ ex. template.rhtml
203
+ --------------------
204
+ <% for x in @items %>
205
+ item = <%= x %>
206
+ <% end %>
207
+ --------------------
208
+
209
+ ex. main-program.rb
210
+ --------------------
211
+ require 'erubis'
212
+ x = 10
213
+ items = ['foo', 'bar', 'baz']
214
+ eruby = Erubis::Eruby.new(File.read('template.rhtml'))
215
+ s = eruby.evaluate(:items=>items)
216
+ print s
217
+ $stderr.puts "*** debug: x=#{x.inspect}" #=> x="baz" (2.4.0)
218
+ #=> x=10 (2.4.1)
219
+ --------------------
220
+
221
+ - |
222
+ PercentLineEnhancer was very slow. Now performance problem is solved.
223
+
224
+
225
+ #
226
+ - release: 2.4.0
227
+ date: 2007-07-19
228
+ enhancements:
229
+
230
+ - |
231
+ Preprocessing is supported by Ruby on Rails helper.
232
+ Preprocessing makes Ruby on Rails application about 20-40 percent faster.
233
+
234
+ For example,
235
+
236
+ [%= link_to 'Show', :action=>'show', :id=>_?('@user.id') %]
237
+
238
+ is evaluate by preprocessor and expanded into the following
239
+ when template file is loaded.
240
+
241
+ <a href="/users/show/<%=@user.id%>">Show</a>
242
+
243
+ It means that link_to() is not called when template is rendered
244
+ and rendering speed will be much faster in the result.
245
+
246
+ See User's Guide for details.
247
+
248
+ - |
249
+ Erubis::Eruby#evaluate() (or Erubis::RubyEvaluator#evaluate()) now
250
+ creates Proc object from @src and eval it.
251
+
252
+ def evaluate(context=Context.new)
253
+ context = Context.new(context) if context.is_a?(Hash)
254
+ @_proc ||= eval("proc { #{@src} }", TOPLEVEL_BINDING, @filename || '(erubis)')
255
+ return context.instance_eval(&@_proc)
256
+ end
257
+
258
+ This makes evaluate() much faster when eruby object is reused.
259
+
260
+ - |
261
+ Erubis::Eruby#def_method() is supported.
262
+ This method defines ruby code as instance method or singleton metod.
263
+
264
+ require 'erubis'
265
+ s = "hello <%= name %>"
266
+ eruby = Erubis::Eruby.new(s)
267
+ filename = 'hello.rhtml'
268
+
269
+ ## define instance method to Dummy class (or module)
270
+ class Dummy; end
271
+ eruby.def_method(Dummy, 'render(name)', filename) # filename is optional
272
+ p Dummy.new.render('world') #=> "hello world"
273
+
274
+ ## define singleton method to an object
275
+ obj = Object.new
276
+ eruby.def_method(obj, 'render(name)', filename) # filename is optional
277
+ p obj.render('world') #=> "hello world"
278
+
279
+ This is equivarent to ERB#def_method().
280
+
281
+ - |
282
+ Erubis::XmlHelper.url_escape() and u() which is alias of url_escape()
283
+ are added.
284
+ This is equivarent to ERB#Util.url_escape().
285
+
286
+
287
+ bugfix:
288
+ - Help message was not shown when '-h' is specified. Fixed.
289
+ - 'def method()' was not availabe in template file. Fixed.
290
+
291
+
292
+ #
293
+ - release: 2.3.1
294
+ date: 2007-05-26
295
+ bugfix:
296
+ - A serious bug in 'helpers/rails_helper.rb' is fixed.
297
+ You must be update if you are using Erubis with Ruby on Rails.
298
+
299
+
300
+ #
301
+ - release: 2.3.0
302
+ date: 2007-05-23
303
+ enhancements:
304
+ - |
305
+ New class 'Erubis::FastEruby' is added.
306
+ It is a subclass of Erubis::Eruby and includes InterpolationEnhancer.
307
+ Erubis::FastEruby is compatible with and faster than Erubis::Eruby.
308
+
309
+ - |
310
+ New enhancer 'InterpolationEnhancer' is added.
311
+ This enhancer uses expression interpolation to eliminate method call
312
+ of String#<<. In the result, this enhancer makes Eruby a little faster.
313
+
314
+ --------------------
315
+ ## Assume that input is '<a href="<%=url%>"><%=name%></a>'.
316
+ ## Eruby convert input into the following code. String#<< is called 5 times.
317
+ _buf << '<a href="'; _buf << (url).to_s; _buf << '">'; _buf << (name).to_s; _buf << '</a>';
318
+
319
+ ## When InterpolationEnhancer is used, String#<< is called only once.
320
+ _buf << %Q`<a href="#{url}">#{name}</a>`;
321
+ --------------------
322
+
323
+ - |
324
+ New enhancer 'ErboutEnhancer' is added.
325
+ ErboutEnhancer set '_erbout' as well as '_buf' to be compatible with ERB.
326
+
327
+ ex.
328
+ ====================
329
+ $ cat ex.rhtml
330
+ <p>Hello</p>
331
+ $ erubis -x ex.rhtml
332
+ _buf = ''; _buf << '<p>Hello</p>
333
+ ';
334
+ _buf.to_s
335
+ $ erubis -xE Erbout ex.rhtml
336
+ _erbout = _buf = ''; _buf << '<p>Hello</p>
337
+ ';
338
+ _buf.to_s
339
+ ====================
340
+
341
+ - |
342
+ [experimental]
343
+ New enhancer 'DeleteIndentEnhancer' is added.
344
+ This enhancer deletes indentation of HTML file.
345
+
346
+ ex.
347
+ ====================
348
+ $ cat ex.rhtml
349
+ <div>
350
+ <ul>
351
+ <% for item in ['AAA', 'BBB', 'CCC'] %>
352
+ <li><%= item %></li>
353
+ <% end %>
354
+ </ul>
355
+ </div>
356
+ $ erubis ex.rhtml
357
+ <div>
358
+ <ul>
359
+ <li>AAA</li>
360
+ <li>BBB</li>
361
+ <li>CCC</li>
362
+ </ul>
363
+ </div>
364
+ $ erubis -E DeleteIndent ex.rhtml
365
+ <div>
366
+ <ul>
367
+ <li>AAA</li>
368
+ <li>BBB</li>
369
+ <li>CCC</li>
370
+ </ul>
371
+ </div>
372
+ ====================
373
+
374
+ - |
375
+ Mod_ruby is supported (very thanks to Andrew R Jackson!).
376
+ See users-guide and 'contrib/erubis-run.rb' for details.
377
+
378
+ - |
379
+ New command-line option '-X', '-N', '-U', and '-C' are added.
380
+ These are intended to be a replacement of 'notext' command.
381
+ '-X' shows only ruby statements and expressions.
382
+ '-N' adds line numbers.
383
+ '-U' compress empty lines into a line.
384
+ '-C' removes empty lines.
385
+
386
+
387
+ changes:
388
+
389
+ - |
390
+ 'helpers/rails_helper.rb' is changed to use ErboutEnhancer.
391
+ The following is an examle to use Erubis with Ruby on Rails.
392
+
393
+ File 'config/environment.rb':
394
+ ----------------------------------------
395
+ require 'erubis/helpers/rails_helper'
396
+ #Erubis::Helpers::RailsHelper.engine_class = Erubis::Eruby # or Erubis::FastEruby
397
+ #Erubis::Helpers::RailsHelper.init_properties = {}
398
+ #Erubis::Helpers::RailsHelper.show_src = false # set true for debugging
399
+ ----------------------------------------
400
+
401
+ - |
402
+ Command 'notext' has been removed. Use '-X', '-N', '-U', and '-C'
403
+ instead.
404
+
405
+ - |
406
+ Tab characters in YAML file are expaneded automatically.
407
+ If you want not to expand tab characters, add command-line optio '-T'.
408
+
409
+ - |
410
+ Benchmark scripts (benchmark/bench.*) are rewrited.
411
+
412
+ - |
413
+ Users-guide (doc/users-guide.html) is updated.
414
+
415
+
416
+
417
+ #
418
+ - release: 2.2.0
419
+ date: 2007-02-11
420
+ enhancements:
421
+ - |
422
+ Performance tuned up. Release 2.2.0 works about 8 percent faster
423
+ than 2.1.0.
424
+ As a result, Erubis works more than 10 percent faster than eruby.
425
+ (eruby is the extension module of eRuby written in C.)
426
+
427
+ - |
428
+ Support of Ruby on Rails improved.
429
+ If you want to use Erubis with Ruby on Rails, add the following code
430
+ into your 'config/environment.rb' and restart web server.
431
+ This will set Erubis as eRuby compiler in Ruby on Rails instead of ERB.
432
+
433
+ --------------------
434
+ require 'erubis/helpers/rails_helper'
435
+ #Erubis::Helpers::RailsHelper.engine_class = Erubis::Eruby
436
+ #Erubis::Helpers::RailsHelper.init_properties = {}
437
+ #Erubis::Helpers::RailsHelper.show_src = true
438
+ --------------------
439
+
440
+ Methods 'capture()' and 'content_for()' of ActionView::Helpers::CaptureHelper
441
+ are available. Methd ActionView::Helpers::TextHelper#concat() is also available.
442
+
443
+ If Erubis::Helpers::RailsHelper.show_src is ture, Erubis prints converted
444
+ Ruby code into log file (such as 'log/development.log').
445
+
446
+ - |
447
+ Erubis::Engine.load_file(filename) creates cache file (filename +
448
+ '.cache') automatically if cache file is old or not exist.
449
+ Caching makes Erubis about 40-50 percent faster.
450
+
451
+ ex.
452
+ --------------------
453
+ require 'erubis'
454
+ eruby = Erubis::Eruby.load_file('example.rhtml')
455
+ ## cache file 'example.rhtml.cache' is created automatically
456
+ --------------------
457
+
458
+ - |
459
+ Command-line option '-f datafile' can take Ruby script ('*.rb')
460
+ as well as YAML file ('*.yaml' or '*.yml').
461
+
462
+ ex.
463
+ ====================
464
+ $ cat context.rb
465
+ @title = 'Example'
466
+ @list = %w[AAA BBB CCC]
467
+ $ cat example.rhtml
468
+ <h1><%= @title %></h1>
469
+ <ul>
470
+ <% for item in @list %>
471
+ <li><%= item %></li>
472
+ <% end %>
473
+ </ul>
474
+ $ erubis -f context.rb example.rhtml
475
+ <h1>Example</h1>
476
+ <ul>
477
+ <li>AAA</li>
478
+ <li>BBB</li>
479
+ <li>CCC</li>
480
+ </ul>
481
+ ====================
482
+
483
+ - |
484
+ New command-line option '-c context' support. It takes context string
485
+ in YAML inline style or Ruby code style.
486
+
487
+ ex. YAML inline style
488
+ ====================
489
+ $ erubis -c '{title: Example, list: [AAA, BBB, CCC]}' example.rhtml
490
+ ====================
491
+
492
+ ex. Ruby style
493
+ ====================
494
+ $ erubis -c '@title="Example"; @list=%w[AAA BBB CCC]' example.rhtml
495
+ ====================
496
+
497
+ - |
498
+ New command-line option '-z' (syntax checking) support. It is similar
499
+ to 'erubis -x file.rhtml | ruby -wc', but it can take several filenames.
500
+
501
+ ex.
502
+ ====================
503
+ $ erubis -z app/views/*/*.rhtml
504
+ Syntax OK
505
+ ====================
506
+
507
+ - |
508
+ New constant Erubis::VERSION added.
509
+
510
+
511
+ changes:
512
+ - |
513
+ Class Erubis::Eruby changed to include Erubis::StringBufferEnhancer
514
+ instead of Erubis::ArrayBufferEnhancer.
515
+ This is for Ruby on Rails support.
516
+
517
+ ex.
518
+ ====================
519
+ $ cat example.rhtml
520
+ <ul>
521
+ <% for item in @list %>
522
+ <li><%= item %></li>
523
+ <% end %>
524
+ </ul>
525
+ $ erubis -x example.rhtml
526
+ _buf = ''; _buf << '<ul>
527
+ '; for item in @list
528
+ _buf << ' <li>'; _buf << ( item ).to_s; _buf << '</li>
529
+ '; end
530
+ _buf << '</ul>
531
+ ';
532
+ _buf.to_s
533
+ ====================
534
+
535
+ - |
536
+ Erubis::StringBufferEnhancer#add_postamble() prints "_buf.to_s"
537
+ instead of "_buf".
538
+ This is useful for 'erubis -x file.rhtml | ruby -wc'.
539
+
540
+ - |
541
+ Command-line option '-T' is removed. Use '--trim=false' instead.
542
+
543
+ - |
544
+ License is changed to MIT License.
545
+
546
+ - |
547
+ Embedded pattern '<%- -%>' can be handled.
548
+
549
+
550
+ #
551
+ - release: 2.1.0
552
+ date: 2006-09-23
553
+ enhancements:
554
+ - |
555
+ Ruby on Rails support. Add the following code to
556
+ your 'app/controllers/application.rb' and restart web server.
557
+
558
+ --------------------
559
+ require 'erubis/helper/rails'
560
+ suffix = 'erubis'
561
+ ActionView::Base.register_template_handler(suffix, Erubis::Helper::RailsTemplate)
562
+ #Erubis::Helper::RailsTemplate.engine_class = Erubis::EscapedEruby ## or Erubis::PI::Eruby
563
+ #Erubis::Helper::RailsTemplate.default_properties = { :escape=>true, :escapefunc=>'h' }
564
+ --------------------
565
+
566
+ And rename your view template as 'xxx.erubis'.
567
+ If you got the "(eval):10:in `render': no block given" error,
568
+ use '@content_for_layout' instead 'yield' in your layout template.
569
+
570
+ - |
571
+ Another eRuby engine (PIEngine) support. This engine doesn't
572
+ break HTML design because it uses Processing Instructions (PI)
573
+ '<?rb .. ?>' as embedded pattern instead of '<% .. %>'.
574
+
575
+ example.rhtml
576
+ --------------------
577
+ <table>
578
+ <?rb @list.each_with_index do |item, i| ?>
579
+ <?rb klass = i % 2 == 0 ? 'odd' : 'even' ?>
580
+ <tr class="@{klass}@">
581
+ <td>@!{item}@</td>
582
+ </tr>
583
+ <?rb end ?>
584
+ </table>
585
+ --------------------
586
+
587
+ compile:
588
+ ====================
589
+ $ erubis -x --pi example.rhtml
590
+ _buf = []; _buf << '<table>
591
+ '; @list.each_with_index do |item, i|
592
+ klass = i % 2 == 0 ? 'odd' : 'even'
593
+ _buf << ' <tr class="'; _buf << Erubis::XmlHelper.escape_xml(klass); _buf << '">
594
+ <td>'; _buf << (item).to_s; _buf << '</td>
595
+ </tr>
596
+ '; end
597
+ _buf << '</table>
598
+ ';
599
+ _buf.join
600
+ ====================
601
+
602
+ - |
603
+ Add new command 'notext' which remove text part from eRuby
604
+ script and leaves only Ruby code.
605
+ This is very useful for debug of eRuby script.
606
+
607
+ example2.rhtml
608
+ --------------------
609
+ <html>
610
+ <body>
611
+ <table>
612
+ <% @list.each_with_index do |item, i| %>
613
+ <% klass = i % 2 == 0 ? 'odd' : 'even' %>
614
+ <tr class="<%= klass %>">
615
+ <td><%== item %></td>
616
+ </tr>
617
+ <% end %>
618
+ </table>
619
+ </body>
620
+ </html>
621
+ --------------------
622
+
623
+ command line example:
624
+ ====================
625
+ $ notext example2.rhtml
626
+ _buf = [];
627
+
628
+
629
+ @list.each_with_index do |item, i| ;
630
+ klass = i % 2 == 0 ? 'odd' : 'even' ;
631
+ _buf << ( klass ).to_s;
632
+ _buf << Erubis::XmlHelper.escape_xml( item );
633
+
634
+ end ;
635
+
636
+
637
+
638
+ _buf.join
639
+ $ notext -nc example2.rhtml
640
+ 1: _buf = [];
641
+ 4: @list.each_with_index do |item, i| ;
642
+ 5: klass = i % 2 == 0 ? 'odd' : 'even' ;
643
+ 6: _buf << ( klass ).to_s;
644
+ 7: _buf << Erubis::XmlHelper.escape_xml( item );
645
+ 9: end ;
646
+ 13: _buf.join
647
+ ====================
648
+
649
+ - |
650
+ Add new enhance 'NoCode' which removes ruby code from
651
+ eRuby script and leaves only HTML text part.
652
+ It is very useful to validate HTML of eRuby script.
653
+
654
+ command-line example:
655
+ ====================
656
+ $ erubis -x -E NoCode example2.rhtml
657
+ <html>
658
+ <body>
659
+ <table>
660
+
661
+
662
+ <tr class="">
663
+ <td></td>
664
+ </tr>
665
+
666
+ </table>
667
+ </body>
668
+ </html>
669
+ ====================
670
+
671
+ changes:
672
+ - License is changed to LGPL.
673
+ - Command-line property '--escape=name' is renamed to
674
+ '--escapefunc=name'.
675
+ - When command-line option '-l perl' is specified, function
676
+ 'encode_entities()' is used ad escaping function which is
677
+ available wth HTML::Entities module.
678
+
679
+ bugfix:
680
+ - There is a certain pattern which makes Engine#convert()
681
+ too slow. Now Engne#convert() is fixed not to be slown.
682
+ - Command name is now displayed when '-h' is specified.
683
+
684
+
685
+ #
686
+ - release: 2.0.1
687
+ date: 2006-06-21
688
+ bugfix:
689
+ - some minor bugs are fixed
690
+
691
+
692
+ #
693
+ - release: 2.0.0
694
+ date: 2006-05-20
695
+ changes:
696
+ - module 'PrintEnhancer' is renamed to 'PrintEnabledEnahncer'
697
+ - module 'FastEnhancer' and class 'FastEruby' is obsolete because they are integrated into Eruby class
698
+ - Eruby#evaluate() calls instance_eval() instead of eval()
699
+ - XmlEruby.escape_xml() is moved to XmlHelper.escape_xml()
700
+ enhancements:
701
+ - multi programming language support (Ruby/PHP/C/Java/Scheme/Perl/Javascript)
702
+ - class Eruby runs very fast because FastEnhancer module is integrated into Eruby by default
703
+ - TinyEruby class (tiny.rb) is added
704
+ - module ArrayBufferEnhancer added
705
+ - module ArrayEnhancer added
706
+ - module BiPatternEnhancer added
707
+ - module EscapeEnhancer added
708
+ - module HeaderFooterEnhancer added
709
+ - module NoTextEnhancer added
710
+ - module PercentLineEnhancer added
711
+ - module PrintEnabledEnhancer added
712
+ - module PrintOutEnhancer added
713
+ - module SimplifyEnhancer added
714
+ - module StringBufferEnhancer added
715
+ - module StringIOEnhancer added
716
+ - command-line option '-b' (body only) added
717
+ - command-line option '-e' (escape) added
718
+ - command-line option '-l' (lang) added
719
+ - command-line option '-E' (enhancer) added
720
+ - command-line option '-I' (require path) added
721
+ - command-line option '-K' (kanji code) added
722
+ - command-line option '-S' (string to symbol) added
723
+ - command-line option '-B' (call result(binding())) added
724
+
725
+
726
+ #
727
+ - release: 1.1.0
728
+ date: 2006-03-05
729
+ enhancements:
730
+ - '<%# ... %>' is supported
731
+ - PrintEnhancer, PrintEruby, and PrintXmlEruby added
732
+
733
+ - release: 1.0.1
734
+ date: 2006-02-01
735
+ bugfixes:
736
+ - bin/erubis is available with RubyGems
737
+
738
+
739
+ #
740
+ - release: 1.0.0
741
+ date: 2006-02-01
742
+ bugfixes:
743
+ - first release
744
+