Rails 3. simple_format 不将结果包装在段落标签中 [英] Rails 3. simple_format do not wrap result in paragraph tags
本文介绍了Rails 3. simple_format 不将结果包装在段落标签中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何让 simple_format 不将返回值包装在 p 标签中?
How can I make simple_format not wrap the returned value in p tags?
simple_format "*"
推荐答案
不幸的是——你不能.如果您在 http://api.rubyonrails.org/classes/ActionView/Helpers/TextHelper.html#method-i-simple_format 你会看到 p 标签无条件地包裹在内容周围.
Unfortunately -- you can't. If you check out the source at http://api.rubyonrails.org/classes/ActionView/Helpers/TextHelper.html#method-i-simple_format you'll see that the p tags are wrapped around the content unconditionally.
您可以创建一个使用 simple_format 代码的帮助程序,但将其修改为不包含 p 标签...
You could create a helper that uses the simple_format code, but modify it to not include the p tags...
这篇关于Rails 3. simple_format 不将结果包装在段落标签中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文