New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Explain ERB space removal. #16790
Explain ERB space removal. #16790
Conversation
I'm for linking to ERB docs. |
👍 for linking, I'm weary to add this much detail to the overview of a constant. |
Shall we just remove the line then? We already have the link to erubis. |
@cirosantilli yes please. |
Well, idk This line exists to explain why there are different tags available, from the line above:
There is a very subtle but obvious difference between them, so it would be nice to leave a small statement that warns the user about |
211f268
to
e5997aa
Compare
I am 👎 There isn't even anything on the erubis docs that mentions But there is mention of trimming whitespace, except using a different tag:
|
That is true. I came to those conclusions after a lot of experimenting. The docs there are not very complete. We could patch their docs. |
There is even an open ticket on erubis for this: kwatch/erubis#4 |
Ping: what will we do about this? I see the following options:
We can then patch erubis docs if necessary. |
Clarifying without going into too much detail will be ideal imo. |
e5997aa
to
700ec89
Compare
How about the current version? |
ping @zzak |
@@ -33,7 +33,9 @@ module ActionView #:nodoc: | |||
# | |||
# If you absolutely must write from within a function use +concat+. | |||
# | |||
# <%- and -%> suppress leading and trailing whitespace, including the trailing newline, and can be used interchangeably with <% and %>. | |||
# When on a line that only contains whitespaces except for the tag, <% %> suppress leading and trailing whitespace, | |||
# including the trailing newline. <% %> and <%- -%> are the same. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is true. %>
and -%>
and different.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you give an example where they are different?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is only in the <%=
case. So this is right.
Explain ERB space removal. [ci skip]
The current phrase about space removal is misleading, and too hard to understand without an example. I propose that we either:
It is misleading because:
-%>
is not interchangeable with%>
when using the equals sign<%= %>
.If you think the new explanation is too long, we can consider removing everything after "The line is not removed when" as that use case is less common: at least the new information won't be ambiguous and will have a clarifying example.