Reputation: 349
I cannot find it anywhere but in the project I am working with.
It doesn't work in the same way as <%=
(I tried to change), but I can't understand the difference.
<span class="option-content" placeholder="<%=t('pages.edit.option')%>">
<%%= content %>
</span>
Upvotes: 2
Views: 2695
Reputation: 2867
In short, ERb processes double-percent marks into single-percent marks.
It looks like you're using one layer of ERb templates to generate another layer of ERb templates.
The first layer of ERb doesn't need a variable called content
, just the t
method:
<span class="option-content" placeholder="<%=t('pages.edit.option')%>">
<%%= content %>
</span>
That first layer is rendered to produce the second layer:
<span class="option-content" placeholder="Edit">
<%= content %>
</span>
As you can see, that is also an ERb template. I expect that something else, later on, takes that second ERb and uses it to render something like:
<span class="option-content" placeholder="Edit">
Hello, world.
</span>
Upvotes: 2
Reputation: 23661
The ERB dock here says
<% Ruby code -- inline with output %>
<%= Ruby expression -- replace with result %>
<%# comment -- ignored -- useful in testing %>
% a line of Ruby code -- treated as <% line %> (optional -- see ERB.new)
%% replaced with % if first thing on a line and % processing is used
<%% or %%> -- replace with <% or %> respectively
this means the
<%%= content %>
will will be replaced with
<%= value of content %>
Upvotes: 5