I am running into a problem:
If use something like this:
!!! XML
!!!
%html
%head
%title Myspace
%body
%h1 I am the international space station
%p Sign my guestbook
I get only this as source:
<!DOCTYPE html>
<html>
<head>
<title>Myspace</title>
</head>
<body>
<h1>I am the international space station</h1>
<p>Sign my guestbook</p>
</body>
</html>
According to the HAML documentation, XHTML is the default DOCTYPE apart from for Rails 3 which uses HTML5. You can set the :format
option to override.
In config/environment.rb
:
Haml::Template.options[:format] = :xhtml
For me it doesn't work to put it in environment.rb
.
I set up an initializer in config/initializers/haml.rb
and put in it...
Haml::Template.options[:format] = :xhtml
Be sure to restart the server after adding that.
Then in my pages...
!!! XML
!!!
This produces...
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With