summaryrefslogtreecommitdiff
path: root/website/index.xhtml
blob: 424bd1c226c20bbbe1421809ebfb35e68ac63c85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <meta http-equiv="Content-Type" content="text/xhtml" />
  <title>Erubis</title>
  <meta name="generator" content="kwaser" />
  <link rel="stylesheet" href="site-design.css" type="text/css" />
  <meta http-equiv="Content-Style-Type" content="text/css" />
 </head>
 <body>

  <div id="mainbody">

    <!-- BeginEditable "breadcrumbs" -->
    <a href="/">HOME</a>
 &gt; Erubis<br />
    <!-- EndEditable "breadcrumbs" -->

   <!-- BeginEditable "doc_content" -->
   <div id="doc_content">
    <h1 id="doc_title">Erubis</h1>
<a name="News"></a>
<h2 class="section">News</h2>
<ul class="ul1">
<li>[2006-09-28] <a href="download.cgi">erubis-j_1.0.0</a> (porting to Java) released.
</li>
<li>[2006-09-24] <a href="download.cgi">erubis_2.1.0</a> released.
</li>
<li>[2006-05-20] <a href="download.cgi">erubis_2.0.0</a> released.
</li>
<li>[2006-03-05] <a href="download.cgi">erubis_1.1.0</a> released.
</li>
</ul>



<a name="Introduction"></a>
<h2 class="section">Introduction</h2>
<p></p>   <!-- escape IE Bug -->
<table class="fig-entry" summary="">
 <tr>
  <td class="fig-caption">
  Fig: Erubis is the fastest eRuby implementation.
  </td>
 </tr>
 <tr>
  <td class="fig-body">
   <img src="img/erubis01.png" alt="figure of Erubis" />
  </td>
 </tr>
</table>
<p>Erubis is a fast, secure, and very extensible implementation of eRuby.
It has the following features.
</p>
<ul class="ul1">
<li>Very fast, almost three times faster than ERB and even faster than eruby (implemented in C).
</li>
<li>Auto escaping (sanitizing) support, it means that '&lt;%= %&gt;' can be escaped in default.
   It is desirable for web application.
</li>
<li>Spaces around '&lt;% %&gt;' are trimmed automatically only when '&lt;%' is at the beginning of line and '%&gt;' is at the end of line.
</li>
<li>Embedded pattern changeable (default '&lt;% %&gt;'), for example '[% %]' or '&lt;? ?&gt;' are available.
</li>
<li>Enable to handle Processing Instructions (PI) as embedded pattern (ex. '&lt;?rb ... ?&gt;').
   This is desirable for XML/HTML than '&lt;% .. %&gt;' because the latter breaks HTML design
   but the former doesn't.
</li>
<li>Multi-language support (Ruby/PHP/C/Java/Scheme/Perl/Javascript).
</li>
<li>Context object available and easy to combine eRuby template with YAML datafile
   (see the below example).
</li>
<li>Print statement available.
</li>
<li>Easy to expand and customize in subclass
  <ul class="ul2">
  <li>Print statement support
  </li>
  <li>Lines starting with percent character ('%') support
  </li>
  <li>Another embedded pattern support
  </li>
  <li>etc...
  </li>
  </ul>
</li>
<li>Ruby on Rails support.
</li>
</ul>
<p>eRuby means "embedded Ruby" in documents.
Embedded patterns are '<code>&lt;% <em>statement</em> %&gt;</code>' and '<code>&lt;%= <em>expression</em> %&gt;</code>'.
The following is an example of eRuby. '&lt;% ... %&gt;' means Ruby statement and '&lt;%= ... %&gt;' means Ruby expression.
</p>
<a name="example.eruby"></a>
<div class="program_caption">example.eruby</div>
<pre class="program">Hello &lt;%= @user %&gt;!
&lt;% for item in @list %&gt;
 * &lt;%= item %&gt;
&lt;% end %&gt;
</pre>
<p>This will be compiled into Ruby program code.
</p>
<pre class="terminal">$ erubis -x example.eruby
_buf = []; _buf &lt;&lt; 'Hello '; _buf &lt;&lt; ( @user ).to_s; _buf &lt;&lt; '!
'; for item in @list 
 _buf &lt;&lt; ' * '; _buf &lt;&lt; ( item ).to_s; _buf &lt;&lt; '
'; end 
_buf.join
</pre>
<p>Or you can execute eRuby script directry.
</p>
<pre class="terminal">$ cat data.yaml
user: Erubis
list:
  - aaa
  - bbb
  - ccc
$ erubis -f data.yaml example.eruby
Hello Erubis!
 * aaa
 * bbb
 * ccc
</pre>
<p>Erubis is implemented in Ruby and is now ported into Java.
You can use Erubis in Java with Rhino.
</p>



<a name="Download"></a>
<h2 class="section">Download</h2>
	<ul class="ul1">
	<li>Erubis (implemented in Ruby)
	    <ul class="ul2">
	    <li>if you have installed RubyGems, just type `<code>gem install -r erubis</code>' to install Erubis
	    </li>
	    <li>Or <a href="download.cgi">download</a><br />
	       (Erubis requires <a href="http://rubyforge.org/projects/abstract">abstract</a> library.
	        Download and install it at first.)
	    </li>
	    </ul>
	</li>
	<li>Erubis-J (implemented in Java) <span style="color:#FF0000">(New!)</span>
	    <ul class="ul2">
	    <li><a href="download.cgi?project=erubisj">download</a>
	    </li>
	    </ul>
	</li>
	</ul>



<a name="Documents"></a>
<h2 class="section">Documents</h2>
	<ul class="ul1">
	<li>Erubis (implemented in Ruby)
	    <ul class="ul2">
	    <li><a href="users-guide.html">Users' guide</a>
	    </li>
	    <li><a href="CHANGES">CHANGES</a>
	    </li>
	    <li><a href="ReleaseNote.txt">ReleaseNote</a>
	    </li>
	    </ul>
	</li>
	<li>Erubis-J (implemented in Java)
	    <ul class="ul2">
	    <li><a href="erubisj-users-guide.html">Users' guide</a>
	    </li>
	    </ul>
	</li>
	</ul>



<a name="License"></a>
<h2 class="section">License</h2>
	<ul class="ul1">
	<li><a href="http://www.gnu.org/copyleft/lgpl.html">LGPL ver.2</a>
<p>	   If you need other license, please suggest me.
</p>
	</li>
	</ul>




   </div>
   <!-- EndEditable "doc_content" -->
  </div>

 </body>
</html>