ker*_*lin 9 html ruby ruby-on-rails
您如何将此HTML转换为Rails content_tag
助手语法/格式?
<p class="msg">
<span class="strong">Most people enjoy the inferiority of their best friends.</span>
<br>
<span class="emphasize"> - Lord Chesterfield</span>
</p>
Run Code Online (Sandbox Code Playgroud)
Adi*_*ghi 25
确切地说,添加了类.如果你有一堆行,你也可以使用带有content_tags的块.
content_tag(:p, :class => 'msg') do
content_tag(:span, "Most ... friends.", :class => "strong") +
content_tag(:br) +
content_tag(:span, "- Lord .. ", :class => "emphasize")
end
Run Code Online (Sandbox Code Playgroud)