diff options
author | makoto kuwata <kwa@kuwata-lab.com> | 2008-05-05 09:50:24 +0000 |
---|---|---|
committer | makoto kuwata <kwa@kuwata-lab.com> | 2008-05-05 09:50:24 +0000 |
commit | d3ffa0d4a00deef963b811d817fe7bae2169e5a3 (patch) | |
tree | 12bcbf6abdd9e414c165893a3c4eacf2c430e528 | |
parent | 9db208853b392333e2dccaf0b684bbfeaa2f48cc (diff) | |
download | erubis-d3ffa0d4a00deef963b811d817fe7bae2169e5a3.tar.gz |
- [update] users-guide
-rw-r--r-- | ChangeLog.txt | 3 | ||||
-rw-r--r-- | doc/users-guide.html | 69 |
2 files changed, 72 insertions, 0 deletions
diff --git a/ChangeLog.txt b/ChangeLog.txt index 713e57c..b13a94a 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -2,6 +2,9 @@ .?lastupdate: $Date$ .?version: $Rev$ +: Rev.107 (2008-05-05) + .- [update] users-guide + : Rev.106 (2008-05-05) .- [update] users-guide .- [refactor] rails_helper.rb: remove debug messages diff --git a/doc/users-guide.html b/doc/users-guide.html index 9cf5065..27bd83f 100644 --- a/doc/users-guide.html +++ b/doc/users-guide.html @@ -153,6 +153,10 @@ It has the following features. </li> <li><a href="#topics">Other Topics</a> <ul> + <li><a href="#'<%= =%>' and '<%= -%>'">'<%= =%>' and '<%= -%>'</a> + </li> + <li><a href="#'<%% %>' and '<%%= %>'">'<%% %>' and '<%%= %>'</a> + </li> <li><a href="#topics-context-vs-binding">evaluate(context) v.s. result(binding)</a> </li> <li><a href="#topics-fasteruby">Class Erubis::FastEruby</a> @@ -2606,6 +2610,64 @@ This means that pp_text_field() with preprocessing makes view layer very fast. <a name="topics"></a> <h2 class="section1">Other Topics</h2> +<a name="'<%= =%>' and '<%= -%>'"></a> +<h3 class="section2">'<%= =%>' and '<%= -%>'</h3> +<p>Since 2.6.0, '<%= -%>' remove tail spaces and newline. +This is for compatibiliy with ERB when trim mode is '-'. +'<%= =%>' also removes tail spaces and newlines, and this is +Erubis-original enhancement (cooler than '<%= -%>', isn't it?). +</p> +<a name="tailnewline.rhtml.comment_filter"></a> +<div class="program_caption"> +tailnewline.rhtml</div> +<pre class="program"><div> +<%= @var -%> # or <%= @var =%> +</div> +</pre> +<div class="terminal_caption"> +result (version 2.5.0):</div> +<pre class="terminal">$ erubis -c '{var: "AAA\n"}' tailnewline.rhtml +<div> +AAA + +</div> +</pre> +<a name="tail_260.result"></a> +<div class="terminal_caption"> +result (version 2.6.0):</div> +<pre class="terminal">$ erubis -c '{var: "AAA\n"}' tailnewline.rhtml +<div> +AAA +</div> +</pre> +<br> + + +<a name="'<%% %>' and '<%%= %>'"></a> +<h3 class="section2">'<%% %>' and '<%%= %>'</h3> +<p>Since 2.6.0, '<%% %>' and '<%%= %>' are converted into '<% %>' and '<%= %>' respectively. +This is for compatibility with ERB. +</p> +<div class="program_caption"> +doublepercent.rhtml:</div> +<pre class="program"><ul> +<%% for item in @list %> + <li><%%= item %></li> +<%% end %> +</ul> +</pre> +<div class="terminal_caption"> +result:</div> +<pre class="terminal">$ erubis doublepercent.rhtml +<ul> +<% for item in @list %> + <li><%= item %></li> +<% end %> +</ul> +</pre> +<br> + + <a name="topics-context-vs-binding"></a> <h3 class="section2">evaluate(context) v.s. result(binding)</h3> <p>It is recommended to use 'Erubis::Eruby#evaluate(context)' instead of 'Erubis::Eruby#result(binding)' because Ruby's Binding object has some problems. @@ -2808,6 +2870,13 @@ if test(?f, cachename) puts "*** cache file '#{cachename}' created." end </pre> +<p>Since 2.6.0, it is able to specify cache filename. +</p> +<div class="program_caption"> +specify cache filename.</div> +<pre class="program">filename = 'example.rhtml' +eruby = Erubis::Eruby.load_file(filename, :cachename=>filename+'.cache') +</pre> <p>Caching makes Erubis about 40-50 percent faster than no-caching. See <a href="#topics-benchmark">benchmark</a> for details. </p> |