Forum: Ruby ERB: Format for trim_mode string

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
05be5d6610e2c3f1780aa0e39e902e93?d=identicon&s=25 Farrel Lifson (Guest)
on 2008-10-14 11:07
(Received via mailing list)
In the documentation for ERB.new
(http://www.ruby-doc.org/stdlib/libdoc/erb/rdoc/cla...)
it says:

"If trim_mode is passed a String containing one or more of the
following modifiers, ERB will adjust its code generation as listed:

    %  enables Ruby code processing for lines beginning with %
    <> omit newline for lines starting with <% and ending in %>
    >  omit newline for lines ending in %>"

What is the format for this trim_mode string? I specifically want to
use the % and <> modes. I tried passing through "%<>" but it doesn't
seem to be working.

Farrel
5e0c373d5d6bd91564d9b2cc795b16d7?d=identicon&s=25 Wu Junchen (phoenix520)
on 2009-02-02 13:03
Farrel Lifson wrote:
> In the documentation for ERB.new
> (http://www.ruby-doc.org/stdlib/libdoc/erb/rdoc/cla...)
> it says:
>
> "If trim_mode is passed a String containing one or more of the
> following modifiers, ERB will adjust its code generation as listed:
>
>     %  enables Ruby code processing for lines beginning with %
>     <> omit newline for lines starting with <% and ending in %>
>     >  omit newline for lines ending in %>"
>
> What is the format for this trim_mode string? I specifically want to
> use the % and <> modes. I tried passing through "%<>" but it doesn't
> seem to be working.
>
> Farrel

maybe your <% ruby code %> must start at the beginning of the line,there
mustn't be no more white space.
This topic is locked and can not be replied to.