erubis
erubis copied to clipboard
Documentation and support for <% foo -%>?
ERB has the whitespace / newline suppression feature, but I have not seen newline suppression of <% foo %> in mentioned in Erubis documentation anywhere. I've also tried it out with no luck. Is this by design?
It's not very clearly documented: after many tests I think this is how it works: http://stackoverflow.com/a/25626629/895245
In particular:
-
<% %>
only removes the line if the entire line contains only whitespaces -
<%= -%>
removes what comes after the tag if there are only whitespaces, regardeless of what comes before. -
-
without=
makes no difference
the absense of -%>
support is problematic for me. I have something like:
var = <% if cond -%>
value1
<% elsif cond2 -%>
value2
<% else -%>
value3 that
is complicated and takes multiple lines
<% end -%>