- experimental
- allow header and footer in eRuby script
ex.
====================
## without header and footer
$ cat ex1.eruby
<% def list_items(list) %>
<% for item in list %>
<li><%= item %></li>
<% end %>
<% end %>
$ erubis -s ex1.eruby
_buf = []; def list_items(list)
; for item in list
; _buf << '<li>'; _buf << ( item ).to_s; _buf << '</li>
'; end
; end
;
_buf.join
## with header and footer
$ cat ex2.eruby
<!--#header:
def list_items(list)
#-->
<% for item in list %>
<li><%= item %></li>
<% end %>
<!--#footer:
end
#-->
$ erubis -s -c HeaderFooterEruby ex4.eruby
def list_items(list)
_buf = []; _buf << '
'; for item in list
; _buf << '<li>'; _buf << ( item ).to_s; _buf << '</li>
'; end
; _buf << '
';
_buf.join
end
====================
this is language-independent.