Project

General

Profile

Actions

Bug #10630

closed

ERB tags nested in escaped blocks are skipped

Added by tonci (Tonči Damjanić) almost 10 years ago. Updated about 7 years ago.

Status:
Third Party's Issue
Assignee:
Target version:
ruby -v:
2.3.5
[ruby-core:67034]

Description

Hello,

First of all, is this a good place to report Erubis bugs? Their GitHub repo is stale (no action since 2011) and I was suggested by the Rails team to try here.

GitHub ticket: https://github.com/kwatch/erubis/issues/6
Repro example: https://github.com/rails/rails/issues/18098#issuecomment-67667400


It seems that ERB (Erubis) 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.

Updated by nobu (Nobuyoshi Nakada) almost 10 years ago

  • Status changed from Open to Third Party's Issue

Erubis is not a part of ruby repository.
We can do nothing for it.

Updated by tonci (Tonči Damjanić) almost 10 years ago

OK. Who is maintaining Erubis then? Is it possible to reach out to them and have the bug fixed?

The Erubis repo is stale and the project seems to be deprecated by the author.

Updated by nobu (Nobuyoshi Nakada) almost 10 years ago

Tonči Damjanić wrote:

The Erubis repo is stale and the project seems to be deprecated by the author.

Nobody would maintain deprecated projects.

Updated by tonci (Tonči Damjanić) almost 10 years ago

Yes, I understand that, but doesn't that fact affect future Ruby releases?

Updated by tonci (Tonči Damjanić) about 7 years ago

  • Status changed from Third Party's Issue to Open
  • ruby -v changed from 2.1.5 to 2.3.5

Reopening, since there is movement on the ERB front in the upcoming v2.5.0.

Updated by nobu (Nobuyoshi Nakada) about 7 years ago

  • Status changed from Open to Rejected

It seems an Erubis specific bug.
ERB hasn't had that issue.

Updated by k0kubun (Takashi Kokubun) about 7 years ago

  • Status changed from Rejected to Third Party's Issue

ERB (Erubis)

ERB and Erubis are totally different things.

$ irb -rerb -rerubis -rerubi
irb(main):001:0> RUBY_VERSION
=> "2.5.0"
irb(main):002:0> erb = "<div><%%= Results: <%= 'first' %> | <%= 'second' %> | <%= 'third' %> %></div>"
=> "<div><%%= Results: <%= 'first' %> | <%= 'second' %> | <%= 'third' %> %></div>"
irb(main):003:0> ERB.new(erb).result
=> "<div><%= Results: first | second | third %></div>"
irb(main):004:0> Erubis::Eruby.new(erb).result
=> "<div><%= Results: <%= 'first' %> | second | third %></div>"
irb(main):005:0> eval Erubi::Engine.new(erb).src
=> "<div><%= Results: <%= 'first' %> | second | third %></div>"

As you can see, ERB (which is included in Ruby core) is working as expected, and Erubis (used in older Rails) and Erubi (used in recent Rails) are not.

So you should report this to:
Erubis: https://github.com/kwatch/erubis
Erubi: https://github.com/jeremyevans/erubi

Updated by tonci (Tonči Damjanić) about 7 years ago

Thanks!

I've reported it to Erubis a while back (https://github.com/kwatch/erubis/issues/6), but since that project is stale, I've reported it to Erubi as well (https://github.com/jeremyevans/erubi/issues/11).

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0