我遇到了一个问题:
如果使用这样的东西:
!!! XML
!!!
%html
%head
%title Myspace
%body
%h1 I am the international space station
%p Sign my guestbook
我只得到这个作为来源:
<!DOCTYPE html>
<html>
<head>
<title>Myspace</title>
</head>
<body>
<h1>I am the international space station</h1>
<p>Sign my guestbook</p>
</body>
</html>
最佳答案
根据HAML documentation , 除了使用 HTML5 的 Rails 3 之外,XHTML 是默认的 DOCTYPE。您可以将 :format
选项设置为覆盖。
在 config/environment.rb
中:
Haml::Template.options[:format] = :xhtml
关于html - Rails 3 中的 HAML 仅生成 doctype html,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4798650/