From: takashikkbn@...
Date: 2017-11-08T14:09:59+00:00
Subject: [ruby-core:83700] [Ruby trunk Bug#10630][Third Party's Issue] ERB tags nested in escaped blocks are skipped
Issue #10630 has been updated by k0kubun (Takashi Kokubun).
Status changed from Rejected to Third Party's Issue
> ERB (Erubis)
ERB and Erubis are totally different things.
~~~ ruby
$ irb -rerb -rerubis -rerubi
irb(main):001:0> RUBY_VERSION
=> "2.5.0"
irb(main):002:0> erb = "
<%%= Results: <%= 'first' %> | <%= 'second' %> | <%= 'third' %> %>
"
=> "<%%= Results: <%= 'first' %> | <%= 'second' %> | <%= 'third' %> %>
"
irb(main):003:0> ERB.new(erb).result
=> "<%= Results: first | second | third %>
"
irb(main):004:0> Erubis::Eruby.new(erb).result
=> "<%= Results: <%= 'first' %> | second | third %>
"
irb(main):005:0> eval Erubi::Engine.new(erb).src
=> "<%= Results: <%= 'first' %> | second | third %>
"
~~~
As you can see, ERB (which is included in Ruby core) is working as expected, and Erubis and Erubis are not.
So you should report this to:
Erubis: https://github.com/kwatch/erubis
Erubi: https://github.com/jeremyevans/erubi
----------------------------------------
Bug #10630: ERB tags nested in escaped blocks are skipped
https://bugs.ruby-lang.org/issues/10630#change-67725
* Author: tonci (Ton��i Damjani��)
* Status: Third Party's Issue
* Priority: Normal
* Assignee: ruby-core
* Target version: next minor
* ruby -v: 2.3.5
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
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:
```
<%%= Results: <%= 'first' %> | <%= 'second' %> | <%= 'third' %> %>
```
Produces the following output:
```
<%= Results: <%= 'first' %> | second | third %>
```
Expected output is:
```
<%= Results: first | second | third %>
```
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.
--
https://bugs.ruby-lang.org/
Unsubscribe: