kwartz 3.0.0 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (179) hide show
  1. data/ChangeLog +36 -1
  2. data/LGPL +504 -0
  3. data/README.txt +16 -2
  4. data/bin/kwartz +1 -1
  5. data/doc-api/classes/Kwartz.html +47 -1
  6. data/doc-api/classes/Kwartz/Assertion.html +6 -6
  7. data/doc-api/classes/Kwartz/AssertionError.html +6 -6
  8. data/doc-api/classes/Kwartz/AttrInfo.html +42 -42
  9. data/doc-api/classes/Kwartz/BaseError.html +12 -12
  10. data/doc-api/classes/Kwartz/BaseTranslator.html +210 -43
  11. data/doc-api/classes/Kwartz/CharacterType.html +24 -24
  12. data/doc-api/classes/Kwartz/CommandOptionError.html +7 -7
  13. data/doc-api/classes/Kwartz/CommandOptions.html +49 -49
  14. data/doc-api/classes/Kwartz/Config.html +6 -1
  15. data/doc-api/classes/Kwartz/ConvertError.html +14 -14
  16. data/doc-api/classes/Kwartz/Converter.html +31 -30
  17. data/doc-api/classes/Kwartz/CssStyleParser.html +79 -57
  18. data/doc-api/classes/Kwartz/Defun.html +313 -0
  19. data/doc-api/classes/Kwartz/DocumentRuleset.html +58 -58
  20. data/doc-api/classes/Kwartz/ElementExpander.html +32 -32
  21. data/doc-api/classes/Kwartz/ElementInfo.html +29 -29
  22. data/doc-api/classes/Kwartz/ElementRuleset.html +126 -96
  23. data/doc-api/classes/Kwartz/EperlHandler.html +108 -84
  24. data/doc-api/classes/Kwartz/EperlTranslator.html +7 -7
  25. data/doc-api/classes/Kwartz/ErubisHandler.html +2 -2
  26. data/doc-api/classes/Kwartz/ErubisTranslator.html +8 -8
  27. data/doc-api/classes/Kwartz/ErubyHandler.html +2 -220
  28. data/doc-api/classes/Kwartz/ErubyTranslator.html +7 -7
  29. data/doc-api/classes/Kwartz/ExpandStatement.html +20 -20
  30. data/doc-api/classes/Kwartz/Handler.html +122 -117
  31. data/doc-api/classes/Kwartz/HandlerArgument.html +215 -0
  32. data/doc-api/classes/Kwartz/Helper.html +112 -0
  33. data/doc-api/classes/Kwartz/Helper/ActionViewHelper.html +221 -0
  34. data/doc-api/classes/Kwartz/Helper/RailsTemplate.html +630 -0
  35. data/doc-api/classes/Kwartz/JstlHandler.html +208 -193
  36. data/doc-api/classes/Kwartz/JstlTranslator.html +15 -15
  37. data/doc-api/classes/Kwartz/KwartzError.html +6 -6
  38. data/doc-api/classes/Kwartz/Main.html +39 -23
  39. data/doc-api/classes/Kwartz/NativeExpression.html +18 -18
  40. data/doc-api/classes/Kwartz/NativeStatement.html +25 -25
  41. data/doc-api/classes/Kwartz/Node.html +6 -6
  42. data/doc-api/classes/Kwartz/PIErubisHandler.html +113 -0
  43. data/doc-api/classes/Kwartz/PIErubisTranslator.html +200 -0
  44. data/doc-api/classes/Kwartz/ParseError.html +6 -6
  45. data/doc-api/classes/Kwartz/PhpHandler.html +102 -83
  46. data/doc-api/classes/Kwartz/PhpTranslator.html +14 -14
  47. data/doc-api/classes/Kwartz/PresentationLogicParser.html +136 -128
  48. data/doc-api/classes/Kwartz/PrintStatement.html +19 -19
  49. data/doc-api/classes/Kwartz/RailsHandler.html +121 -118
  50. data/doc-api/classes/Kwartz/RailsTranslator.html +7 -7
  51. data/doc-api/classes/Kwartz/RubyHandler.html +349 -0
  52. data/doc-api/classes/Kwartz/RubyStyleParser.html +85 -85
  53. data/doc-api/classes/Kwartz/RubyTranslator.html +218 -0
  54. data/doc-api/classes/Kwartz/StatementHelper.html +479 -0
  55. data/doc-api/classes/Kwartz/StrutsTranslator.html +12 -12
  56. data/doc-api/classes/Kwartz/TagInfo.html +28 -28
  57. data/doc-api/classes/Kwartz/TextConverter.html +28 -28
  58. data/doc-api/classes/Kwartz/Translator.html +42 -42
  59. data/doc-api/classes/Kwartz/Util.html +284 -0
  60. data/doc-api/created.rid +1 -1
  61. data/doc-api/files/__/README_txt.html +30 -3
  62. data/doc-api/files/kwartz/assert_rb.html +1 -1
  63. data/doc-api/files/kwartz/binding/eperl_rb.html +2 -2
  64. data/doc-api/files/kwartz/binding/erubis_rb.html +3 -3
  65. data/doc-api/files/kwartz/binding/eruby_rb.html +3 -2
  66. data/doc-api/files/kwartz/binding/jstl_rb.html +2 -2
  67. data/doc-api/files/kwartz/binding/php_rb.html +2 -2
  68. data/doc-api/files/kwartz/binding/pierubis_rb.html +116 -0
  69. data/doc-api/files/kwartz/binding/rails_rb.html +2 -2
  70. data/doc-api/files/kwartz/binding/ruby_rb.html +115 -0
  71. data/doc-api/files/kwartz/binding/struts_rb.html +1 -1
  72. data/doc-api/files/kwartz/config_rb.html +2 -2
  73. data/doc-api/files/kwartz/converter_rb.html +3 -2
  74. data/doc-api/files/kwartz/defun_rb.html +116 -0
  75. data/doc-api/files/kwartz/error_rb.html +1 -1
  76. data/doc-api/files/kwartz/helper/rails_rb.html +123 -0
  77. data/doc-api/files/kwartz/main_rb.html +5 -2
  78. data/doc-api/files/kwartz/node_rb.html +2 -2
  79. data/doc-api/files/kwartz/parser_rb.html +2 -2
  80. data/doc-api/files/kwartz/translator_rb.html +2 -2
  81. data/doc-api/files/kwartz/util/assert-text-equal_rb.html +1 -1
  82. data/doc-api/files/kwartz/util/testcase-helper_rb.html +2 -2
  83. data/doc-api/files/kwartz/util_rb.html +107 -0
  84. data/doc-api/files/kwartz_rb.html +3 -2
  85. data/doc-api/fr_class_index.html +11 -0
  86. data/doc-api/fr_file_index.html +5 -0
  87. data/doc-api/fr_method_index.html +242 -190
  88. data/doc/p-pattern.html +94 -94
  89. data/doc/reference.html +847 -612
  90. data/doc/users-guide.html +744 -241
  91. data/examples/rails1/README +2 -2
  92. data/examples/rails1/application_helper.rb +2 -27
  93. data/examples/rails1/link_to.plogic +5 -5
  94. data/examples/rails1/list.plogic +2 -2
  95. data/examples/rails2/app/controllers/application.rb +14 -0
  96. data/examples/rails2/app/controllers/groups_controller.rb +47 -0
  97. data/examples/rails2/app/controllers/members_controller.rb +56 -0
  98. data/examples/rails2/app/helpers/application_helper.rb +6 -0
  99. data/examples/rails2/app/helpers/groups_helper.rb +2 -0
  100. data/examples/rails2/app/helpers/members_helper.rb +2 -0
  101. data/examples/rails2/app/models/group.rb +2 -0
  102. data/examples/rails2/app/models/member.rb +3 -0
  103. data/examples/rails2/app/views/groups/_form.html +30 -0
  104. data/examples/rails2/app/views/groups/_form.plogic +11 -0
  105. data/examples/rails2/app/views/groups/_link.plogic +19 -0
  106. data/examples/rails2/app/views/groups/_read.plogic +7 -0
  107. data/examples/rails2/app/views/groups/edit.cfg.yaml +2 -0
  108. data/examples/rails2/app/views/groups/edit.html +26 -0
  109. data/examples/rails2/app/views/groups/edit.plogic +9 -0
  110. data/examples/rails2/app/views/groups/list.html +48 -0
  111. data/examples/rails2/app/views/groups/list.plogic +32 -0
  112. data/examples/rails2/app/views/groups/new.cfg.yaml +2 -0
  113. data/examples/rails2/app/views/groups/new.html +27 -0
  114. data/examples/rails2/app/views/groups/new.plogic +9 -0
  115. data/examples/rails2/app/views/groups/show.html +27 -0
  116. data/examples/rails2/app/views/groups/show.plogic +2 -0
  117. data/examples/rails2/app/views/layouts/groups.html +23 -0
  118. data/examples/rails2/app/views/layouts/groups.plogic +11 -0
  119. data/examples/rails2/app/views/layouts/members.html +23 -0
  120. data/examples/rails2/app/views/layouts/members.plogic +11 -0
  121. data/examples/rails2/app/views/layouts/members2.html +24 -0
  122. data/examples/rails2/app/views/layouts/members2.plogic +11 -0
  123. data/examples/rails2/app/views/members/_form.plogic +27 -0
  124. data/examples/rails2/app/views/members/_link.plogic +19 -0
  125. data/examples/rails2/app/views/members/_read.plogic +29 -0
  126. data/examples/rails2/app/views/members/edit.cfg.yaml +6 -0
  127. data/examples/rails2/app/views/members/edit.html +27 -0
  128. data/examples/rails2/app/views/members/edit.plogic +10 -0
  129. data/examples/rails2/app/views/members/list.html +53 -0
  130. data/examples/rails2/app/views/members/list.plogic +32 -0
  131. data/examples/rails2/app/views/members/new.html +61 -0
  132. data/examples/rails2/app/views/members/new.plogic +17 -0
  133. data/examples/rails2/app/views/members/show.html +41 -0
  134. data/examples/rails2/app/views/members/show.plogic +3 -0
  135. data/examples/rails2/db/create-tables.mysql.sql +27 -0
  136. data/examples/rails2/db/create-tables.pgsql.sql +27 -0
  137. data/examples/rails2/db/insert-data.sql +21 -0
  138. data/examples/rails2/db/tabledef.yaml +51 -0
  139. data/kwartz.gemspec +4 -4
  140. data/lib/kwartz.rb +10 -2
  141. data/lib/kwartz/assert.rb +1 -1
  142. data/lib/kwartz/binding/eperl.rb +85 -61
  143. data/lib/kwartz/binding/erubis.rb +6 -8
  144. data/lib/kwartz/binding/eruby.rb +5 -120
  145. data/lib/kwartz/binding/jstl.rb +116 -101
  146. data/lib/kwartz/binding/php.rb +79 -60
  147. data/lib/kwartz/binding/pierubis.rb +58 -0
  148. data/lib/kwartz/binding/rails.rb +45 -42
  149. data/lib/kwartz/binding/ruby.rb +193 -0
  150. data/lib/kwartz/binding/struts.rb +1 -1
  151. data/lib/kwartz/config.rb +4 -3
  152. data/lib/kwartz/converter.rb +231 -68
  153. data/lib/kwartz/defun.rb +126 -0
  154. data/lib/kwartz/error.rb +1 -1
  155. data/lib/kwartz/helper/rails.rb +437 -0
  156. data/lib/kwartz/main.rb +30 -38
  157. data/lib/kwartz/node.rb +46 -31
  158. data/lib/kwartz/parser.rb +43 -15
  159. data/lib/kwartz/translator.rb +104 -6
  160. data/lib/kwartz/util.rb +113 -0
  161. data/lib/kwartz/util/assert-text-equal.rb +1 -1
  162. data/lib/kwartz/util/testcase-helper.rb +26 -8
  163. data/test/test-compile.rb +3 -3
  164. data/test/test-compile.yaml +135 -5
  165. data/test/test-converter.rb +16 -8
  166. data/test/test-converter.yaml +307 -76
  167. data/test/test-directives.rb +1 -1
  168. data/test/test-directives.yaml +964 -979
  169. data/test/test-main.rb +61 -146
  170. data/test/test-main.yaml +235 -0
  171. data/test/test-parser.rb +10 -12
  172. data/test/test-parser.yaml +484 -326
  173. data/test/test-rails.rb +1 -1
  174. data/test/test-rails.yaml +37 -37
  175. data/test/test-ruleset.rb +1 -1
  176. data/test/test-ruleset.yaml +34 -40
  177. data/test/test.rb +1 -1
  178. metadata +82 -3
  179. data/COPYING +0 -340
@@ -1,6 +1,6 @@
1
1
  ####
2
- #### $Rev: 117 $
3
- #### $Release: 3.0.0 $
2
+ #### $Rev: 128 $
3
+ #### $Release: 3.1.0 $
4
4
  #### copyright(c) 2004-2006 kuwata-lab.com all rights reserved
5
5
  ####
6
6
 
@@ -93,7 +93,7 @@ module Kwartz
93
93
  attr_accessor :escape, :header, :footer
94
94
 
95
95
 
96
- def translate(stmt_list=[])
96
+ def translate(stmt_list)
97
97
  @sb = ''
98
98
  @sb << @header if @header
99
99
  stmt_list.each do |stmt|
@@ -114,7 +114,8 @@ module Kwartz
114
114
  stmt.args.each do |arg|
115
115
  #arg.accept(self)
116
116
  if arg.is_a?(String)
117
- translate_string(arg)
117
+ #translate_string(arg)
118
+ parse_embedded_expr(arg)
118
119
  elsif arg.is_a?(NativeExpression)
119
120
  translate_native_expr(arg)
120
121
  else
@@ -129,9 +130,9 @@ module Kwartz
129
130
  flag_escape = expr.escape?
130
131
  flag_escape = @escape if flag_escape == nil
131
132
  if flag_escape
