#test
- html = "<a href='http://www.a.com'>Test</a>"
= html
The output is
<div id='test'>
<a href='http://www.a.com'>Test</a>
</div>
But I want a output:
<div id='test'>
<a href='http://开发者_开发百科www.a.com'>Test</a>
</div>
Anyone has solutions? Thanks.
haml also provides with its equivalent tag to rails 3's raw method: !=, eg:
!= html
= raw html
or:
= html.html_safe
There was a change in rails 3 so that all content is now html escaped by default. See this blog post from Yehuda Katz for more details.
In order to print the html directly you need to use html_safe on your variable:
#content
.title
%h1= @title
= @content.html_safe
For a more complex example, see this answer to a similar question.
精彩评论