diff options
author | makoto kuwata <kwa@kuwata-lab.com> | 2006-09-19 16:46:37 +0000 |
---|---|---|
committer | makoto kuwata <kwa@kuwata-lab.com> | 2006-09-19 16:46:37 +0000 |
commit | 39049ba14c020fb15f6a27cc65b47576f00988d7 (patch) | |
tree | f37d663de9abcb89b469bef2c5fdb743b36950e6 /doc | |
parent | b8f6776aa5074f2f191e25e2460cd7b8be7bf320 (diff) | |
download | erubis-39049ba14c020fb15f6a27cc65b47576f00988d7.tar.gz |
- [update] doc/users-guide.txt: add documentation about 'notext' command
- [update] release preparation
- [enhance] add 'examples/pi'
Diffstat (limited to 'doc')
-rw-r--r-- | doc/users-guide.html | 96 | ||||
-rw-r--r-- | doc/users-guide.txt | 98 |
2 files changed, 194 insertions, 0 deletions
diff --git a/doc/users-guide.html b/doc/users-guide.html index e28b08f..802997e 100644 --- a/doc/users-guide.html +++ b/doc/users-guide.html @@ -131,6 +131,8 @@ It has the following features. </li> <li><a href="#topics-php">NoTextEnhancer and NoCodeEnhancer in PHP</a> </li> + <li><a href="#topics-notext">Command <code>notext</code></a> + </li> <li><a href="#topics-benchmark">Benchmark</a> </li> </ul> @@ -1997,6 +1999,100 @@ example of using NoCodeEnhancer with PHP file</div> <br> +<a name="topics-notext"></a> +<h3 class="section2">Command <code>notext</code></h3> +<p>Command 'notext' removes text part from eRuby script and leaves only embedded Ruby code. +This is very useful when debugging eRuby script. +</p> +<p>-------------------- +<html> + <body> + <table> +<% @list.each_with_index do |item, i| %> +<% klass = i % 2 == 0 ? 'odd' : 'even' %> + <tr class="<%= klass %>"> + <td><%== item %></td> + </tr> +<% end %> + </table> + </body> +</html> +-------------------- +</p> +<p>==================== +$ notext notext-ex.rhtml +_buf = []; +</p> +<p> @list.each_with_index do |item, i| ; + klass = i % 2 == 0 ? 'odd' : 'even' ; + _buf << ( klass ).to_s; + _buf << Erubis::XmlHelper.escape_xml( item ); +</p> +<p> end ; +</p> +<p>_buf.join +</p> +<pre class="terminal"> +Command-line option '-u' deletes continuous empty lines to one empty line. + +.? command-line example +</pre> +<p>$ notext <strong>-u</strong> notext-ex.rhtml +_buf = []; +</p> +<p> @list.each_with_index do |item, i| ; + klass = i % 2 == 0 ? 'odd' : 'even' ; + _buf << ( klass ).to_s; + _buf << Erubis::XmlHelper.escape_xml( item ); +</p> +<p> end ; +</p> +<p>_buf.join +</p> +<pre class="terminal"> +Command-line option '-c' deletes all empty lines. + +.? command-line example +</pre> +<p>$ notext <strong>-c</strong> notext-ex.rhtml +_buf = []; + @list.each_with_index do |item, i| ; + klass = i % 2 == 0 ? 'odd' : 'even' ; + _buf << ( klass ).to_s; + _buf << Erubis::XmlHelper.escape_xml( item ); + end ; +_buf.join +</p> +<pre class="terminal"> +Command-line option '-n' shows line numbers. It can work with '-c' or '-u'. + +</pre> +<p>$ notext <strong>-nu</strong> example2.rhtml + 1: _buf = []; +</p> +<p> 4: @list.each_with_index do |item, i| ; + 5: klass = i % 2 == 0 ? 'odd' : 'even' ; + 6: _buf << ( klass ).to_s; + 7: _buf << Erubis::XmlHelper.escape_xml( item ); +</p> +<p> 9: end ; +</p> +<p> 13: _buf.join +$ notext <strong>-nc</strong> example2.rhtml + 1: _buf = []; + 4: @list.each_with_index do |item, i| ; + 5: klass = i % 2 == 0 ? 'odd' : 'even' ; + 6: _buf << ( klass ).to_s; + 7: _buf << Erubis::XmlHelper.escape_xml( item ); + 9: end ; + 13: _buf.join +==================== +</p> +<p>Command 'notext' supports '-l <em>lang</em>' options. For example, command-line option '-l php' retrieves embedded PHP code from PHP file. +</p> +<br> + + <a name="topics-benchmark"></a> <h3 class="section2">Benchmark</h3> <p>A benchmark script is included in Erubis package at erubis-X.X.X/benchark directory. diff --git a/doc/users-guide.txt b/doc/users-guide.txt index 379c371..fa7eaca 100644 --- a/doc/users-guide.txt +++ b/doc/users-guide.txt @@ -1566,6 +1566,104 @@ $ erubis -T -l php -E NoCode -p '<\?php \?>' notext-example.php | cat -n +.$$ Command {{,notext,}} | topics-notext + +Command 'notext' removes text part from eRuby script and leaves only embedded Ruby code. +This is very useful when debugging eRuby script. + + +.? notext-ex.rhtml +-------------------- +<html> + <body> + <table> +<% @list.each_with_index do |item, i| %> +<% klass = i % 2 == 0 ? 'odd' : 'even' %> + <tr class="<%= klass %>"> + <td><%== item %></td> + </tr> +<% end %> + </table> + </body> +</html> +-------------------- + +.? command line example +==================== +$ notext notext-ex.rhtml +_buf = []; + + + @list.each_with_index do |item, i| ; + klass = i % 2 == 0 ? 'odd' : 'even' ; + _buf << ( klass ).to_s; + _buf << Erubis::XmlHelper.escape_xml( item ); + + end ; + + +_buf.join +.==================== + +Command-line option '-u' deletes continuous empty lines to one empty line. + +.? command-line example +.==================== +$ notext {{*-u*}} notext-ex.rhtml +_buf = []; + + @list.each_with_index do |item, i| ; + klass = i % 2 == 0 ? 'odd' : 'even' ; + _buf << ( klass ).to_s; + _buf << Erubis::XmlHelper.escape_xml( item ); + + end ; + +_buf.join +.==================== + +Command-line option '-c' deletes all empty lines. + +.? command-line example +.==================== +$ notext {{*-c*}} notext-ex.rhtml +_buf = []; + @list.each_with_index do |item, i| ; + klass = i % 2 == 0 ? 'odd' : 'even' ; + _buf << ( klass ).to_s; + _buf << Erubis::XmlHelper.escape_xml( item ); + end ; +_buf.join +.==================== + +Command-line option '-n' shows line numbers. It can work with '-c' or '-u'. + +.==================== +$ notext {{*-nu*}} example2.rhtml + 1: _buf = []; + + 4: @list.each_with_index do |item, i| ; + 5: klass = i % 2 == 0 ? 'odd' : 'even' ; + 6: _buf << ( klass ).to_s; + 7: _buf << Erubis::XmlHelper.escape_xml( item ); + + 9: end ; + + 13: _buf.join +$ notext {{*-nc*}} example2.rhtml + 1: _buf = []; + 4: @list.each_with_index do |item, i| ; + 5: klass = i % 2 == 0 ? 'odd' : 'even' ; + 6: _buf << ( klass ).to_s; + 7: _buf << Erubis::XmlHelper.escape_xml( item ); + 9: end ; + 13: _buf.join +==================== + +Command 'notext' supports '-l {{/lang/}}' options. For example, command-line option '-l php' retrieves embedded PHP code from PHP file. + + + .$$ Benchmark | topics-benchmark A benchmark script is included in Erubis package at erubis-X.X.X/benchark directory. |