erubis icon indicating copy to clipboard operation
erubis copied to clipboard

ERB tags nested in escaped blocks are skipped

Open toncid opened this issue 10 years ago • 2 comments

Hello,

I'm importing a ticket from Rails: https://github.com/rails/rails/issues/18098

Please find @rafaelfranca's comment (https://github.com/rails/rails/issues/18098#issuecomment-67667400) for a repro example.


It seems that ERB doesn't handle well tags embedded within another tag. My goal is to produce ERB code with some values prefilled in the first pass.

Input ERB code:

    <div>
        <%%= Results: <%= 'first' %> | <%= 'second' %> | <%= 'third' %> %>
    </div>

Produces the following output:

    <div>
        <%= Results: <%= 'first' %> | second | third %>
    </div>

Expected output is:

    <div>
        <%= Results: first | second | third %>
    </div>

The first nested ERB tag is skipped. The same happens when there is just one block nested.

This is reproducible in Rails v4.1.8, which is using Erubis v2.7.0.

toncid avatar Dec 19 '14 17:12 toncid

I think this is the wrong repo. This repo was no updated since 2011. If i recall correctly, ERubis is part of Ruby now.

seuros avatar Dec 19 '14 17:12 seuros

Hm, that seems unlikely. The Erubis gem hasn't been updated since 2011 as well.

toncid avatar Dec 19 '14 17:12 toncid