Created
October 27, 2010 14:47
-
-
Save minad/649159 to your computer and use it in GitHub Desktop.
compiled_erb.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
begin;extend Haml::Helpers;_hamlout = @haml_buffer = Haml::Buffer.new(@haml_buffer, {:autoclose=>["meta", "img", "link", "br", "hr", "input", "area", "param", "col", "base"], :preserve=>["textarea", "pre", "code"], :attr_wrapper=>"'", :ugly=>true, :format=>:html5, :encoding=>"UTF-8", :escape_html=>false});_erbout = _hamlout.buffer;__in_erb_template = true;;_hamlout.buffer << "<!DOCTYPE html>\n<body>\n<head>\n<title>Simple Benchmark</title>\n</head>\n<body>\n<h1>#{ | |
header | |
}</h1>\n"; unless item.empty?; | |
_hamlout.buffer << "<ul>\n"; | |
for i in item; | |
if i[:current]; | |
_hamlout.buffer << "<li>\n<strong>#{ | |
i[:name] | |
}</strong>\n</li>\n"; else; | |
_hamlout.buffer << "<li>\n"; | |
_hamlout.open_tag("a", false, true, false, false, {}, false, false, nil, nil, :href => i[:url]);_hamlout.buffer << "#{i[:name] | |
}</a>\n</li>\n";end;end;_hamlout.buffer << "</ul>\n"; else; | |
_hamlout.buffer << "<p>The list is empty.</p>\n";end;_hamlout.buffer << "</body>\n</body>\n";_erbout;ensure;@haml_buffer = @haml_buffer.upper;end; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_buf = [] ; _buf << ("<!DOCTYPE html><body><head><title>Simple Benchmark</title></head><body><h1>"\ | |
""\ | |
""\ | |
""\ | |
""\ | |
""\ | |
"#{header}"\ | |
"</h1>") ; unless item.empty? ; | |
; _buf << ("<ul>") ; | |
; for i in item ; | |
; if i[:current] ; | |
; _buf << ("<li><strong>"\ | |
"#{i[:name]}"\ | |
"</strong></li>") ; else ; | |
; _buf << ("<li><a href=\""\ | |
"#{Slim::Helpers.escape_html((i[:url]))}\">#{i[:name]}"\ | |
"</a></li>") ; end ; end ; _buf << ("</ul>") ; else ; | |
; _buf << ("<p>The list is empty.</p>") ; | |
; end ; _buf << ("</body></body>") ; _buf = _buf.join |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#coding:UTF-8 | |
_erbout = ''; _erbout.concat "<!DOCTYPE HTML>\n\n<html>\n <head>\n <title>Simple Benchmark</title>\n </head>\n <body>\n <h1>" | |
; _erbout.concat(( header ).to_s); _erbout.concat "</h1>\n " | |
; unless item.empty? ; _erbout.concat "\n <ul>\n " | |
; for i in item ; _erbout.concat "\n " | |
; if i[:current] ; _erbout.concat "\n <li><strong>" | |
; _erbout.concat(( i[:name] ).to_s); _erbout.concat "</strong></li>\n " | |
; else ; _erbout.concat "\n <li><a href=\"" | |
; _erbout.concat(( i[:url] ).to_s); _erbout.concat "\">"; _erbout.concat(( i[:name] ).to_s); _erbout.concat "</a></li>\n " | |
; end ; _erbout.concat "\n " | |
; end ; _erbout.concat "\n </ul>\n " | |
; else ; _erbout.concat "\n <p>The list is empty.</p>\n " | |
; end ; _erbout.concat "\n </body>\n</html>" | |
; _erbout.force_encoding(__ENCODING__) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment