diff options
author | makoto kuwata <kwa@kuwata-lab.com> | 2007-09-24 14:04:21 +0000 |
---|---|---|
committer | makoto kuwata <kwa@kuwata-lab.com> | 2007-09-24 14:04:21 +0000 |
commit | 1b913d61adcab0e377abe6022dbf54892c0482e5 (patch) | |
tree | 1b5b6c579ee778d65ebdf87539575f92b40c56b0 /doc | |
parent | 7cb00b66a50550da046928b5bf0059e4f00da88a (diff) | |
download | erubis-1b913d61adcab0e377abe6022dbf54892c0482e5.tar.gz |
- [enhance] add '--docwrite={true|false}' property to Ejavascript class.
- [update] user's guide
Diffstat (limited to 'doc')
-rw-r--r-- | doc/users-guide.html | 35 | ||||
-rw-r--r-- | doc/users-guide.txt | 38 |
2 files changed, 57 insertions, 16 deletions
diff --git a/doc/users-guide.html b/doc/users-guide.html index 62bfc50..2ef6d7b 100644 --- a/doc/users-guide.html +++ b/doc/users-guide.html @@ -1822,24 +1822,30 @@ It deletes indentations even if they are in <PRE></PRE>. <a name="lang"></a> <h2 class="section1">Multi-Language Support</h2> -<p>Erubis supports the following language currently: +<p>Erubis supports the following languages<sup>(<a href="#fnref:2" name="fnlink:2">*2</a>)</sup>: </p> <ul type="disc"> <li>Ruby </li> -<li>PHP +<li><a href="#lang-php">PHP</a> </li> -<li>C +<li><a href="#lang-c">C</a> </li> -<li>Java +<li><a href="#lang-java">Java</a> </li> -<li>Scheme +<li><a href="#lang-scheme">Scheme</a> </li> -<li>Perl +<li><a href="#lang-perl">Perl</a> </li> -<li>JavaScript +<li><a href="#lang-javascript">JavaScript</a> </li> </ul> +<div class="footnote"> + <dl compact> + <dt>(<a name="fnref:2" href="#fnlink:2">*2</a>)</dt> + <dd>If you need template engine in pure PHP/Perl/JavaScript, try <a href="http://www.kuwata-lab.com/tenjin/">Tenjin</a> (<a href="http://www.kuwata-lab.com/tenjin/">http://www.kuwata-lab.com/tenjin/</a>). Tenjin is a very fast and full-featured template engine implemented in pure PHP/Perl/JavaScript.</dd> + </dl> +</div> <a name="lang-php"></a> <h3 class="section2">PHP</h3> <a name="example.ephp"></a> @@ -2153,7 +2159,7 @@ compiled source code</div> </pre> <a name="example_scheme_display.result"></a> <div class="terminal_caption"> -compiled source code (with --func=display property)</div> +compiled source code (with <code>--func=display</code> property)</div> <pre class="terminal">$ erubis -l scheme --func=display example.escheme (display "<html> <body>\n") @@ -2290,6 +2296,19 @@ _buf.push(" </tbody>\n\ </html>\n"); document.write(_buf.join("")); </pre> +<p>If command-line option '<code>--docwrite=false</code>' is specified, +'<code>_buf.join("");</code>' is used instead of '<code>document.write(_buf.join(""));</code>'. +This is useful when passing converted source code to eval() function in JavaScript. +</p> +<p>You can pass <code>:docwrite=>false</code> to Erubis::Ejavascript.new() in your Ruby script. +</p> +<pre class="program">s = File.read('example.jshtml') +engine = Erubis::Ejavascript.new(s, <code>:docwrite=>false</code>) +</pre> +<p>If you want to specify any JavaScript code, use '--postamble=...'. +</p> +<p>Notice that default value of 'docwrite' property will be false in the future release. +</p> <br> diff --git a/doc/users-guide.txt b/doc/users-guide.txt index 6415bfb..927d478 100644 --- a/doc/users-guide.txt +++ b/doc/users-guide.txt @@ -1925,15 +1925,15 @@ DeleteIndentEnhancer is language-independent. .$ Multi-Language Support | lang -Erubis supports the following language currently: +Erubis supports the following languages{{(If you need template engine in pure PHP/Perl/JavaScript, try {{<Tenjin|http://www.kuwata-lab.com/tenjin/>}} ({{<http://www.kuwata-lab.com/tenjin/>}}). Tenjin is a very fast and full-featured template engine implemented in pure PHP/Perl/JavaScript.)}}: .* Ruby -.* PHP -.* C -.* Java -.* Scheme -.* Perl -.* JavaScript +.* {{<PHP|#lang-php>}} +.* {{<C|#lang-c>}} +.* {{<Java|#lang-java>}} +.* {{<Scheme|#lang-scheme>}} +.* {{<Perl|#lang-perl>}} +.* {{<JavaScript|#lang-javascript>}} @@ -1985,6 +1985,8 @@ $ erubis -l php example.ephp </html> .==================== +.# If you need template engine in pure PHP, try {{<phpTenjin|http://www.kuwata-lab.com/tenjin/>}} ({{<http://www.kuwata-lab.com/tenjin/>}}). +.# phpTenjin is a very fast and full-featured template engine implemented in pure PHP. .$$ C | lang-c @@ -2249,7 +2251,7 @@ $ erubis -l scheme example.escheme (reverse _buf)) .==================== -.? compiled source code (with --func=display property) +.? compiled source code (with {{,--func=display,}} property) .==================== example_scheme_display.result $ erubis -l scheme --func=display example.escheme .#.<<<:! (cd guide.d; erubis -l scheme --func=display example.escheme) @@ -2334,6 +2336,9 @@ print(' </table> '); .==================== +.# If you need template engine in pure Perl, try {{<plTenjin|http://www.kuwata-lab.com/tenjin/>}} ({{<http://www.kuwata-lab.com/tenjin/>}}). +.# plTenjin is a very fast and full-featured template engine implemented in pure Perl. + .$$ JavaScript | lang-javascript @@ -2389,6 +2394,23 @@ _buf.push(" </tbody>\n\ document.write(_buf.join("")); .==================== +If command-line option '{{,--docwrite=false,}}' is specified, +'{{,_buf.join("");,}}' is used instead of '{{,document.write(_buf.join(""));,}}'. +This is useful when passing converted source code to eval() function in JavaScript. + +You can pass {{,:docwrite=>false,}} to Erubis::Ejavascript.new() in your Ruby script. + +.-------------------- +s = File.read('example.jshtml') +engine = Erubis::Ejavascript.new(s, {{,:docwrite=>false,}}) +.-------------------- + +If you want to specify any JavaScript code, use '--postamble=...'. + +Notice that default value of 'docwrite' property will be false in the future release. + +.# If you need template engine in pure JavaScript, try {{<jsTenjin|http://www.kuwata-lab.com/tenjin/>}} ({{<http://www.kuwata-lab.com/tenjin/>}}). +.# jsTenjin is a very fast and full-featured template engine implemented in pure JavaScript and available with not only web browser but also Spidermonkey and Rhino. |