2008-12-29 04:26:34 -05:00
|
|
|
.\"Ruby is copyrighted by Yukihiro Matsumoto <matz@netlab.jp>.
|
2015-05-23 05:38:49 -04:00
|
|
|
.Dd November 15, 2012
|
2008-12-29 04:26:34 -05:00
|
|
|
.Dt ERB(1) "" "Ruby Programmers 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
|
2009-10-26 02:44:31 -04:00
|
|
|
is a command line front-end for
|
2008-12-29 04:26:34 -05:00
|
|
|
.Li "ERB"
|
|
|
|
library, which is an implementation of eRuby.
|
2009-10-26 02:44:31 -04:00
|
|
|
.Pp
|
2012-11-14 23:22:44 -05:00
|
|
|
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
|
2008-12-29 04:26:34 -05:00
|
|
|
purposes of generating document information details and/or flow control.
|
2009-10-26 02:44:31 -04:00
|
|
|
.Pp
|
2008-12-29 04:26:34 -05:00
|
|
|
.Nm
|
|
|
|
is a part of
|
|
|
|
.Nm Ruby .
|
|
|
|
.Pp
|
|
|
|
.Sh OPTIONS
|
|
|
|
.Bl -tag -width "1234567890123" -compact
|
|
|
|
.Pp
|
|
|
|
.It Fl -version
|
2009-10-26 02:44:31 -04:00
|
|
|
Prints the version of
|
2008-12-29 04:26:34 -05:00
|
|
|
.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 (:).
|
2009-10-26 02:44:31 -04:00
|
|
|
.Pp
|
2010-12-01 06:07:03 -05:00
|
|
|
You can omit the one for internal encodings, then the value
|
2008-12-29 04:26:34 -05:00
|
|
|
.Pf ( Li "Encoding.default_internal" ) will be nil.
|
|
|
|
.Pp
|
|
|
|
.It Fl P
|
2009-10-26 02:44:31 -04:00
|
|
|
Evaluates lines starting with
|
2008-12-29 04:26:34 -05:00
|
|
|
.Li "%"
|
|
|
|
as Ruby code and removes the tailing EOLs.
|
|
|
|
.Pp
|
|
|
|
.It Fl S Ar level
|
|
|
|
Specifies the safe level in which eRuby script will run.
|
|
|
|
.Pp
|
|
|
|
.It Fl T Ar mode
|
2009-10-26 02:44:31 -04:00
|
|
|
Specifies trim mode (default 0).
|
2008-12-29 04:26:34 -05:00
|
|
|
.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
|
|
|
|
.Pp
|
|
|
|
.It Fl U
|
|
|
|
can be one of
|
2010-12-01 06:07:03 -05:00
|
|
|
Sets the default value for internal encodings
|
2008-12-29 04:26:34 -05:00
|
|
|
.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
|
2010-12-01 06:07:03 -05:00
|
|
|
Prints a summary of the options.
|
2008-12-29 04:26:34 -05:00
|
|
|
.Pp
|
|
|
|
.It Fl n
|
|
|
|
Used with
|
|
|
|
.Fl x .
|
2009-10-26 02:44:31 -04:00
|
|
|
Prepends the line number to each line in the output.
|
2008-12-29 04:26:34 -05:00
|
|
|
.Pp
|
|
|
|
.It Fl v
|
2009-10-26 02:44:31 -04:00
|
|
|
Enables verbose mode.
|
2008-12-29 04:26:34 -05:00
|
|
|
.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
|
2009-10-26 02:44:31 -04:00
|
|
|
.Pp
|
2008-12-29 04:26:34 -05:00
|
|
|
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 .
|
2009-10-26 02:44:31 -04:00
|
|
|
.Pp
|
|
|
|
And see
|
2008-12-29 04:26:34 -05:00
|
|
|
.Xr ri 1
|
2009-10-26 02:44:31 -04:00
|
|
|
documentation for
|
2008-12-29 04:26:34 -05:00
|
|
|
.Li "ERB"
|
|
|
|
class.
|
|
|
|
.Pp
|
|
|
|
.Sh REPORTING BUGS
|
|
|
|
.Bl -bullet
|
2009-10-26 02:44:31 -04:00
|
|
|
.Li Security vulnerabilities should be reported via an email to
|
2016-09-26 08:39:18 -04:00
|
|
|
.Aq security@ruby-lang.org .
|
2012-11-14 23:22:44 -05:00
|
|
|
Reported problems will be published after being fixed.
|
2008-12-29 04:26:34 -05:00
|
|
|
.Pp
|
|
|
|
.Li And you can report other bugs and feature requests via the
|
2016-09-23 07:21:52 -04:00
|
|
|
Ruby Issue Tracking System
|
|
|
|
.Pq Lk https://bugs.ruby-lang.org/ .
|
2008-12-29 04:26:34 -05:00
|
|
|
Do not report security vulnerabilities
|
2010-12-01 06:07:03 -05:00
|
|
|
via the system because it publishes the vulnerabilities immediately.
|
2008-12-29 04:26:34 -05:00
|
|
|
.El
|
|
|
|
.Sh AUTHORS
|
|
|
|
Written by Masatoshi SEKI.
|