-
Notifications
You must be signed in to change notification settings - Fork 0
/
erb.1
160 lines (160 loc) · 3.25 KB
/
erb.1
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
.\"Ruby is copyrighted by Yukihiro Matsumoto <[email protected]>.
.Dd December 16, 2018
.Dt ERB \&1 "Ruby Programmer's Reference Guide"
.Os UNIX
.Sh NAME
.Nm erb
.Nd Ruby Templating
.Sh SYNOPSIS
.Nm
.Op Fl -version
.Op Fl UPdnvx
.Op Fl E Ar ext Ns Op Ns : Ns int
.Op Fl S Ar level
.Op Fl T Ar mode
.Op Fl r Ar library
.Op Fl -
.Op file ...
.Pp
.Sh DESCRIPTION
.Nm
is a command line front-end for
.Li "ERB"
library, which is an implementation of eRuby.
.Pp
ERB provides an easy to use but powerful templating system for Ruby.
Using ERB, actual Ruby code can be added to any plain text document for the
purposes of generating document information details and/or flow control.
.Pp
.Nm
is a part of
.Nm Ruby .
.Pp
.Sh OPTIONS
.Bl -tag -width "1234567890123" -compact
.Pp
.It Fl -version
Prints the version of
.Nm .
.Pp
.It Fl E Ar external Ns Op : Ns Ar internal
.It Fl -encoding Ar external Ns Op : Ns Ar internal
Specifies the default value(s) for external encodings and internal encoding. Values should be separated with colon (:).
.Pp
You can omit the one for internal encodings, then the value
.Pf ( Li "Encoding.default_internal" ) will be nil.
.Pp
.It Fl P
Disables ruby code evaluation for lines beginning with
.Li "%" .
.Pp
.It Fl S Ar level
Specifies the safe level in which eRuby script will run.
.Pp
.It Fl T Ar mode
Specifies trim mode (default 0).
.Ar mode
can be one of
.Bl -hang -offset indent
.It Sy 0
EOL remains after the embedded ruby script is evaluated.
.Pp
.It Sy 1
EOL is removed if the line ends with
.Li "%>" .
.Pp
.It Sy 2
EOL is removed if the line starts with
.Li "<%"
and ends with
.Li "%>" .
.Pp
.It Sy -
EOL is removed if the line ends with
.Li "-%>" .
And leading whitespaces are removed if the erb directive starts with
.Li "<%-" .
.Pp
.El
.It Fl r
Load a library
.Pp
.It Fl U
can be one of
Sets the default value for internal encodings
.Pf ( Li "Encoding.default_internal" ) to UTF-8.
.Pp
.It Fl d
.It Fl -debug
Turns on debug mode.
.Li "$DEBUG"
will be set to true.
.Pp
.It Fl h
.It Fl -help
Prints a summary of the options.
.Pp
.It Fl n
Used with
.Fl x .
Prepends the line number to each line in the output.
.Pp
.It Fl v
Enables verbose mode.
.Li "$VERBOSE"
will be set to true.
.Pp
.It Fl x
Converts the eRuby script into Ruby script and prints it without line numbers.
.Pp
.El
.Pp
.Sh EXAMPLES
Here is an eRuby script
.Bd -literal -offset indent
<?xml version="1.0" ?>
<% require 'prime' -%>
<erb-example>
<calc><%= 1+1 %></calc>
<var><%= __FILE__ %></var>
<library><%= Prime.each(10).to_a.join(", ") %></library>
</erb-example>
.Ed
.Pp
Command
.Dl "% erb -T - example.erb"
prints
.Bd -literal -offset indent
<?xml version="1.0" ?>
<erb-example>
<calc>2</calc>
<var>example.erb</var>
<library>2, 3, 5, 7</library>
</erb-example>
.Ed
.Pp
.Sh SEE ALSO
.Xr ruby 1 .
.Pp
And see
.Xr ri 1
documentation for
.Li "ERB"
class.
.Pp
.Sh REPORTING BUGS
.Bl -bullet
.It
Security vulnerabilities should be reported via an email to
.Mt [email protected] .
Reported problems will be published after being fixed.
.Pp
.It
Other bugs and feature requests can be reported via the
Ruby Issue Tracking System
.Pq Lk https://bugs.ruby-lang.org/ .
Do not report security vulnerabilities
via this system because it publishes the vulnerabilities immediately.
.El
.Sh AUTHORS
Written by Masatoshi SEKI.