# ERB: Format for trim\_mode string

**URL:** <https://www.ruby-forum.com/t/erb-format-for-trim-mode-string/150863>\
**Category:** Ruby\
**Created:** [October 14, 2008, 11:07am UTC](https://www.ruby-forum.com/t/erb-format-for-trim-mode-string/150863 "2008-10-14T11:07:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Farrel\_L](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/9d8465/32.png) [@Farrel\_L](https://www.ruby-forum.com/u/Farrel_L)\
**Post date:** [October 14, 2008, 11:07am UTC](https://www.ruby-forum.com/t/erb-format-for-trim-mode-string/150863/1 "2008-10-14T11:07:34Z")

</div>

In the documentation for ERB.new  
([http://www.ruby-doc.org/stdlib/libdoc/erb/rdoc/classes/ERB.html#M000649](http://www.ruby-doc.org/stdlib/libdoc/erb/rdoc/classes/ERB.html#M000649))  
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

---

<div class="post-metadata">

**Author:** ![Farrel\_L](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/9d8465/32.png) [@Farrel\_L](https://www.ruby-forum.com/u/Farrel_L)\
**Post date:** [February 2, 2009, 1:03pm UTC](https://www.ruby-forum.com/t/erb-format-for-trim-mode-string/150863/2 "2009-02-02T13:03:09Z")

</div>

Farrel L. wrote:

> In the documentation for ERB.new  
> ([http://www.ruby-doc.org/stdlib/libdoc/erb/rdoc/classes/ERB.html#M000649](http://www.ruby-doc.org/stdlib/libdoc/erb/rdoc/classes/ERB.html#M000649))  
> 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.
