This kind of construct is bad:
"<div class="foo">#{content}</div>".html_safe
We should really do this:
content_tag(:div, content, :class => 'foo')
or this:
html = "".html_safe
html << "<div class='foor'>".html_safe
html << content
html << "</div>".html_safe
For longer blocks of HTML where there is a lot of logic required to get the pieces content going into it, both of the above quickly become unwieldy and hard to maintain.
Should we be able to do this:
[some logic that generates title, content, tags]
<<~HTML
<div>
<h4>#{title}</h4>
<p>#{tags}</p>
</div>
HTML
...and have all interpolated content be marked as unsafe?
Doing this:
<<~HTML.html_safe
is a Bad Things to be avoided.
I'd be inclined to leave regular interpolated strings as is.
Could this be better dealt with with a new .unsafe method?
Cheers,
Richard