| | | |
Offset 1, 160 lines modified | Offset 1, 184 lines modified |
| 1 | .TH·ERB·\&1·"Ruby·Programmer's·Reference·Guide"·"December·16,·2018"·"UNIX" |
1 | .\"Ruby·is·copyrighted·by·Yukihiro·Matsumoto·<matz@netlab.jp>. | |
2 | .Dd·December·16,·2018 | |
3 | .Dt·ERB·\&1·"Ruby·Programmer's·Reference·Guide" | |
4 | .Os·UNIX | |
5 | .Sh·NAME | 2 | .SH·NAME |
6 | .Nm·erb | 3 | \fBerb\fP |
7 | .Nd·Ruby·Templating | 4 | \-·Ruby·Templating |
8 | .Sh·SYNOPSIS | 5 | .SH·SYNOPSIS |
9 | .Nm | |
10 | .Op·Fl·-version | |
11 | .Op·Fl·UPdnvx | |
12 | .Op·Fl·E·Ar·ext·Ns·Op·Ns·:·Ns·int | |
13 | .Op·Fl·S·Ar·level | |
14 | .Op·Fl·T·Ar·mode | |
15 | .Op·Fl·r·Ar·library | |
16 | .Op·Fl·- | |
17 | .Op·file·... | |
18 | .Pp | 6 | .br |
| 7 | \fBerb\fP |
| 8 | [\fB\--version\fP] |
| 9 | [\fB\-UPdnvx\fP] |
| 10 | [\fB\-E\fP·\fIext\fP[:int]] |
| 11 | [\fB\-S\fP·\fIlevel\fP] |
| 12 | [\fB\-T\fP·\fImode\fP] |
| 13 | [\fB\-r\fP·\fIlibrary\fP] |
| 14 | [\fB\--\fP] |
| 15 | [file·...] |
| |
19 | .Sh·DESCRIPTION | 16 | .SH·DESCRIPTION |
20 | .Nm | 17 | \fBerb\fP |
21 | is·a·command·line·front-end·for | 18 | is·a·command·line·front-end·for |
22 | .Li·"ERB" | 19 | "ERB" |
23 | library,·which·is·an·implementation·of·eRuby. | 20 | library,·which·is·an·implementation·of·eRuby. |
24 | .Pp | |
25 | ERB·provides·an·easy·to·use·but·powerful·templating·system·for·Ruby. | 21 | ERB·provides·an·easy·to·use·but·powerful·templating·system·for·Ruby. |
26 | Using·ERB,·actual·Ruby·code·can·be·added·to·any·plain·text·document·for·the | 22 | Using·ERB,·actual·Ruby·code·can·be·added·to·any·plain·text·document·for·the |
27 | purposes·of·generating·document·information·details·and/or·flow·control. | 23 | purposes·of·generating·document·information·details·and/or·flow·control. |
28 | .Pp | |
29 | .Nm | |
| 24 | \fBerb\fP |
30 | is·a·part·of | 25 | is·a·part·of |
31 | .Nm·Ruby·. | |
32 | .Pp | 26 | \fBRuby\fP. |
| |
33 | .Sh·OPTIONS | 27 | .SH·OPTIONS |
34 | .Bl·-tag·-width·"1234567890123"·-compact | |
35 | .Pp | |
36 | .It·Fl·-version | |
| 28 | .TP |
| 29 | \fB\--version\fP |
37 | Prints·the·version·of | 30 | Prints·the·version·of |
38 | .Nm·. | |
39 | .Pp | |
40 | .It·Fl·E·Ar·external·Ns·Op·:·Ns·Ar·internal | |
41 | .It·Fl·-encoding·Ar·external·Ns·Op·:·Ns·Ar·internal | 31 | \fB.\fP |
| |
| 32 | .TP |
| 33 | \fB\-E\fP·\fIexternal\fP[:\fIinternal\fP] |
| 34 | .TP |
| 35 | \fB\--encoding\fP·\fIexternal\fP[:\fIinternal\fP] |
42 | Specifies·the·default·value(s)·for·external·encodings·and·internal·encoding.·Values·should·be·separated·with·colon·(:). | 36 | Specifies·the·default·value(s)·for·external·encodings·and·internal·encoding.·Values·should·be·separated·with·colon·(:). |
43 | .Pp | |
44 | You·can·omit·the·one·for·internal·encodings,·then·the·value | 37 | You·can·omit·the·one·for·internal·encodings,·then·the·value |
45 | .Pf·(·Li·"Encoding.default_internal"·)·will·be·nil. | 38 | ("Encoding.default_internal")·will·be·nil. |
46 | .Pp | |
47 | .It·Fl·P | |
| 39 | .TP |
| 40 | \fB\-P\fP |
48 | Disables·ruby·code·evaluation·for·lines·beginning·with | 41 | Disables·ruby·code·evaluation·for·lines·beginning·with |
49 | .Li·"%"·. | |
50 | .Pp | |
51 | .It·Fl·S·Ar·level | 42 | "%". |
| |
| 43 | .TP |
| 44 | \fB\-S\fP·\fIlevel\fP |
52 | Specifies·the·safe·level·in·which·eRuby·script·will·run. | 45 | Specifies·the·safe·level·in·which·eRuby·script·will·run. |
53 | .Pp | |
54 | .It·Fl·T·Ar·mode | |
| 46 | .TP |
| 47 | \fB\-T\fP·\fImode\fP |
55 | Specifies·trim·mode·(default·0). | 48 | Specifies·trim·mode·(default·0). |
56 | .Ar·mode | 49 | \fImode\fP |
57 | can·be·one·of | 50 | can·be·one·of |
58 | .Bl·-hang·-offset·indent | |
59 | .It·Sy·0 | 51 | .TP |
| 52 | .B·0 |
60 | EOL·remains·after·the·embedded·ruby·script·is·evaluated. | 53 | EOL·remains·after·the·embedded·ruby·script·is·evaluated. |
61 | .Pp | |
62 | .It·Sy·1 | |
| 54 | .TP |
| 55 | .B·1 |
63 | EOL·is·removed·if·the·line·ends·with | 56 | EOL·is·removed·if·the·line·ends·with |
64 | .Li·"%>"·. | |
65 | .Pp | |
66 | .It·Sy·2 | 57 | "%>". |
| |
| 58 | .TP |
| 59 | .B·2 |
67 | EOL·is·removed·if·the·line·starts·with | 60 | EOL·is·removed·if·the·line·starts·with |
68 | .Li·"<%" | 61 | "<%" |
69 | and·ends·with | 62 | and·ends·with |
70 | .Li·"%>"·. | |
71 | .Pp | |
72 | .It·Sy·- | 63 | "%>". |
| |
| 64 | .TP |
| 65 | .B·- |
73 | EOL·is·removed·if·the·line·ends·with | 66 | EOL·is·removed·if·the·line·ends·with |
74 | .Li·"-%>"·. | 67 | "-%>". |
75 | And·leading·whitespaces·are·removed·if·the·erb·directive·starts·with | 68 | And·leading·whitespaces·are·removed·if·the·erb·directive·starts·with |
76 | .Li·"<%-"·. | |
77 | .Pp | |
78 | .El | |
79 | .It·Fl·r | 69 | "<%-". |
| |
| 70 | .TP |
| 71 | \fB\-r\fP |
80 | Load·a·library | 72 | Load·a·library |
81 | .Pp | |
82 | .It·Fl·U | |
| 73 | .TP |
| 74 | \fB\-U\fP |
83 | can·be·one·of | 75 | can·be·one·of |
84 | Sets·the·default·value·for·internal·encodings | 76 | Sets·the·default·value·for·internal·encodings |
85 | .Pf·(·Li·"Encoding.default_internal"·)·to·UTF-8. | 77 | ("Encoding.default_internal")·to·UTF-8. |
86 | .Pp | |
87 | .It·Fl·d | |
88 | .It·Fl·-debug | |
| 78 | .TP |
| 79 | \fB\-d\fP |
| 80 | .TP |
| 81 | \fB\--debug\fP |
89 | Turns·on·debug·mode. | 82 | Turns·on·debug·mode. |
90 | .Li·"$DEBUG" | 83 | "$DEBUG" |
91 | will·be·set·to·true. | 84 | will·be·set·to·true. |
92 | .Pp | |
93 | .It·Fl·h | |
94 | .It·Fl·-help | |
| 85 | .TP |
| 86 | \fB\-h\fP |
| 87 | .TP |
| 88 | \fB\--help\fP |
95 | Prints·a·summary·of·the·options. | 89 | Prints·a·summary·of·the·options. |
96 | .Pp | |
97 | .It·Fl·n | |
| 90 | .TP |
| 91 | \fB\-n\fP |
98 | Used·with | 92 | Used·with |
99 | .Fl·x·. | 93 | \fB\-x\fP. |
100 | Prepends·the·line·number·to·each·line·in·the·output. | 94 | Prepends·the·line·number·to·each·line·in·the·output. |
101 | .Pp | |
102 | .It·Fl·v | |
| 95 | .TP |
| 96 | \fB\-v\fP |
103 | Enables·verbose·mode. | 97 | Enables·verbose·mode. |
104 | .Li·"$VERBOSE" | 98 | "$VERBOSE" |
105 | will·be·set·to·true. | 99 | will·be·set·to·true. |
106 | .Pp | |
107 | .It·Fl·x | |
| 100 | .TP |
| 101 | \fB\-x\fP |
108 | Converts·the·eRuby·script·into·Ruby·script·and·prints·it·without·line·numbers. | 102 | Converts·the·eRuby·script·into·Ruby·script·and·prints·it·without·line·numbers. |
| |
| |
109 | .Pp | |
110 | .El | |
111 | .Pp | |
112 | .Sh·EXAMPLES | 103 | .SH·EXAMPLES |
113 | Here·is·an·eRuby·script | 104 | Here·is·an·eRuby·script |
114 | .Bd·-literal·-offset·indent | |
115 | <?xml·version="1.0"·?> | 105 | <?xml·version="1.0"·?> |
| 106 | .br |
116 | <%·require·'prime'·-%> | 107 | <%·require·'prime'·-%> |
| 108 | .br |
117 | <erb-example> | 109 | <erb-example> |
| 110 | .br |
118 | ··<calc><%=·1+1·%></calc> | 111 | ··<calc><%=·1+1·%></calc> |
| 112 | .br |
119 | ··<var><%=·__FILE__·%></var> | 113 | ··<var><%=·__FILE__·%></var> |
| 114 | .br |
120 | ··<library><%=·Prime.each(10).to_a.join(",·")·%></library> | 115 | ··<library><%=·Prime.each(10).to_a.join(",·")·%></library> |
| 116 | .br |
121 | </erb-example> | 117 | </erb-example> |
122 | .Ed | |
123 | .Pp | 118 | .br |
| |
124 | Command | 119 | Command |
| 120 | .nf |
125 | .Dl·"%·erb·-T·-·example.erb" | 121 | \&··"%·erb·-T·-·example.erb" |
| 122 | .fi |
126 | prints | 123 | prints |
127 | .Bd·-literal·-offset·indent | |
128 | <?xml·version="1.0"·?> | 124 | <?xml·version="1.0"·?> |
| 125 | .br |
129 | <erb-example> | 126 | <erb-example> |
| 127 | .br |
130 | ··<calc>2</calc> | 128 | ··<calc>2</calc> |
| 129 | .br |
131 | ··<var>example.erb</var> | 130 | ··<var>example.erb</var> |
| 131 | .br |
132 | ··<library>2,·3,·5,·7</library> | 132 | ··<library>2,·3,·5,·7</library> |
| 133 | .br |
133 | </erb-example> | 134 | </erb-example> |
134 | .Ed | |
135 | .Pp | 135 | .br |
| |
136 | .Sh·SEE·ALSO | 136 | .SH·SEE·ALSO |
137 | .Xr·ruby·1·. | |
138 | .Pp | 137 | \fBruby\fP(1). |
| |
139 | And·see | 138 | And·see |
140 | .Xr·ri·1 | 139 | \fBri\fP(1) |
141 | documentation·for | 140 | documentation·for |
142 | .Li·"ERB" | 141 | "ERB" |
143 | class. | 142 | class. |
144 | .Pp | |
145 | .Sh·REPORTING·BUGS | 143 | .SH·REPORTING·BUGS |
| 144 | .IP·\(bu |
146 | .Bl·-bullet | |
147 | .It | |
148 | Security·vulnerabilities·should·be·reported·via·an·email·to | 145 | Security·vulnerabilities·should·be·reported·via·an·email·to |
149 | .Mt·security@ruby-lang.org·. | 146 | Mt·security@ruby-lang.org. |
150 | Reported·problems·will·be·published·after·being·fixed. | 147 | Reported·problems·will·be·published·after·being·fixed. |
151 | .Pp | |
152 | .It | |
| 148 | .IP·\(bu |
153 | Other·bugs·and·feature·requests·can·be·reported·via·the | 149 | Other·bugs·and·feature·requests·can·be·reported·via·the |
154 | Ruby·Issue·Tracking·System | 150 | Ruby·Issue·Tracking·System |
155 | .Pq·Lk·https://bugs.ruby-lang.org/·. | 151 | (\fBhttps://bugs.ruby-lang.org/\fP). |
156 | Do·not·report·security·vulnerabilities | 152 | Do·not·report·security·vulnerabilities |
157 | via·this·system·because·it·publishes·the·vulnerabilities·immediately. | 153 | via·this·system·because·it·publishes·the·vulnerabilities·immediately. |
158 | .El | |
159 | .Sh·AUTHORS | 154 | .SH·AUTHORS |
160 | Written·by·Masatoshi·SEKI. | 155 | Written·by·Masatoshi·SEKI. |