summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormakoto kuwata <kwa@kuwata-lab.com>2011-03-21 11:26:35 +0900
committermakoto kuwata <kwa@kuwata-lab.com>2011-03-21 11:26:35 +0900
commita383bfd0df0007acb79b0928f33bcf7a91df79c9 (patch)
treef32966fd976137dd2864e37dbff1d019eb8dac11
parent47994bfde26d4caa118c056e76b2f551119d71dc (diff)
downloaderubis-a383bfd0df0007acb79b0928f33bcf7a91df79c9.tar.gz
[update] 'doc/users-guide.{txt,html}'
-rw-r--r--doc/users-guide.html220
-rw-r--r--doc/users-guide.txt200
2 files changed, 393 insertions, 27 deletions
diff --git a/doc/users-guide.html b/doc/users-guide.html
index 56213d2..82aaf31 100644
--- a/doc/users-guide.html
+++ b/doc/users-guide.html
@@ -13,11 +13,6 @@
<div class="mainbody">
<div align="left"><h1>Erubis Users' Guide</h1></div>
- <div align="left">
- release: $Release$<br>
- last update: $Date$<br>
- </div>
-
<p>release: $Release$
</p>
<a name="preface"></a>
@@ -117,6 +112,8 @@ Erubis now supports Ruby 1.9.
</li>
<li><a href="#percentline-enhancer">PercentLineEnhancer</a>
</li>
+ <li><a href="#prefixedline-enhancer">PrefixedLineEnhancer</a>
+ </li>
<li><a href="#headerfooter-enhancer">HeaderFooterEnhancer</a>
</li>
<li><a href="#interpolation-enhancer">InterpolationEnhancer</a>
@@ -155,9 +152,13 @@ Erubis now supports Ruby 1.9.
</li>
<li><a href="#topics">Other Topics</a>
<ul>
- <li><a href="#'&lt;%= =%&gt;' and '&lt;%= -%&gt;'">'&lt;%= =%&gt;' and '&lt;%= -%&gt;'</a>
+ <li><a href="#topics-fasteruby"><code>Erubis::FastEruby</code> Class</a>
+ </li>
+ <li><a href="#topics-bufname"><code>:bufname</code> Option</a>
</li>
- <li><a href="#'&lt;%% %&gt;' and '&lt;%%= %&gt;'">'&lt;%% %&gt;' and '&lt;%%= %&gt;'</a>
+ <li><a href="#topics-trimspaces">'&lt;%= =%&gt;' and '&lt;%= -%&gt;'</a>
+ </li>
+ <li><a href="#topics-doublepercent">'&lt;%% %&gt;' and '&lt;%%= %&gt;'</a>
</li>
<li><a href="#topics-context-vs-binding">evaluate(context) v.s. result(binding)</a>
</li>
@@ -173,6 +174,8 @@ Erubis now supports Ruby 1.9.
</li>
<li><a href="#topcs-modruby">Helper Class for mod_ruby</a>
</li>
+ <li><a href="#topics-index-cgi">Helper CGI Script for Apache</a>
+ </li>
<li><a href="#topics-defmethod">Define method</a>
</li>
<li><a href="#topics-benchmark">Benchmark</a>
@@ -1638,19 +1641,23 @@ This is for compatibility with eruby and ERB.
<a name="percentline-example.rhtml"></a>
<div class="program_caption">
percentline-example.rhtml</div>
-<pre class="program"><strong>% for item in list</strong>
- &lt;b&gt;&lt;%= item %&gt;&lt;/b&gt;
+<pre class="program">&lt;ul&gt;
+<strong>% for item in list</strong>
+ &lt;li&gt;&lt;%= item %&gt;&lt;/li&gt;
<strong>% end</strong>
-%% lines with '%%'
+&lt;/ul&gt;
+<strong>%% lines with '%%'</strong>
</pre>
<a name="percentline_example.result"></a>
<div class="terminal_caption">
compiled source code</div>
<pre class="terminal">$ erubis -xE PercentLine percentline-example.rhtml
-_buf = ''; <strong>for item in list</strong>
- _buf &lt;&lt; ' &lt;b&gt;'; _buf &lt;&lt; ( item ).to_s; _buf &lt;&lt; '&lt;/b&gt;
+_buf = ''; _buf &lt;&lt; '&lt;ul&gt;
+'; <strong>for item in list</strong>
+ _buf &lt;&lt; ' &lt;li&gt;'; _buf &lt;&lt; ( item ).to_s; _buf &lt;&lt; '&lt;/li&gt;
'; <strong>end</strong>
- _buf &lt;&lt; '% lines with \'%%\'
+ _buf &lt;&lt; '&lt;/ul&gt;
+<strong>% lines with \'%%\'</strong>
';
_buf.to_s
</pre>
@@ -1659,6 +1666,58 @@ _buf.to_s
<br>
+<a name="prefixedline-enhancer"></a>
+<h3 class="section2">PrefixedLineEnhancer</h3>
+<p>PrefixedlineEnhancer regards lines starting with '%' as Ruby code.
+It is similar to <a href="#percentline-enhancer">PercentLineEnhancer</a>, but there are some differences.
+</p>
+<ul type="disc">
+<li>PrefixedlineEnhancer allows to indent lines starting with '%', but PercentLineEnhancer doesn't.
+</li>
+<li>PrefixedlineEnhancer allows to change prefixed character (default '%'), but PercentLineEnhancer doesn't.
+</li>
+</ul>
+<a name="prefixedline-example.rhtml"></a>
+<div class="program_caption">
+prefixedline-example.rhtml</div>
+<pre class="program">&lt;ul&gt;
+ <strong>! for item in list</strong>
+ &lt;li&gt;&lt;%= item %&gt;&lt;/li&gt;
+ <strong>! end</strong>
+&lt;/ul&gt;
+ <strong>!! lines with '!!'</strong>
+</pre>
+<a name="prefixedline-example.rb"></a>
+<div class="program_caption">
+prefixedline-example.rb</div>
+<pre class="program">require 'erubis'
+
+class PrefixedLineEruby &lt; Erubis::Eruby
+ include Erubis::PrefixedLineEnhancer
+end
+
+input = File.read('prefixedline-example.rhtml')
+eruby = PrefixedLineEruby.new(input, :prefixchar=&gt;'!') # default '%'
+print eruby.src
+</pre>
+<a name="prefixedline_example.result"></a>
+<div class="terminal_caption">
+compiled source code</div>
+<pre class="terminal">$ ruby prefixedline-example.rb
+_buf = ''; _buf &lt;&lt; '&lt;ul&gt;
+'; <strong>for item in list</strong>
+ _buf &lt;&lt; ' &lt;li&gt;'; _buf &lt;&lt; ( item ).to_s; _buf &lt;&lt; '&lt;/li&gt;
+'; <strong>end</strong>
+ _buf &lt;&lt; '&lt;/ul&gt;
+ <strong>! lines with \'!!\'</strong>
+';
+_buf.to_s
+</pre>
+<p>PrefixedLineEnhancer is language-independent.
+</p>
+<br>
+
+
<a name="headerfooter-enhancer"></a>
<h3 class="section2">HeaderFooterEnhancer</h3>
<p>[experimental]
@@ -2206,7 +2265,7 @@ compiled source code (with <code>--func=display</code> property)</div>
<h3 class="section2">Perl</h3>
<a name="example.eperl"></a>
<div class="program_caption">
-example.eprl</div>
+example.eperl</div>
<pre class="program"><strong>&lt;%
my $user = 'Erubis';
my @list = ('&lt;aaa&gt;', 'b&amp;b', '"ccc"');
@@ -2326,6 +2385,8 @@ engine = Erubis::Ejavascript.new(s, <code>:docwrite=&gt;false</code>)
<a name="rails"></a>
<h2 class="section1">Ruby on Rails Support</h2>
+<p><span style="color:#FF0000">NOTICE: Rails 3 adopts Erubis as default default engine. You don't need to do anything at all when using Rails 3. This section is for Rails 2.</span>
+</p>
<p>Erubis supports Ruby on Rails.
This section describes how to use Erubis with Ruby on Rails.
</p>
@@ -2613,7 +2674,92 @@ 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="'&lt;%= =%&gt;' and '&lt;%= -%&gt;'"></a>
+<a name="topics-fasteruby"></a>
+<h3 class="section2"><code>Erubis::FastEruby</code> Class</h3>
+<p><code>Erubis::FastEruby</code> class generates more effective code than <code>Erubis::Eruby</code>.
+</p>
+<a name="fasteruby-example.rb"></a>
+<div class="program_caption">
+fasteruby-example.rb</div>
+<pre class="program">require 'erubis'
+input = File.read('example.eruby')
+
+puts "----- Erubis::Eruby -----"
+print Erubis::Eruby.new(input).src
+
+puts "----- Erubis::FastEruby -----"
+print <strong>Erubis::FastEruby</strong>.new(input).src
+</pre>
+<a name="fasteruby-example.result"></a>
+<div class="terminal_caption">
+result</div>
+<pre class="terminal">$ ruby fasteruby-example.rb
+----- Erubis::Eruby -----
+_buf = ''; _buf &lt;&lt; '&lt;div&gt;
+'; for item in list
+ _buf &lt;&lt; ' &lt;p&gt;'; <strong>_buf &lt;&lt; ( item ).to_s;</strong> _buf &lt;&lt; '&lt;/p&gt;
+ &lt;p&gt;'; <strong>_buf &lt;&lt; Erubis::XmlHelper.escape_xml( item );</strong> _buf &lt;&lt; '&lt;/p&gt;
+'; end
+ _buf &lt;&lt; '&lt;/div&gt;
+';
+_buf.to_s
+----- Erubis::FastEruby -----
+_buf = ''; _buf &lt;&lt; %Q`&lt;div&gt;\n`
+ for item in list
+ _buf &lt;&lt; %Q` &lt;p&gt;<strong>#{ item }</strong>&lt;/p&gt;
+ &lt;p&gt;<strong>#{Erubis::XmlHelper.escape_xml( item )}</strong>&lt;/p&gt;\n`
+ end
+ _buf &lt;&lt; %Q`&lt;/div&gt;\n`
+_buf.to_s
+</pre>
+<p>Technically, <code>Erubis::FastEruby</code> is just a subclass of <code>Erubis::Eruby</code> and includes <code><a href="#interpolation-enhancer">InterpolationEnhancer</a></code>. <code>Erubis::FastEruby</code> is faster than <code>Erubis::Eruby</code> but is not extensible compared to <code>Erubis::Eruby</code>. This is the reason why <code>Erubis::FastEruby</code> is not the default class of Erubis.
+</p>
+<br>
+
+
+<a name="topics-bufname"></a>
+<h3 class="section2"><code>:bufname</code> Option</h3>
+<p>Since 2.7.0, Erubis supports <code>:bufname</code> option which allows you to change buffer variable name (default '<code>_buf</code>').
+</p>
+<a name="bufname-example.rb"></a>
+<div class="program_caption">
+bufname-example.rb</div>
+<pre class="program">require 'erubis'
+input = File.read('example.eruby')
+
+puts "----- default -----"
+eruby = Erubis::FastEruby.new(input)
+puts eruby.src
+
+puts "----- with :bufname option -----"
+eruby = Erubis::FastEruby.new(input, <strong>:bufname=&gt;'@_out_buf'</strong>)
+print eruby.src
+</pre>
+<a name="bufname-example.result"></a>
+<div class="terminal_caption">
+result</div>
+<pre class="terminal">$ ruby bufname-example.rb
+----- default -----
+_buf = ''; _buf &lt;&lt; %Q`&lt;div&gt;\n`
+ for item in list
+ _buf &lt;&lt; %Q` &lt;p&gt;#{ item }&lt;/p&gt;
+ &lt;p&gt;#{Erubis::XmlHelper.escape_xml( item )}&lt;/p&gt;\n`
+ end
+ _buf &lt;&lt; %Q`&lt;/div&gt;\n`
+_buf.to_s
+----- with :bufname option -----
+<strong>@_out_buf</strong> = ''; <strong>@_out_buf</strong> &lt;&lt; %Q`&lt;div&gt;\n`
+ for item in list
+ <strong>@_out_buf</strong> &lt;&lt; %Q` &lt;p&gt;#{ item }&lt;/p&gt;
+ &lt;p&gt;#{Erubis::XmlHelper.escape_xml( item )}&lt;/p&gt;\n`
+ end
+ <strong>@_out_buf</strong> &lt;&lt; %Q`&lt;/div&gt;\n`
+<strong>@_out_buf</strong>.to_s
+</pre>
+<br>
+
+
+<a name="topics-trimspaces"></a>
<h3 class="section2">'&lt;%= =%&gt;' and '&lt;%= -%&gt;'</h3>
<p>Since 2.6.0, '&lt;%= -%&gt;' remove tail spaces and newline.
This is for compatibiliy with ERB when trim mode is '-'.
@@ -2646,7 +2792,7 @@ AAA
<br>
-<a name="'&lt;%% %&gt;' and '&lt;%%= %&gt;'"></a>
+<a name="topics-doublepercent"></a>
<h3 class="section2">'&lt;%% %&gt;' and '&lt;%%= %&gt;'</h3>
<p>Since 2.6.0, '&lt;%% %&gt;' and '&lt;%%= %&gt;' are converted into '&lt;% %&gt;' and '&lt;%= %&gt;' respectively.
This is for compatibility with ERB.
@@ -3039,6 +3185,48 @@ in the same directory in which '*.rhtml' file exists.
<br>
+<a name="topics-index-cgi"></a>
+<h3 class="section2">Helper CGI Script for Apache</h3>
+<p>Erubis provides helper CGI script for Apache.
+Using this script, it is very easy to publish *.rhtml files as *.html.
+</p>
+<pre class="terminal">### install Erubis
+$ tar xzf erubis-X.X.X.tar.gz
+$ cd erubis-X.X.X/
+$ ruby setup.py install
+### copy files to ~/public_html
+$ mkdir -p ~/public_html
+$ cp public_html/_htaccess ~/public_html/.htaccess
+$ cp public_html/index.cgi ~/public_html/
+$ cp public_html/index.rhtml ~/public_html/
+### add executable permission to index.cgi
+$ chmod a+x ~/public_html/index.cgi
+### edit .htaccess
+$ vi ~/public_html/.htaccess
+### (optional) edit index.cgi to configure
+$ vi ~/public_html/index.cgi
+</pre>
+<p>Edit ~/public_html/.htaccess and modify user name.
+</p>
+<div class="program_caption">
+~/public_html/.htaccess</div>
+<pre class="program">## enable mod_rewrie
+RewriteEngine on
+## deny access to *.rhtml and *.cache
+#RewriteRule \.(rhtml|cache)$ - [R=404,L]
+RewriteRule \.(rhtml|cache)$ - [F,L]
+## rewrite only if requested file is not found
+RewriteCond %{SCRIPT_FILENAME} !-f
+## handle request to *.html and directories by index.cgi
+RewriteRule (\.html|/|^)$ /~<strong>username</strong>/index.cgi
+#RewriteRule (\.html|/|^)$ index.cgi
+</pre>
+<p>After these steps, *.rhtml will be published as *.html.
+For example, if you access to <code>http://<em>host</em>.<em>domain</em>/~<em>username</em>/index.html</code> (or <code>http://<em>host</em>.<em>domain</em>/~<em>username</em>/</code>), file <code>~/public_html/index.rhtml</code> will be displayed.
+</p>
+<br>
+
+
<a name="topics-defmethod"></a>
<h3 class="section2">Define method</h3>
<p>Erubis::Eruby#def_method() defines instance method or singleton method.
diff --git a/doc/users-guide.txt b/doc/users-guide.txt
index da64462..2e48d2f 100644
--- a/doc/users-guide.txt
+++ b/doc/users-guide.txt
@@ -1,7 +1,7 @@
.=title: Erubis Users' Guide
-.?version: $Release$
-.?release: $Release$
-.?lastupdate: $Date$
+.#.?version: $Release$
+.#.?release: $Release$
+.#.?lastupdate: $Date$
.?stylesheet: docstyle.css
release: $Release$
@@ -1661,10 +1661,12 @@ This is for compatibility with eruby and ERB.
.? percentline-example.rhtml
.-------------------- percentline-example.rhtml
+<ul>
{{*% for item in list*}}
- <b><%= item %></b>
+ <li><%= item %></li>
{{*% end*}}
-%% lines with '%%'
+</ul>
+{{*%% lines with '%%'*}}
.--------------------
.#.? percentline-example.rb
@@ -1689,10 +1691,12 @@ This is for compatibility with eruby and ERB.
.==================== percentline_example.result
$ erubis -xE PercentLine percentline-example.rhtml
.#.<<<:! erubis -xE PercentLine guide.d/percentline-example.rhtml | ruby -pe 'sub! /for.*?list|end/, "{{*\\&*}}"'
-_buf = ''; {{*for item in list*}}
- _buf << ' <b>'; _buf << ( item ).to_s; _buf << '</b>
+_buf = ''; _buf << '<ul>
+'; {{*for item in list*}}
+ _buf << ' <li>'; _buf << ( item ).to_s; _buf << '</li>
'; {{*end*}}
- _buf << '% lines with \'%%\'
+ _buf << '</ul>
+{{*% lines with \'%%\'*}}
';
_buf.to_s
.====================
@@ -1701,6 +1705,55 @@ PercentLineEnhancer is language-independent.
+.$$ PrefixedLineEnhancer | prefixedline-enhancer
+
+PrefixedlineEnhancer regards lines starting with '%' as Ruby code.
+It is similar to {{<PercentLineEnhancer|#percentline-enhancer>}}, but there are some differences.
+
+.* PrefixedlineEnhancer allows to indent lines starting with '%', but PercentLineEnhancer doesn't.
+.* PrefixedlineEnhancer allows to change prefixed character (default '%'), but PercentLineEnhancer doesn't.
+
+
+.? prefixedline-example.rhtml
+.-------------------- prefixedline-example.rhtml
+<ul>
+ {{*! for item in list*}}
+ <li><%= item %></li>
+ {{*! end*}}
+</ul>
+ {{*!! lines with '!!'*}}
+.--------------------
+
+.? prefixedline-example.rb
+.-------------------- prefixedline-example.rb
+require 'erubis'
+
+class PrefixedLineEruby < Erubis::Eruby
+ include Erubis::PrefixedLineEnhancer
+end
+
+input = File.read('prefixedline-example.rhtml')
+eruby = PrefixedLineEruby.new(input, :prefixchar=>'!') # default '%'
+print eruby.src
+.--------------------
+
+.? compiled source code
+.==================== prefixedline_example.result
+$ ruby prefixedline-example.rb
+_buf = ''; _buf << '<ul>
+'; {{*for item in list*}}
+ _buf << ' <li>'; _buf << ( item ).to_s; _buf << '</li>
+'; {{*end*}}
+ _buf << '</ul>
+ {{*! lines with \'!!\'*}}
+';
+_buf.to_s
+.====================
+
+PrefixedLineEnhancer is language-independent.
+
+
+
.$$ HeaderFooterEnhancer | headerfooter-enhancer
[experimental]
@@ -2291,7 +2344,7 @@ $ erubis -l scheme --func=display example.escheme
.$$ Perl | lang-perl
-.? example.eprl
+.? example.eperl
.-------------------- example.eperl
{{*<%
my $user = 'Erubis';
@@ -2418,6 +2471,8 @@ Notice that default value of 'docwrite' property will be false in the future rel
.$ Ruby on Rails Support | rails
+{{!NOTICE: Rails 3 adopts Erubis as default default engine. You don't need to do anything at all when using Rails 3. This section is for Rails 2.!}}
+
Erubis supports Ruby on Rails.
This section describes how to use Erubis with Ruby on Rails.
@@ -2729,7 +2784,88 @@ Notice that pp_form_for() is not provided.
.$ Other Topics | topics
-.$$ '<%= =%>' and '<%= -%>'
+.$$ {{,Erubis::FastEruby,}} Class | topics-fasteruby
+
+{{,Erubis::FastEruby,}} class generates more effective code than {{,Erubis::Eruby,}}.
+
+.? fasteruby-example.rb
+.-------------------- fasteruby-example.rb
+require 'erubis'
+input = File.read('example.eruby')
+
+puts "----- Erubis::Eruby -----"
+print Erubis::Eruby.new(input).src
+
+puts "----- Erubis::FastEruby -----"
+print {{*Erubis::FastEruby*}}.new(input).src
+.--------------------
+
+.? result
+.==================== fasteruby-example.result
+$ ruby fasteruby-example.rb
+----- Erubis::Eruby -----
+_buf = ''; _buf << '<div>
+'; for item in list
+ _buf << ' <p>'; {{*_buf << ( item ).to_s;*}} _buf << '</p>
+ <p>'; {{*_buf << Erubis::XmlHelper.escape_xml( item );*}} _buf << '</p>
+'; end
+ _buf << '</div>
+';
+_buf.to_s
+----- Erubis::FastEruby -----
+_buf = ''; _buf << %Q`<div>\n`
+ for item in list
+ _buf << %Q` <p>{{*#{ item }*}}</p>
+ <p>{{*#{Erubis::XmlHelper.escape_xml( item )}*}}</p>\n`
+ end
+ _buf << %Q`</div>\n`
+_buf.to_s
+.====================
+
+Technically, {{,Erubis::FastEruby,}} is just a subclass of {{,Erubis::Eruby,}} and includes {{,{{<InterpolationEnhancer|#interpolation-enhancer>}},}}. {{,Erubis::FastEruby,}} is faster than {{,Erubis::Eruby,}} but is not extensible compared to {{,Erubis::Eruby,}}. This is the reason why {{,Erubis::FastEruby,}} is not the default class of Erubis.
+
+
+.$$ {{,:bufname,}} Option | topics-bufname
+
+Since 2.7.0, Erubis supports {{,:bufname,}} option which allows you to change buffer variable name (default '{{,_buf,}}').
+
+.? bufname-example.rb
+.-------------------- bufname-example.rb
+require 'erubis'
+input = File.read('example.eruby')
+
+puts "----- default -----"
+eruby = Erubis::FastEruby.new(input)
+puts eruby.src
+
+puts "----- with :bufname option -----"
+eruby = Erubis::FastEruby.new(input, {{*:bufname=>'@_out_buf'*}})
+print eruby.src
+.--------------------
+
+.? result
+.==================== bufname-example.result
+$ ruby bufname-example.rb
+----- default -----
+_buf = ''; _buf << %Q`<div>\n`
+ for item in list
+ _buf << %Q` <p>#{ item }</p>
+ <p>#{Erubis::XmlHelper.escape_xml( item )}</p>\n`
+ end
+ _buf << %Q`</div>\n`
+_buf.to_s
+----- with :bufname option -----
+{{*@_out_buf*}} = ''; {{*@_out_buf*}} << %Q`<div>\n`
+ for item in list
+ {{*@_out_buf*}} << %Q` <p>#{ item }</p>
+ <p>#{Erubis::XmlHelper.escape_xml( item )}</p>\n`
+ end
+ {{*@_out_buf*}} << %Q`</div>\n`
+{{*@_out_buf*}}.to_s
+.====================
+
+
+.$$ '<%= =%>' and '<%= -%>' | topics-trimspaces
Since 2.6.0, '<%= -%>' remove tail spaces and newline.
This is for compatibiliy with ERB when trim mode is '-'.
@@ -2761,7 +2897,7 @@ AAA
.====================
-.$$ '<%% %>' and '<%%= %>'
+.$$ '<%% %>' and '<%%= %>' | topics-doublepercent
Since 2.6.0, '<%% %>' and '<%%= %>' are converted into '<% %>' and '<%= %>' respectively.
This is for compatibility with ERB.
@@ -3148,6 +3284,48 @@ Apache::ErubisRun calls Erubis::Eruby.load_file() internally which creates cache
in the same directory in which '*.rhtml' file exists.
+.$$ Helper CGI Script for Apache | topics-index-cgi
+
+Erubis provides helper CGI script for Apache.
+Using this script, it is very easy to publish *.rhtml files as *.html.
+
+.====================
+### install Erubis
+$ tar xzf erubis-X.X.X.tar.gz
+$ cd erubis-X.X.X/
+$ ruby setup.py install
+### copy files to ~/public_html
+$ mkdir -p ~/public_html
+$ cp public_html/_htaccess ~/public_html/.htaccess
+$ cp public_html/index.cgi ~/public_html/
+$ cp public_html/index.rhtml ~/public_html/
+### add executable permission to index.cgi
+$ chmod a+x ~/public_html/index.cgi
+### edit .htaccess
+$ vi ~/public_html/.htaccess
+### (optional) edit index.cgi to configure
+$ vi ~/public_html/index.cgi
+.====================
+
+Edit ~/public_html/.htaccess and modify user name.
+
+.? ~/public_html/.htaccess
+.--------------------
+## enable mod_rewrie
+RewriteEngine on
+## deny access to *.rhtml and *.cache
+#RewriteRule \.(rhtml|cache)$ - [R=404,L]
+RewriteRule \.(rhtml|cache)$ - [F,L]
+## rewrite only if requested file is not found
+RewriteCond %{SCRIPT_FILENAME} !-f
+## handle request to *.html and directories by index.cgi
+RewriteRule (\.html|/|^)$ /~{{*username*}}/index.cgi
+#RewriteRule (\.html|/|^)$ index.cgi
+.--------------------
+
+After these steps, *.rhtml will be published as *.html.
+For example, if you access to {{,http://{{/host/}}.{{/domain/}}/~{{/username/}}/index.html,}} (or {{,http://{{/host/}}.{{/domain/}}/~{{/username/}}/,}}), file {{,~/public_html/index.rhtml,}} will be displayed.
+
.$$ Define method | topics-defmethod