You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Embedded Ruby implementation for Sinatra (1.4.7) removes (some) newlines. Basically, if an interpolated string is on a line by itself (no text either before or after), the newline goes away. The Ruby (2.0.0p481) ERB library does not exhibit this problem.
Sinatra uses Tilt behind the scenes to dispatch calls to its render helper (and associated erb, haml, etc. helpers) to different rendering engines. When Tilt invokes ERB, it sets trim_mode to <> by default, which "omits newlines for lines starting with <% and ending in %>." Your call to ERB sets trim_mode to nil (by dint of your not including it in the call), so it doesn't trim anything.
This is the source of the inconsistency in your results. To align the results, you can either:
Use an alternate ERB implementation such as Erubis or Erubi
I'll defer the mailing list question to @zzak! I'm not sure if anyone is moderating it; last time I looked at it there had only been a handful of posts in the past year.
The Embedded Ruby implementation for Sinatra (1.4.7) removes (some) newlines. Basically, if an interpolated string is on a line by itself (no text either before or after), the newline goes away. The Ruby (2.0.0p481) ERB library does not exhibit this problem.
See https://gist.github.com/RichMorin/055bb69484207885ab51e7cdd6ac44dd for details.
-r
P.S. I tried posting this to the mailing list, but (like a post I made a couple of weeks ago) it was held for review. Hello?
The text was updated successfully, but these errors were encountered: