erbse 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (159) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +3 -0
  3. data/Gemfile +3 -0
  4. data/README.md +40 -22
  5. data/Rakefile +13 -0
  6. data/lib/erbse.rb +3 -6
  7. data/lib/erbse/converter.rb +41 -241
  8. data/lib/erbse/eruby.rb +114 -0
  9. data/lib/erbse/template.rb +14 -0
  10. data/lib/erbse/version.rb +1 -1
  11. data/test/erbse_test.rb +14 -0
  12. data/test/test_helper.rb +2 -0
  13. metadata +9 -149
  14. data/CHANGES.txt +0 -828
  15. data/bin/erubis +0 -10
  16. data/lib/erbse/context.rb +0 -83
  17. data/lib/erbse/engine.rb +0 -114
  18. data/lib/erbse/engine/ec.rb +0 -117
  19. data/lib/erbse/engine/ecpp.rb +0 -113
  20. data/lib/erbse/engine/ejava.rb +0 -110
  21. data/lib/erbse/engine/ejavascript.rb +0 -119
  22. data/lib/erbse/engine/enhanced.rb +0 -126
  23. data/lib/erbse/engine/eperl.rb +0 -95
  24. data/lib/erbse/engine/ephp.rb +0 -99
  25. data/lib/erbse/engine/eruby.rb +0 -119
  26. data/lib/erbse/engine/escheme.rb +0 -114
  27. data/lib/erbse/engine/optimized.rb +0 -127
  28. data/lib/erbse/enhancer.rb +0 -723
  29. data/lib/erbse/error.rb +0 -23
  30. data/lib/erbse/evaluator.rb +0 -88
  31. data/lib/erbse/generator.rb +0 -85
  32. data/lib/erbse/helper.rb +0 -47
  33. data/lib/erbse/helpers/rails_form_helper.rb +0 -197
  34. data/lib/erbse/helpers/rails_helper.rb +0 -353
  35. data/lib/erbse/main.rb +0 -516
  36. data/lib/erbse/preprocessing.rb +0 -58
  37. data/lib/erbse/tiny.rb +0 -144
  38. data/lib/erbse/util.rb +0 -22
  39. data/test/assert-text-equal.rb +0 -44
  40. data/test/data/users-guide/Example.ejava +0 -55
  41. data/test/data/users-guide/array_example.result +0 -9
  42. data/test/data/users-guide/arraybuffer_example.result +0 -9
  43. data/test/data/users-guide/bipattern-example.rhtml +0 -4
  44. data/test/data/users-guide/bipattern_example.result +0 -6
  45. data/test/data/users-guide/bufvar-example.rb +0 -10
  46. data/test/data/users-guide/bufvar-example.result +0 -17
  47. data/test/data/users-guide/context.rb +0 -6
  48. data/test/data/users-guide/context.yaml +0 -8
  49. data/test/data/users-guide/def_method.rb +0 -14
  50. data/test/data/users-guide/def_method.result +0 -3
  51. data/test/data/users-guide/escape_example.result +0 -9
  52. data/test/data/users-guide/example.ec +0 -27
  53. data/test/data/users-guide/example.ecpp +0 -30
  54. data/test/data/users-guide/example.ejs +0 -20
  55. data/test/data/users-guide/example.eperl +0 -18
  56. data/test/data/users-guide/example.ephp +0 -18
  57. data/test/data/users-guide/example.eruby +0 -6
  58. data/test/data/users-guide/example.escheme +0 -28
  59. data/test/data/users-guide/example1.eruby +0 -6
  60. data/test/data/users-guide/example1.rb +0 -17
  61. data/test/data/users-guide/example1.result +0 -16
  62. data/test/data/users-guide/example10.rb +0 -4
  63. data/test/data/users-guide/example10.result +0 -17
  64. data/test/data/users-guide/example10.xhtml +0 -14
  65. data/test/data/users-guide/example10_x.result +0 -17
  66. data/test/data/users-guide/example11.php +0 -20
  67. data/test/data/users-guide/example11.result +0 -23
  68. data/test/data/users-guide/example11.rhtml +0 -21
  69. data/test/data/users-guide/example11_C.result +0 -10
  70. data/test/data/users-guide/example11_N.result +0 -16
  71. data/test/data/users-guide/example11_U.result +0 -16
  72. data/test/data/users-guide/example11_php.result +0 -15
  73. data/test/data/users-guide/example1_x.result +0 -9
  74. data/test/data/users-guide/example2.eruby +0 -7
  75. data/test/data/users-guide/example2.rb +0 -10
  76. data/test/data/users-guide/example2.result +0 -27
  77. data/test/data/users-guide/example2_trim.result +0 -10
  78. data/test/data/users-guide/example2_x.result +0 -10
  79. data/test/data/users-guide/example3.eruby +0 -6
  80. data/test/data/users-guide/example3.rb +0 -10
  81. data/test/data/users-guide/example31.result +0 -22
  82. data/test/data/users-guide/example32.result +0 -4
  83. data/test/data/users-guide/example3_e.result +0 -8
  84. data/test/data/users-guide/example4.eruby +0 -3
  85. data/test/data/users-guide/example4.rb +0 -11
  86. data/test/data/users-guide/example4.result +0 -10
  87. data/test/data/users-guide/example4_x.result +0 -5
  88. data/test/data/users-guide/example5.eruby +0 -6
  89. data/test/data/users-guide/example5.rb +0 -16
  90. data/test/data/users-guide/example5.result +0 -7
  91. data/test/data/users-guide/example6.rb +0 -12
  92. data/test/data/users-guide/example6.result +0 -7
  93. data/test/data/users-guide/example7.eruby +0 -8
  94. data/test/data/users-guide/example71.result +0 -13
  95. data/test/data/users-guide/example72.result +0 -13
  96. data/test/data/users-guide/example8.eruby +0 -6
  97. data/test/data/users-guide/example8_ruby.result +0 -7
  98. data/test/data/users-guide/example8_yaml.result +0 -7
  99. data/test/data/users-guide/example9.eruby +0 -3
  100. data/test/data/users-guide/example9.rb +0 -8
  101. data/test/data/users-guide/example9.result +0 -9
  102. data/test/data/users-guide/example91.result +0 -5
  103. data/test/data/users-guide/example92.result +0 -4
  104. data/test/data/users-guide/example_c.result +0 -32
  105. data/test/data/users-guide/example_java.result +0 -56
  106. data/test/data/users-guide/example_js.result +0 -22
  107. data/test/data/users-guide/example_perl.result +0 -20
  108. data/test/data/users-guide/example_php.result +0 -19
  109. data/test/data/users-guide/example_scheme.result +0 -30
  110. data/test/data/users-guide/example_scheme_display.result +0 -29
  111. data/test/data/users-guide/fasteruby-example.rb +0 -8
  112. data/test/data/users-guide/fasteruby-example.result +0 -18
  113. data/test/data/users-guide/fasteruby.rb +0 -11
  114. data/test/data/users-guide/fasteruby.result +0 -38
  115. data/test/data/users-guide/fasteruby.rhtml +0 -15
  116. data/test/data/users-guide/headerfooter-example.eruby +0 -9
  117. data/test/data/users-guide/headerfooter-example2.rb +0 -8
  118. data/test/data/users-guide/headerfooter-example2.rhtml +0 -10
  119. data/test/data/users-guide/headerfooter_example.result +0 -11
  120. data/test/data/users-guide/headerfooter_example2.result +0 -13
  121. data/test/data/users-guide/interpolation_example.result +0 -9
  122. data/test/data/users-guide/main_program1.rb +0 -8
  123. data/test/data/users-guide/main_program1.result +0 -6
  124. data/test/data/users-guide/main_program2.rb +0 -8
  125. data/test/data/users-guide/main_program2.result +0 -6
  126. data/test/data/users-guide/nocode-example.eruby +0 -14
  127. data/test/data/users-guide/nocode-php.result +0 -20
  128. data/test/data/users-guide/nocode_example.result +0 -15
  129. data/test/data/users-guide/normal-eruby-test.eruby +0 -9
  130. data/test/data/users-guide/normal_eruby_test.result +0 -11
  131. data/test/data/users-guide/notext-example.eruby +0 -14
  132. data/test/data/users-guide/notext-example.php +0 -19
  133. data/test/data/users-guide/notext-php.result +0 -20
  134. data/test/data/users-guide/notext_example.result +0 -16
  135. data/test/data/users-guide/percentline-example.rhtml +0 -6
  136. data/test/data/users-guide/percentline_example.result +0 -9
  137. data/test/data/users-guide/prefixedline-example.rb +0 -9
  138. data/test/data/users-guide/prefixedline-example.rhtml +0 -6
  139. data/test/data/users-guide/prefixedline_example.result +0 -9
  140. data/test/data/users-guide/printenable_example.result +0 -4
  141. data/test/data/users-guide/printenabled-example.eruby +0 -3
  142. data/test/data/users-guide/printenabled-example.rb +0 -8
  143. data/test/data/users-guide/printstatement_example.result +0 -8
  144. data/test/data/users-guide/simplify_example.result +0 -9
  145. data/test/data/users-guide/stderr.log +0 -3
  146. data/test/data/users-guide/stdout_exmple.result +0 -9
  147. data/test/data/users-guide/stringbuffer_example.result +0 -9
  148. data/test/data/users-guide/tail_260.result +0 -4
  149. data/test/data/users-guide/tailnewline.rhtml +0 -3
  150. data/test/data/users-guide/template1.rhtml +0 -4
  151. data/test/data/users-guide/template2.rhtml +0 -4
  152. data/test/test-engines.rb +0 -425
  153. data/test/test-enhancers.rb +0 -646
  154. data/test/test-erubis.rb +0 -887
  155. data/test/test-index-cgi.rb +0 -191
  156. data/test/test-main.rb +0 -752
  157. data/test/test-users-guide.rb +0 -73
  158. data/test/test.rb +0 -45
  159. data/test/testutil.rb +0 -111
@@ -1,58 +0,0 @@
1
- ###
2
- ### $Release: 2.7.0 $
3
- ### copyright(c) 2006-2011 kuwata-lab.com all rights reserved.
4
- ###
5
-
6
- require 'cgi'
7
-
8
-
9
- module Erubis
10
-
11
-
12
- ##
13
- ## for preprocessing
14
- ##
15
- class PreprocessingEruby < Erubis::Eruby
16
-
17
- def initialize(input, params={})
18
- params = params.dup
19
- params[:pattern] ||= '\[% %\]' # use '[%= %]' instead of '<%= %>'
20
- #params[:escape] = true # transport '[%= %]' and '[%== %]'
21
- super
22
- end
23
-
24
- def add_expr_escaped(src, code)
25
- add_expr_literal(src, "_decode((#{code}))")
26
- end
27
-
28
- end
29
-
30
-
31
- ##
32
- ## helper methods for preprocessing
33
- ##
34
- module PreprocessingHelper
35
-
36
- module_function
37
-
38
- def _p(arg)
39
- return "<%=#{arg}%>"
40
- end
41
-
42
- def _P(arg)
43
- return "<%=h(#{arg})%>"
44
- end
45
-
46
- alias _? _p
47
-
48
- def _decode(arg)
49
- arg = arg.to_s
50
- arg.gsub!(/%3C%25(?:=|%3D)(.*?)%25%3E/) { "<%=#{CGI.unescape($1)}%>" }
51
- arg.gsub!(/&lt;%=(.*?)%&gt;/) { "<%=#{CGI.unescapeHTML($1)}%>" }
52
- return arg
53
- end
54
-
55
- end
56
-
57
-
58
- end
@@ -1,144 +0,0 @@
1
- ##
2
- ## $Release: 2.7.0 $
3
- ## copyright(c) 2006-2011 kuwata-lab.com all rights reserved.
4
- ##
5
-
6
- module Erubis
7
-
8
- ##
9
- ## tiny and the simplest implementation of eRuby
10
- ##
11
- ## ex.
12
- ## eruby = TinyEruby.new(File.read('example.rhtml'))
13
- ## print eruby.src # print ruby code
14
- ## print eruby.result(binding()) # eval ruby code with Binding object
15
- ## print eruby.evalute(context) # eval ruby code with context object
16
- ##
17
- class TinyEruby
18
-
19
- def initialize(input=nil)
20
- @src = convert(input) if input
21
- end
22
- attr_reader :src
23
-
24
- EMBEDDED_PATTERN = /<%(=+|\#)?(.*?)-?%>/m
25
-
26
- def convert(input)
27
- src = "_buf = '';" # preamble
28
- pos = 0
29
- input.scan(EMBEDDED_PATTERN) do |indicator, code|
30
- m = Regexp.last_match
31
- text = input[pos...m.begin(0)]
32
- pos = m.end(0)
33
- #src << " _buf << '" << escape_text(text) << "';"
34
- text.gsub!(/['\\]/, '\\\\\&')
35
- src << " _buf << '" << text << "';" unless text.empty?
36
- if !indicator # <% %>
37
- src << code << ";"
38
- elsif indicator == '#' # <%# %>
39
- src << ("\n" * code.count("\n"))
40
- else # <%= %>
41
- src << " _buf << (" << code << ").to_s;"
42
- end
43
- end
44
- #rest = $' || input # ruby1.8
45
- rest = pos == 0 ? input : input[pos..-1] # ruby1.9
46
- #src << " _buf << '" << escape_text(rest) << "';"
47
- rest.gsub!(/['\\]/, '\\\\\&')
48
- src << " _buf << '" << rest << "';" unless rest.empty?
49
- src << "\n_buf.to_s\n" # postamble
50
- return src
51
- end
52
-
53
- #def escape_text(text)
54
- # return text.gsub!(/['\\]/, '\\\\\&') || text
55
- #end
56
-
57
- def result(_binding=TOPLEVEL_BINDING)
58
- eval @src, _binding
59
- end
60
-
61
- def evaluate(_context=Object.new)
62
- if _context.is_a?(Hash)
63
- _obj = Object.new
64
- _context.each do |k, v| _obj.instance_variable_set("@#{k}", v) end
65
- _context = _obj
66
- end
67
- _context.instance_eval @src
68
- end
69
-
70
- end
71
-
72
-
73
-
74
- module PI
75
- end
76
-
77
- class PI::TinyEruby
78
-
79
- def initialize(input=nil, options={})
80
- @escape = options[:escape] || 'Erubis::XmlHelper.escape_xml'
81
- @src = convert(input) if input
82
- end
83
-
84
- attr_reader :src
85
-
86
- EMBEDDED_PATTERN = /(^[ \t]*)?<\?rb(\s.*?)\?>([ \t]*\r?\n)?|@(!+)?\{(.*?)\}@/m
87
-
88
- def convert(input)
89
- src = "_buf = '';" # preamble
90
- pos = 0
91
- input.scan(EMBEDDED_PATTERN) do |lspace, stmt, rspace, indicator, expr|
92
- match = Regexp.last_match
93
- len = match.begin(0) - pos
94
- text = input[pos, len]
95
- pos = match.end(0)
96
- #src << " _buf << '" << escape_text(text) << "';"
97
- text.gsub!(/['\\]/, '\\\\\&')
98
- src << " _buf << '" << text << "';" unless text.empty?
99
- if stmt # <?rb ... ?>
100
- if lspace && rspace
101
- src << "#{lspace}#{stmt}#{rspace}"
102
- else
103
- src << " _buf << '" << lspace << "';" if lspace
104
- src << stmt << ";"
105
- src << " _buf << '" << rspace << "';" if rspace
106
- end
107
- else # ${...}, $!{...}
108
- if !indicator
109
- src << " _buf << " << @escape << "(" << expr << ");"
110
- elsif indicator == '!'
111
- src << " _buf << (" << expr << ").to_s;"
112
- end
113
- end
114
- end
115
- #rest = $' || input # ruby1.8
116
- rest = pos == 0 ? input : input[pos..-1] # ruby1.9
117
- #src << " _buf << '" << escape_text(rest) << "';"
118
- rest.gsub!(/['\\]/, '\\\\\&')
119
- src << " _buf << '" << rest << "';" unless rest.empty?
120
- src << "\n_buf.to_s\n" # postamble
121
- return src
122
- end
123
-
124
- #def escape_text(text)
125
- # return text.gsub!(/['\\]/, '\\\\\&') || text
126
- #end
127
-
128
- def result(_binding=TOPLEVEL_BINDING)
129
- eval @src, _binding
130
- end
131
-
132
- def evaluate(_context=Object.new)
133
- if _context.is_a?(Hash)
134
- _obj = Object.new
135
- _context.each do |k, v| _obj.instance_variable_set("@#{k}", v) end
136
- _context = _obj
137
- end
138
- _context.instance_eval @src
139
- end
140
-
141
- end
142
-
143
-
144
- end
@@ -1,22 +0,0 @@
1
- ##
2
- ## $Release: 2.7.0 $
3
- ## copyright(c) 2006-2011 kuwata-lab.com all rights reserved.
4
- ##
5
-
6
- module Kernel
7
-
8
- ##
9
- ## raise NotImplementedError
10
- ##
11
- def not_implemented #:doc:
12
- backtrace = caller()
13
- method_name = (backtrace.shift =~ /`(\w+)'$/) && $1
14
- mesg = "class #{self.class.name} must implement abstract method '#{method_name}()'."
15
- #mesg = "#{self.class.name}##{method_name}() is not implemented."
16
- err = NotImplementedError.new mesg
17
- err.set_backtrace backtrace
18
- raise err
19
- end
20
- private :not_implemented
21
-
22
- end
@@ -1,44 +0,0 @@
1
- ###
2
- ### $Release: 2.7.0 $
3
- ### copyright(c) 2006-2011 kuwata-lab.com all rights reserved.
4
- ###
5
-
6
- require 'test/unit'
7
- require 'tempfile'
8
-
9
-
10
- module Test
11
- module Unit
12
- class TestCase
13
-
14
- def assert_text_equal(expected, actual, message=nil, diffopt='-u', flag_cut=true)
15
- if expected == actual
16
- assert(true)
17
- return
18
- end
19
- if expected[-1] != ?\n || actual[-1] != ?\n
20
- expected += "\n"
21
- actual += "\n"
22
- end
23
- begin
24
- expfile = Tempfile.new(".expected.")
25
- expfile.write(expected); expfile.flush()
26
- actfile = Tempfile.new(".actual.")
27
- actfile.write(actual); actfile.flush()
28
- diff = `diff #{diffopt} #{expfile.path} #{actfile.path}`
29
- ensure
30
- expfile.close(true) if expfile
31
- actfile.close(true) if actfile
32
- end
33
- # cut 1st & 2nd lines
34
- message = (flag_cut ? diff.gsub(/\A.*\n.*\n/, '') : diff) unless message
35
- #raise Test::Unit::AssertionFailedError.new(message)
36
- assert_block(message) { false } # or assert(false, message)
37
- end
38
-
39
- alias assert_equal_with_diff assert_text_equal # for compatibility
40
- alias assert_text_equals assert_text_equal # for typo
41
-
42
- end
43
- end
44
- end
@@ -1,55 +0,0 @@
1
- <%
2
- import java.util.*;
3
-
4
- public class Example {
5
- private String user;
6
- private String[] list;
7
- public example(String user, String[] list) {
8
- this.user = user;
9
- this.list = list;
10
- }
11
-
12
- public String view() {
13
- StringBuffer _buf = new StringBuffer();
14
- %>
15
- <html>
16
- <body>
17
- <p>Hello <%= user %>!</p>
18
- <table>
19
- <tbody>
20
- <% for (int i = 0; i < list.length; i++) { %>
21
- <tr bgcolor="<%= i % 2 == 0 ? "#FFCCCC" : "#CCCCFF" %>">
22
- <td><%= i + 1 %></td>
23
- <td><%== list[i] %></td>
24
- </tr>
25
- <% } %>
26
- </tbody>
27
- </table>
28
- <body>
29
- </html>
30
- <%
31
- return _buf.toString();
32
- }
33
-
34
- public static void main(String[] args) {
35
- String[] list = { "<aaa>", "b&b", "\"ccc\"" };
36
- Example ex = Example.new("Erubis", list);
37
- System.out.print(ex.view());
38
- }
39
-
40
- public static String escape(String s) {
41
- StringBuffer sb = new StringBuffer();
42
- for (int i = 0; i < s.length(); i++) {
43
- char ch = s.charAt(i);
44
- switch (ch) {
45
- case '<': sb.append("&lt;"); break;
46
- case '>': sb.append("&gt;"); break;
47
- case '&': sb.append("&amp;"); break;
48
- case '"': sb.append("&quot;"); break;
49
- default: sb.append(ch);
50
- }
51
- }
52
- return sb.toString();
53
- }
54
- }
55
- %>
@@ -1,9 +0,0 @@
1
- $ erubis -xE Array example.eruby
2
- _buf = []; _buf << '<div>
3
- '; for item in list
4
- _buf << ' <p>'; _buf << ( item ).to_s; _buf << '</p>
5
- <p>'; _buf << Erubis::XmlHelper.escape_xml( item ); _buf << '</p>
6
- '; end
7
- _buf << '</div>
8
- ';
9
- _buf
@@ -1,9 +0,0 @@
1
- $ erubis -xE ArrayBuffer example.eruby
2
- _buf = []; _buf << '<div>
3
- '; for item in list
4
- _buf << ' <p>'; _buf << ( item ).to_s; _buf << '</p>
5
- <p>'; _buf << Erubis::XmlHelper.escape_xml( item ); _buf << '</p>
6
- '; end
7
- _buf << '</div>
8
- ';
9
- _buf.join
@@ -1,4 +0,0 @@
1
- <% for item in list %>
2
- <b>[= item =]</b>
3
- <b>[== item =]</b>
4
- <% end %>
@@ -1,6 +0,0 @@
1
- $ erubis -xE BiPattern bipattern-example.rhtml
2
- _buf = ''; for item in list
3
- _buf << ' <b>'; _buf << ( item ).to_s; _buf << '</b>
4
- <b>'; _buf << Erubis::XmlHelper.escape_xml( item ); _buf << '</b>
5
- '; end
6
- _buf.to_s
@@ -1,10 +0,0 @@
1
- require 'erubis'
2
- input = File.read('example.eruby')
3
-
4
- puts "----- default -----"
5
- eruby = Erubis::FastEruby.new(input)
6
- puts eruby.src
7
-
8
- puts "----- with :bufvar option -----"
9
- eruby = Erubis::FastEruby.new(input, :bufvar=>'@_out_buf')
10
- print eruby.src
@@ -1,17 +0,0 @@
1
- $ ruby bufvar-example.rb
2
- ----- default -----
3
- _buf = ''; _buf << %Q`<div>\n`
4
- for item in list
5
- _buf << %Q` <p>#{ item }</p>
6
- <p>#{Erubis::XmlHelper.escape_xml( item )}</p>\n`
7
- end
8
- _buf << %Q`</div>\n`
9
- _buf.to_s
10
- ----- with :bufvar option -----
11
- @_out_buf = ''; @_out_buf << %Q`<div>\n`
12
- for item in list
13
- @_out_buf << %Q` <p>#{ item }</p>
14
- <p>#{Erubis::XmlHelper.escape_xml( item )}</p>\n`
15
- end
16
- @_out_buf << %Q`</div>\n`
17
- @_out_buf.to_s
@@ -1,6 +0,0 @@
1
- @title = 'Users List'
2
- @users = [
3
- { 'name'=>'foo', 'mail'=>'foo@mail.com' },
4
- { 'name'=>'bar', 'mail'=>'bar@mail.net' },
5
- { 'name'=>'baz', 'mail'=>'baz@mail.org' },
6
- ]
@@ -1,8 +0,0 @@
1
- title: Users List
2
- users:
3
- - name: foo
4
- mail: foo@mail.com
5
- - name: bar
6
- mail: bar@mail.net
7
- - name: baz
8
- mail: baz@mail.org
@@ -1,14 +0,0 @@
1
- require 'erubis'
2
- s = "hello <%= name %>"
3
- eruby = Erubis::Eruby.new(s)
4
- filename = 'hello.rhtml'
5
-
6
- ## define instance method to Dummy class (or module)
7
- class Dummy; end
8
- eruby.def_method(Dummy, 'render(name)', filename) # filename is optional
9
- p Dummy.new.render('world') #=> "hello world"
10
-
11
- ## define singleton method to dummy object
12
- obj = Object.new
13
- eruby.def_method(obj, 'render(name)', filename) # filename is optional
14
- p obj.render('world') #=> "hello world"
@@ -1,3 +0,0 @@
1
- $ ruby def_method.rb
2
- "hello world"
3
- "hello world"
@@ -1,9 +0,0 @@
1
- $ erubis -xE Escape example.eruby
2
- _buf = ''; _buf << '<div>
3
- '; for item in list
4
- _buf << ' <p>'; _buf << Erubis::XmlHelper.escape_xml( item ); _buf << '</p>
5
- <p>'; _buf << ( item ).to_s; _buf << '</p>
6
- '; end
7
- _buf << '</div>
8
- ';
9
- _buf.to_s
@@ -1,27 +0,0 @@
1
- <%
2
- #include <stdio.h>
3
-
4
- int main(int argc, char *argv[])
5
- {
6
- int i;
7
-
8
- %>
9
- <html>
10
- <body>
11
- <p>Hello <%= "%s", argv[0] %>!</p>
12
- <table>
13
- <tbody>
14
- <% for (i = 1; i < argc; i++) { %>
15
- <tr bgcolor="<%= i % 2 == 0 ? "#FFCCCC" : "#CCCCFF" %>">
16
- <td><%= "%d", i %></td>
17
- <td><%= "%s", argv[i] %></td>
18
- </tr>
19
- <% } %>
20
- </tbody>
21
- </table>
22
- </body>
23
- </html>
24
- <%
25
- return 0;
26
- }
27
- %>