erubis - eRuby style template engine for multiple languages
| Use Case | Command | Description |
|---|---|---|
| Convert template to PHP | erubis -l php file.ephp |
Convert embedded document to PHP code |
| Show converted Ruby code | erubis -x file.eruby |
Display the generated Ruby source |
| Show converted code with line numbers | erubis -x -N file.eruby |
Display generated source with line numbers |
| Check syntax | erubis -z file.eruby |
Verify template syntax without executing |
| Enable HTML escaping | erubis -E Escape file.eruby |
Escape HTML output by default |
| Load context from YAML file | erubis -f data.yaml file.eruby |
Provide template variables from a file |
| Custom embedding pattern | erubis -p '<? ?>' file.eruby |
Use <? ... ?> instead of <% ... %> |
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:
help
version
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')
embedded pattern (default '<% %>')
convert but no execute (ruby/php/c/java/scheme/perl/js)
enhancer names (Escape, PercentLine, BiPattern, ...)
library include path
kanji code (euc/sjis/utf8) (default none)
context data string (yaml inline style or ruby code)
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 '<% ... %>'
Run 'erubis -l php example.ephp' to convert the embedded document to php code.
<?xml version="1.0"?>
<html>
<body>
<p>Hello <%= $user %>!</p>
<table>
<tbody>
<% $i = 0; %>
<% foreach ($list as $item) { %>
<% $i++; %>
<tr bgcolor="<%= $i % 2 == 0 ? '#FFCCCC' : '#CCCCFF' %>">
<td><%= $i %></td>
<td><%== $item %></td>
</tr>
<% } %>
</tbody>
</table>
</body>
</html>
http://rubyforge.org/projects/erubis/
erubis 2.6.2 January 2009 ERUBIS(1)
Generated by phpman v4.10.0-7-g98e9fd5 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-09-03 18:54 @216.73.216.23
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)