如何将此 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>
最佳答案
准确地说是添加了类。如果你有一堆行,你也可以使用带有 content_tags 的 block 。
content_tag(:p, :class => 'msg') do
content_tag(:span, "Most ... friends.", :class => "strong") +
content_tag(:br) +
content_tag(:span, "- Lord .. ", :class => "emphasize")
end
关于html - 在 Ruby on Rails 中将 HTML 转换为 content_tag,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4536166/