File: erubis.1

package info (click to toggle)
ruby-erubis 2.7.0-3.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 2,256 kB
  • sloc: ruby: 8,758; ansic: 97; makefile: 72; php: 17
file content (174 lines) | stat: -rw-r--r-- 3,345 bytes parent folder | download | duplicates (5)
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
.TH ERUBIS "1" "January 2009" "erubis 2.6.2" "User Commands"
.SH NAME
erubis \- eRuby style template engine for multiple languages
.SH SYNOPSIS
.B erubis
[..\fIoptions\fR..] [\fIfile \fR...]
.SH DESCRIPTION
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:
.IP
 * Ruby
 * PHP
 * C
 * Java
 * Scheme
 * Perl
 * JavaScript
.SH OPTIONS
.TP
\fB\-h\fR, \fB\-\-help\fR
help
.TP
\fB\-v\fR
version
.TP
\fB\-x\fR
show converted code
.TP
\fB\-X\fR
show converted code, only ruby code and no text part
.TP
\fB\-N\fR
numbering: add line numbers            (for '\-x/\-X')
.TP
\fB\-U\fR
unique: compress empty lines to a line (for '\-x/\-X')
.TP
\fB\-C\fR
compact: remove empty lines            (for '\-x/\-X')
.TP
\fB\-b\fR
body only: no preamble nor postamble   (for '\-x/\-X')
.TP
\fB\-z\fR
syntax checking
.TP
\fB\-e\fR
escape (equal to '\-\-E Escape')
.TP
\fB\-p\fR pattern
embedded pattern (default '<% %>')
.TP
\fB\-l\fR lang
convert but no execute (ruby/php/c/java/scheme/perl/js)
.TP
\fB\-E\fR e1,e2,...
enhancer names (Escape, PercentLine, BiPattern, ...)
.TP
\fB\-I\fR path
library include path
.TP
\fB\-K\fR kanji
kanji code (euc/sjis/utf8) (default none)
.TP
\fB\-c\fR context
context data string (yaml inline style or ruby code)
.TP
\fB\-f\fR datafile
context data file ('*.yaml', '*.yml', or '*.rb')
.TP
\fB\-T\fR
don't expand tab characters in YAML file
.TP
\fB\-S\fR
convert mapping key from string to symbol in YAML file
.TP
\fB\-B\fR
invoke 'result(binding)' instead of 'evaluate(context)'
.TP
\fB\-\-pi\fR=\fIname\fR
parse '<?name ... ?>' instead of '<% ... %>'
.SS "supported properties:"
.IP
* (common)
.TP
\fB\-\-escapefunc\fR=\fInil\fR
: escape function name
.TP
\fB\-\-pattern=\fR"<% %>"
: embed pattern
.TP
\fB\-\-trim\fR=\fItrue\fR
: trim spaces around <% ... %>
.TP
\fB\-\-preamble\fR=\fInil\fR
: preamble (no preamble when false)
.TP
\fB\-\-postamble\fR=\fInil\fR
: postamble (no postamble when false)
.TP
\fB\-\-escape\fR=\fInil\fR
: escape expression or not in default
.IP
* (basic)
* (pi)
.TP
\fB\-\-pi=\fR"rb"
: PI (Processing Instrunctions) name
.TP
\fB\-\-embchar=\fR"@"
: char for embedded expression pattern('@{...}@')
.IP
* ruby
* php
* c
.TP
\fB\-\-indent=\fR""
: indent spaces (ex. '  ')
.TP
\fB\-\-out=\fR"stdout"
: output file pointer name
.IP
* java
.TP
\fB\-\-indent=\fR""
: indent spaces (ex. '  ')
.TP
\fB\-\-buf=\fR"_buf"
: output buffer name
.HP
\fB\-\-bufclass=\fR"StringBuffer" : output buffer class (ex. 'StringBuilder')
.IP
* scheme
.TP
\fB\-\-func=\fR"_add"
: function name (ex. 'display')
.IP
* perl
.TP
\fB\-\-func=\fR"print"
: function name
.IP
* javascript
.TP
\fB\-\-docwrite\fR=\fItrue\fR
: use 'document.write()' when true
.SH EXAMPLES

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

\fBexample.ephp:\fR
 <?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>

.SH SEE ALSO

http://rubyforge.org/projects/erubis/