diff options
author | (no author) <(no author)@c9e70521-770b-0410-b9ac-ce6205b42a9f> | 2007-02-11 05:15:33 +0000 |
---|---|---|
committer | (no author) <(no author)@c9e70521-770b-0410-b9ac-ce6205b42a9f> | 2007-02-11 05:15:33 +0000 |
commit | ed19bab600e363c2fa8c4b99f622795b2ac22656 (patch) | |
tree | 56f7ff9053cfaecd38ee0b03ddb35f08aa4dc732 /benchmark | |
parent | ebddcd7c58d624e4d50599800500efa31960724d (diff) | |
download | erubis-ed19bab600e363c2fa8c4b99f622795b2ac22656.tar.gz |
- [release] release preparation
Diffstat (limited to 'benchmark')
-rw-r--r-- | benchmark/erubybench.rb | 11 | ||||
-rw-r--r-- | benchmark/erubybench.rhtml (renamed from benchmark/templates/_header.html) | 33 | ||||
-rw-r--r-- | benchmark/templates/_footer.html | 4 | ||||
-rw-r--r-- | benchmark/templates/erubybench.rhtml | 29 |
4 files changed, 37 insertions, 40 deletions
diff --git a/benchmark/erubybench.rb b/benchmark/erubybench.rb index 066fd73..663da10 100644 --- a/benchmark/erubybench.rb +++ b/benchmark/erubybench.rb @@ -10,9 +10,9 @@ require 'stringio' require 'cgi' include ERB::Util #module ERB::Util -# XmlEscapeTable = { '&'=>'&', '<'=>'<', '>'=>'>', '"'=>'"' } +# ESCAPE_TABLE = { '&'=>'&', '<'=>'<', '>'=>'>', '"'=>'"', "'"=>''', } # def h(value) -# value.to_s.gsub(/[&<>"]/) { |s| XmlEscapeTable[s] } +# value.to_s.gsub(/[&<>"]/) { |s| ESCAPE_TABLE[s] } # end # module_function :h #end @@ -164,10 +164,7 @@ def File.write(filename, str) end # if $erubyfile == defaults[:erubyfile] - header = File.read("templates/_header.html") - footer = File.read("templates/_footer.html") - body = File.read("templates/#{$erubyfile}") - erubystr = header + body + footer + erubystr = File.read($erubyfile) s = erubystr erubystrs = {} if $escape @@ -180,7 +177,7 @@ if $erubyfile == defaults[:erubyfile] erubystrs['eruby'] = s erubystrs['ERB'] = s erubystrs['Erubis'] = s - erubystrs['Tiny'] = s + erubystrs['Tiny'] = s erubystrs['PI'] = s.gsub(/<%=(.*?)%>/, '@!{\1}@').gsub(/<%(.*?)%>/m, '<?rb\1?>') end else diff --git a/benchmark/templates/_header.html b/benchmark/erubybench.rhtml index e7c2dcc..5343ffe 100644 --- a/benchmark/templates/_header.html +++ b/benchmark/erubybench.rhtml @@ -50,3 +50,36 @@ thead { <th>#</th><th>code</th><th>name</th><th>price</th><th>change</th><th>ratio</th> </tr> </thead> + <tbody> +<% + n = 0 + for item in list + n += 1 + %> + <tr class="<%= n % 2 == 0 ? 'even' : 'odd' %>"> + <td style="text-align: center"><%= n %></td> + <td> + <a href="/stocks/<%= item['code'] %>"><%= item['code'] %></a> + </td> + <td> + <a href="<%= item['url'] %>"><%= item['name'] %></a> + </td> + <td> + <strong><%= item['price'] %></strong> + </td> + <% if item['change'] < 0.0 %> + <td class="minus"><%= item['change'] %></td> + <td class="minus"><%= item['ratio'] %></td> + <% else %> + <td><%= item['change'] %></td> + <td><%= item['ratio'] %></td> + <% end %> + </tr> +<% + end + %> + </tbody> + </table> + + </body> +</html> diff --git a/benchmark/templates/_footer.html b/benchmark/templates/_footer.html deleted file mode 100644 index 3ae6d4d..0000000 --- a/benchmark/templates/_footer.html +++ /dev/null @@ -1,4 +0,0 @@ - </table> - - </body> -</html> diff --git a/benchmark/templates/erubybench.rhtml b/benchmark/templates/erubybench.rhtml deleted file mode 100644 index de6f188..0000000 --- a/benchmark/templates/erubybench.rhtml +++ /dev/null @@ -1,29 +0,0 @@ - <tbody> -<% - n = 0 - for item in list - n += 1 - %> - <tr class="<%= n % 2 == 0 ? 'even' : 'odd' %>"> - <td style="text-align: center"><%= n %></td> - <td> - <a href="/stocks/<%= item['code'] %>"><%= item['code'] %></a> - </td> - <td> - <a href="<%= item['url'] %>"><%= item['name'] %></a> - </td> - <td> - <strong><%= item['price'] %></strong> - </td> - <% if item['change'] < 0.0 %> - <td class="minus"><%= item['change'] %></td> - <td class="minus"><%= item['ratio'] %></td> - <% else %> - <td><%= item['change'] %></td> - <td><%= item['ratio'] %></td> - <% end %> - </tr> -<% - end - %> - </tbody> |