132
- @sb << @escape_l << expr.code << @escape_r # ex. <%=h expr.code %>
133
+ add_escaped_expr(expr.code)
133
134
  else
134
- @sb << @expr_l << expr.code << @expr_r # ex. <%= expr.code %>
135
+ add_plain_expr(expr.code)
135
136
  end
136
137
  end
137
138
 
@@ -146,8 +147,105 @@ module Kwartz
146
147
  # end
147
148
 
148
149
 
150
+ protected
151
+
152
+
153
+ def parse_embedded_expr(text)
154
+ pos = 0
155
+ text.scan(/@(!*)\{(.*?)\}@/) do |indicator, expr_code|
156
+ m = Regexp.last_match
157
+ s = text[pos, m.begin(0) - pos]
158
+ pos = m.end(0)
159
+ translate_string(s) unless s.empty?
160
+ case indicator
161
+ when nil, '' ; add_escaped_expr(expr_code)
162
+ when '!' ; add_plain_expr(expr_code)
163
+ when '!!' ; add_debug_expr(expr_code)
164
+ else ; # do nothing
165
+ end
166
+ end
167
+ rest = pos == 0 ? text : $'
168
+ translate_string(rest) unless rest.empty?
169
+ end
170
+
171
+
172
+ def add_plain_expr(expr_code)
173
+ @sb << @expr_l << expr_code << @expr_r # ex. <%= expr_code %>
174
+ end
175
+
176
+
177
+ def add_escaped_expr(expr_code)
178
+ @sb << @escape_l << expr_code << @escape_r # ex. <%=h expr_code %>
179
+ end
180
+
181
+
182
+ def add_debug_expr(expr_code)
183
+ not_implemented
184
+ end
185
+
186
+
187
+ ## concat several print statements into a statement
188
+ def optimize_print_stmts(stmt_list)
189
+ stmt_list2 = []
190
+ args = []
191
+ stmt_list.each do |stmt|
192
+ if stmt.is_a?(PrintStatement)
193
+ args += stmt.args
194
+ else
195
+ if !args.empty?
196
+ args = _compact_args(args)
197
+ stmt_list2 << PrintStatement.new(args)
198
+ args = []
199
+ end
200
+ stmt_list2 << stmt
201
+ end
202
+ end
203
+ if !args.empty?
204
+ args = _compact_args(args)
205
+ stmt_list2 << PrintStatement.new(args)
206
+ end
207
+ return stmt_list2
208
+ end
209
+
210
+
211
+ private
212
+
213
+
214
+ ## concat several string arguments into a string in arguments
215
+ def _compact_args(args)
216
+ args2 = []
217
+ s = ''
218
+ args.each do |arg|
219
+ if arg.is_a?(NativeExpression)
220
+ args2 << s unless s.empty?
221
+ s = ''
222
+ args2 << arg
223
+ else
224
+ s << arg
225
+ end
226
+ end
227
+ args2 << s unless s.empty?
228
+ return args2
229
+ end
230
+
231
+
149
232
  end #class
150
233
 
151
234
 
152
235
 
236
+ module NoTextEnhancer # :nodoc:
237
+
238
+
239
+ def translate_string(str)
240
+ @sb << (@nl * str.count("\n"))
241
+ pos = str.rindex("\n")
242
+ len = pos ? str.length - pos - 1 : str.length
243
+ @sb << (' ' * len)
244
+ end
245
+
246
+
247
+ end
248
+
249
+
250
+
153
251
  end #module
@@ -0,0 +1,113 @@
1
+ ###
2
+ ### $Rev: 126 $
3
+ ### $Release: 3.1.0 $
4
+ ### copyright(c) 2004-2006 kuwata-lab.com all rights reserved
5
+ ###
6
+
7
+ module Kwartz
8
+
9
+
10
+ module Util
11
+
12
+
13
+ module_function
14
+
15
+
16
+
17
+ ##
18
+ ## expand tab characters to spaces
19
+ ##
20
+ def untabify(str, width=8)
21
+ list = str.split(/\t/)
22
+ last = list.pop
23
+ buf = []
24
+ list.each do |s|
25
+ column = (pos = s.rindex(?\n)) ? s.length - pos - 1 : s.length
26
+ n = width - (column % width)
27
+ buf << s << (" " * n)
28
+ end
29
+ buf << last
30
+ return buf.join
31
+ end
32
+ #--
33
+ #def untabify(str, width=8)
34
+ # sb = ''
35
+ # str.scan(/(.*?)\t/m) do |s, |
36
+ # len = (n = s.rindex(?\n)) ? s.length - n - 1 : s.length
37
+ # sb << s << (" " * (width - len % width))
38
+ # end
39
+ # return $' ? (sb << $') : str
40
+ #end
41
+ #++
42
+
43
+
44
+ ##
45
+ ## convert hash's key string into symbol.
46
+ ##
47
+ ## ex.
48
+ ## hash = YAML.load_file('foo.yaml')
49
+ ## intern_hash_keys(hash)
50
+ ##
51
+ def intern_hash_keys(obj, done={})
52
+ return if done.key?(obj.__id__)
53
+ case obj
54
+ when Hash
55
+ done[obj.__id__] = obj
56
+ obj.keys.each do |key|
57
+ obj[key.intern] = obj.delete(key) if key.is_a?(String)
58
+ end
59
+ obj.values.each do |val|
60
+ intern_hash_keys(val, done) if val.is_a?(Hash) || val.is_a?(Array)
61
+ end
62
+ when Array
63
+ done[obj.__id__] = obj
64
+ obj.each do |val|
65
+ intern_hash_keys(val, done) if val.is_a?(Hash) || val.is_a?(Array)
66
+ end
67
+ end
68
+ end
69
+
70
+
71
+ ##
72
+ ## convert string pattern into regexp.
73
+ ## metacharacter '*' and '?' are available.
74
+ ##
75
+ ## ex.
76
+ ## pattern_to_regexp('*.html') #=> /\A(.*)\.html\z/
77
+ ##
78
+ def pattern_to_regexp(pattern)
79
+ i = 0
80
+ len = pattern.length
81
+ s = '\A'
82
+ while i < len
83
+ case ch = pattern[i]
84
+ when ?\\ ; s << Regexp.escape(pattern[i+=1].chr)
85
+ when ?* ; s << '(.*)'
86
+ when ?? ; s << '(.)'
87
+ else ; s << Regexp.escape(ch.chr)
88
+ end
89
+ i += 1
90
+ end
91
+ s << '\z'
92
+ return Regexp.compile(s)
93
+ end
94
+
95
+
96
+ ##
97
+ ## select items from list with patterns.
98
+ ##
99
+ ## ex.
100
+ ## patterns = %w[user_*]
101
+ ## names = %w[user_name user_age error_msg]
102
+ ## select_with_patterns(list, patterns) #=> ['user_name', 'user_age']
103
+ ##
104
+ def select_with_patterns(list, patterns)
105
+ regexp_list = patterns.collect { |pattern| pattern_to_regexp(pattern) }
106
+ return list.select { |item| regexp_list.any? { |rexp| rexp =~ item } }
107
+ end
108
+
109
+
110
+ end
111
+
112
+
113
+ end
@@ -1,6 +1,6 @@
1
1
  ###
2
2
  ### $Rev: 117 $
3
- ### $Release: 3.0.0 $
3
+ ### $Release: 3.1.0 $
4
4
  ### copyright(c) 2004-2006 kuwata-lab.com all rights reserved
5
5
  ###
6
6
 
@@ -1,6 +1,6 @@
1
1
  ###
2
2
  ### $Rev$
3
- ### $Release: 3.0.0 $
3
+ ### $Release: 3.1.0 $
4
4
  ### copyright(c) 2004-2006 kuwata-lab.com all rights reserved
5
5
  ###
6
6
 
@@ -12,13 +12,24 @@ class Test::Unit::TestCase # :nodoc:
12
12
 
13
13
 
14
14
  def self._untabify(str, width=8) # :nodoc:
15
- sb = []
16
- str.scan(/(.*?)\t/m) do |s, |
17
- len = (n = s.rindex(?\n)) ? s.length - n - 1 : s.length
18
- sb << s << (" " * (width - len % width))
15
+ list = str.split(/\t/, -1)
16
+ return list.first if list.length == 1
17
+ last = list.pop
18
+ buf = []
19
+ list.each do |s|
20
+ column = (pos = s.rindex(?\n)) ? s.length - pos - 1 : s.length
21
+ n = width - (column % width)
22
+ buf << s << (" " * n)
19
23
  end
20
- str = (sb << $').join if $'
21
- return str
24
+ buf << last
25
+ return buf.join
26
+ #sb = []
27
+ #str.scan(/(.*?)\t/m) do |s, |
28
+ # len = (n = s.rindex(?\n)) ? s.length - n - 1 : s.length
29
+ # sb << s << (" " * (width - len % width))
30
+ #end
31
+ #str = (sb << $').join if $'
32
+ #return str
22
33
  end
23
34
 
24
35
 
@@ -48,9 +59,16 @@ class Test::Unit::TestCase # :nodoc:
48
59
  ident or raise "*** #{identkey} is not found."
49
60
  table[ident] and raise "*** #{identkey} '#{ident}' is duplicated."
50
61
  table[ident] = ydoc
51
- yield(ydoc) if block_given?
52
62
  end
53
63
  #
64
+ target = $target || ENV['TEST']
65
+ if target
66
+ table[target] or raise "*** target '#{target}' not found."
67
+ list = [ table[target] ]
68
+ end
69
+ #
70
+ list.each do |ydoc| yield(ydoc) end if block_given?
71
+ #
54
72
  return list
55
73
  end
56
74
 
@@ -1,6 +1,6 @@
1
1
  ###
2
- ### $Rev: 117 $
3
- ### $Release: 3.0.0 $
2
+ ### $Rev: 128 $
3
+ ### $Release: 3.1.0 $
4
4
  ### copyright(c) 2004-2006 kuwata-lab.com all rights reserved
5
5
  ###
6
6
 
@@ -13,7 +13,7 @@ class CompileTest < Test::Unit::TestCase
13
13
 
14
14
  ## define test methods
15
15
  filename = __FILE__.sub(/\.rb$/, '.yaml')
16
- load_yaml_testdata_with_each_lang(filename, :langs=>%w[eruby php jstl eperl])
16
+ load_yaml_testdata_with_each_lang(filename, :langs=>%w[eruby ruby erubis pierubis php jstl eperl])
17
17
 
18
18
 
19
19
  def _test
@@ -17,11 +17,11 @@
17
17
  </table>
18
18
  </body>
19
19
  </html>
20
+ <!-- end -->
20
21
 
21
-
22
22
  plogic*:
23
-
24
- eruby: |
23
+
24
+ eruby: &plogic1_ruby|
25
25
  #list {
26
26
  attrs: 'bgcolor' color,
27
27
  'title' user.name;
@@ -40,6 +40,12 @@
40
40
  #mail {
41
41
  cont: user[:mail];
42
42
  }
43
+
44
+ ruby: *plogic1_ruby
45
+
46
+ erubis: *plogic1_ruby
47
+
48
+ pierubis: *plogic1_ruby
43
49
 
44
50
  php: |
45
51
  #list {
@@ -118,11 +124,64 @@
118
124
  <td>{{*<%=h user.name %>*}}</td>
119
125
  <td>{{*<%= user[:mail] %>*}}</td>
120
126
  </tr>
121
- <% } %>
127
+ {{*<% } %>*}}
122
128
  </table>
123
129
  </body>
124
130
  </html>
125
-
131
+ <!-- end -->
132
+
133
+ ruby: |
134
+ _buf = ""; _buf << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
135
+ <html>
136
+ <body>
137
+ <table>\n";
138
+ {{*@list.each_with_index { |user, i|*}}
139
+ {{*color = i % 2 == 0 ? '#FFCCCC' : '#CCCCFF'*}}
140
+ _buf << " <tr bgcolor=\""; _buf << {{*(color).to_s*}}; _buf << "\" title=\""; _buf << {{*(user.name).to_s*}}; _buf << "\">
141
+ <td>"; _buf << {{*ERB::Util.h(user.name)*}}; _buf << "</td>
142
+ <td>"; _buf << {{*(user[:mail]).to_s*}}; _buf << "</td>
143
+ </tr>\n";
144
+ {{*}*}}
145
+ _buf << " </table>
146
+ </body>
147
+ </html>
148
+ <!-- end -->\n";
149
+ ; _buf
150
+
151
+ erubis: |
152
+ <?xml version="1.0" encoding="UTF-8"?>
153
+ <html>
154
+ <body>
155
+ <table>
156
+ {{*<% @list.each_with_index { |user, i| %>*}}
157
+ {{*<% color = i % 2 == 0 ? '#FFCCCC' : '#CCCCFF' %>*}}
158
+ <tr bgcolor="{{*<%= color %>*}}" title="{{*<%= user.name %>*}}">
159
+ <td>{{*<%== user.name %>*}}</td>
160
+ <td>{{*<%= user[:mail] %>*}}</td>
161
+ </tr>
162
+ {{*<% } %>*}}
163
+ </table>
164
+ </body>
165
+ </html>
166
+ <!-- end -->
167
+
168
+ pierubis: |
169
+ <?xml version="1.0" encoding="UTF-8"?>
170
+ <html>
171
+ <body>
172
+ <table>
173
+ {{*<?rb @list.each_with_index { |user, i| ?>*}}
174
+ {{*<?rb color = i % 2 == 0 ? '#FFCCCC' : '#CCCCFF' ?>*}}
175
+ <tr bgcolor="{{*@!{color}@*}}" title="{{*@!{user.name}@*}}">
176
+ <td>{{*@{user.name}@*}}</td>
177
+ <td>{{*@!{user[:mail]}@*}}</td>
178
+ </tr>
179
+ {{*<?rb } ?>*}}
180
+ </table>
181
+ </body>
182
+ </html>
183
+ <!-- end -->
184
+
126
185
  php: |
127
186
  <{{*<?php ?>*}}?xml version="1.0" encoding="UTF-8"?>
128
187
  <html>
@@ -140,6 +199,7 @@
140
199
  </table>
141
200
  </body>
142
201
  </html>
202
+ <!-- end -->
143
203
 
144
204
  jstl: |
145
205
  {{*<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>*}}
@@ -158,6 +218,7 @@
158
218
  </table>
159
219
  </body>
160
220
  </html>
221
+ <!-- end -->
161
222
 
162
223
  eperl: |
163
224
  <?xml version="1.0" encoding="UTF-8"?>
@@ -176,3 +237,72 @@
176
237
  </table>
177
238
  </body>
178
239
  </html>
240
+ <!-- end -->
241
+
242
+ ##
243
+ - name: embedded_expr1
244
+ desc: embedded expression
245
+ pdata*:
246
+ eruby: |
247
+ <a href="mailto:@!{email}@">@{name}@</a>
248
+ <a href="mailto:<%=email%>"><%=h name%></a>
249
+ ruby: |
250
+ <a href="mailto:@!{email}@">@{name}@</a>
251
+ <a href="mailto:#{email}">#{ERB::Util.h name}</a>
252
+ erubis: |
253
+ <a href="mailto:@!{email}@">@{name}@</a>
254
+ <a href="mailto:<%= email %>"><%== name %></a>
255
+ pierubis: |
256
+ <a href="mailto:@!{email}@">@{name}@</a>
257
+ <a href="mailto:@!{email}@">@{name}@</a>
258
+ <a href="#" id="mark:link_to_destroy">Destroy</a>
259
+ php: |
260
+ <a href="mailto:@!{$email}@">@{$name}@</a>
261
+ <a href="mailto:<?php echo $email; ?>"><?php echo htmlspecialchars($name); ?></a>
262
+ jstl: |
263
+ <a href="mailto:@!{email}@">@{name}@</a>
264
+ <a href="mailto:<c:out value="${email}" escapeXml="false"/>">${name}</a>
265
+ eperl: |
266
+ <a href="mailto:@!{$email}@">@{$name}@</a>
267
+ <a href="mailto:<?= $email !>"><?= encode_entities($name) !></a>
268
+
269
+ plogic*:
270
+ eruby: |
271
+ ruby: |
272
+ erubis: |
273
+ pierubis: |
274
+ #link_to_destroy {
275
+ stag: start_link_tag {:action=>'destroy', :id=>@member.id},
276
+ :confirm=>"Are you OK?";
277
+ }
278
+ php: |
279
+ jstl: |
280
+ eperl: |
281
+
282
+ expected*:
283
+ eruby: |
284
+ <a href="mailto:<%= email %>"><%=h name %></a>
285
+ <a href="mailto:<%=email%>"><%=h name%></a>
286
+ ruby: |
287
+ _buf = ""; _buf << "<a href=\"mailto:"; _buf << (email).to_s; _buf << "\">"; _buf << ERB::Util.h(name); _buf << "</a>
288
+ <a href=\"mailto:#{email}\">#{ERB::Util.h name}</a>\n";
289
+ ; _buf
290
+ erubis: |
291
+ <a href="mailto:<%= email %>"><%== name %></a>
292
+ <a href="mailto:<%= email %>"><%== name %></a>
293
+ pierubis: |
294
+ <a href="mailto:@!{email}@">@{name}@</a>
295
+ <a href="mailto:@!{email}@">@{name}@</a>
296
+ <%=start_link_tag {:action=>'destroy', :id=>@member.id},
297
+ :confirm=>"Are you OK?"%>Destroy</a>
298
+ php: |
299
+ <a href="mailto:<?php echo $email; ?>"><?php echo htmlspecialchars($name); ?></a>
300
+ <a href="mailto:<?php echo $email; ?>"><?php echo htmlspecialchars($name); ?></a>
301
+ jstl: |
302
+ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
303
+ <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
304
+ <a href="mailto:<c:out value="${email}" escapeXml="false"/>">${name}</a>
305
+ <a href="mailto:<c:out value="${email}" escapeXml="false"/>">${name}</a>
306
+ eperl: |
307
+ <a href="mailto:<?= $email !>"><?= encode_entities($name) !></a>
308
+ <a href="mailto:<?= $email !>"><?= encode_entities($name) !></a>