配置Rails输出HTML输出而不是XHTML [英] Configure Rails to output HTML output instead of XHTML
本文介绍了配置Rails输出HTML输出而不是XHTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何配置Ruby on Rails在使用助手(form,javascript,css等)时输出标准HTML代码而不是XHTML?
$ b I 不要最后想要斜杠:
< input name =emailtype =text/>
解决方案
这个答案包含在MarkusQ提供的链接中,但我想我可以拼出来。
您必须修改代码而不是渲染所有标记,您可以通过将以下代码包含到lib / dont_use_xhtml.rb
module ActionView :: Helpers :: TagHelper
别名:tag_without_backslash:tag
def tag (name,options = nil,open = true,escape = true)
tag_without_backslash(name,options,open,escape)
end
end
How do I configure Ruby on Rails to output standard HTML code instead of XHTML when using helpers (form, javascript, css, etc.)?
I don't want to have the slash at the end:
<input name="email" type="text" />
解决方案
This answer is contained in the link provided by MarkusQ, but I figured I could spell it out exactly.
You have to modify the code than renders all tags, you can do that by including the following code into something like lib/dont_use_xhtml.rb
module ActionView::Helpers::TagHelper
alias :tag_without_backslash :tag
def tag(name, options = nil, open = true, escape = true)
tag_without_backslash(name, options, open, escape)
end
end
这篇关于配置Rails输出HTML输出而不是XHTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文