Skip to content
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

Documentation and support for <% foo -%>? #4

Open
xpe opened this issue Mar 31, 2014 · 2 comments
Open

Documentation and support for <% foo -%>? #4

xpe opened this issue Mar 31, 2014 · 2 comments

Comments

@xpe
Copy link

xpe commented Mar 31, 2014

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?

@cirosantilli
Copy link

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

@tmccombs
Copy link

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 -%>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants