erubis(1) eRuby style template engine for multiple languages


erubis [..options..] [file ...]


Embedded templating engine for multiple languages. Erubis will take a template file as input and output code to convey that data in the language specified. The following output languages are supported:

 * Ruby
 * PHP
 * C
 * Java
 * Scheme
 * Perl
 * JavaScript


-h, --help
show converted code
show converted code, only ruby code and no text part
numbering: add line numbers (for '-x/-X')
unique: compress empty lines to a line (for '-x/-X')
compact: remove empty lines (for '-x/-X')
body only: no preamble nor postamble (for '-x/-X')
syntax checking
escape (equal to '--E Escape')
-p pattern
embedded pattern (default '<% %>')
-l lang
convert but no execute (ruby/php/c/java/scheme/perl/js)
-E e1,e2,...
enhancer names (Escape, PercentLine, BiPattern, ...)
-I path
library include path
-K kanji
kanji code (euc/sjis/utf8) (default none)
-c context
context data string (yaml inline style or ruby code)
-f datafile
context data file ('*.yaml', '*.yml', or '*.rb')
don't expand tab characters in YAML file
convert mapping key from string to symbol in YAML file
invoke 'result(binding)' instead of 'evaluate(context)'
parse '<?name ... ?>' instead of '<% ... %>'

supported properties:

* (common)
: escape function name
--pattern="<% %>"
: embed pattern
: trim spaces around <% ... %>
: preamble (no preamble when false)
: postamble (no postamble when false)
: escape expression or not in default
* (basic) * (pi)
: PI (Processing Instrunctions) name
: char for embedded expression pattern('@{...}@')
* ruby * php * c
: indent spaces (ex. ' ')
: output file pointer name
* java
: indent spaces (ex. ' ')
: output buffer name
--bufclass="StringBuffer" : output buffer class (ex. 'StringBuilder')
* scheme
: function name (ex. 'display')
* perl
: function name
* javascript
: use 'document.write()' when true


Run 'erubis -l php example.ephp' to convert the embedded document to php code.

 <?xml version="1.0"?>
   <p>Hello <%= $user %>!</p>
     <% $i = 0; %>
     <% foreach ($list as $item) { %>
     <%   $i++; %>
     <tr bgcolor="<%= $i % 2 == 0 ? '#FFCCCC' : '#CCCCFF' %>">
      <td><%= $i %></td>
      <td><%== $item %></td>
     <% } %>