开发者

how do I add attributes to the html tag in haml?

开发者 https://www.devze.com 2023-03-13 18:33 出处:网络
For me to use formtastic, it looks like I need this as my html tag: &l开发者_运维知识库t;html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">

For me to use formtastic, it looks like I need this as my html tag:

 &l开发者_运维知识库t;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

How do I do thsi in HAML?


The same way you add attributes to any other tag in Haml:

%html{:xmlns => "http://www.w3.org/1999/xhtml", "xml:lang" => "en", :lang => "en"}

Haml actually has a built in helper method for these attributes, so you can just do:

%html{html_attrs}

which defaults to 'en-US' as the language, or pass the language string you want to use:

%html{html_attrs('en')}
0

精彩评论

暂无评论...
验证码 换一张
取 消