1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

Enable :html5 and add doctype test

This commit is contained in:
Mislav Marohnić 2008-02-27 15:20:44 +01:00
parent cd1dffcddc
commit cfbe299d57
2 changed files with 8 additions and 3 deletions

View file

@ -24,9 +24,9 @@ module Haml
# to produce the Haml document. # to produce the Haml document.
attr :precompiled, true attr :precompiled, true
# True when the output is XHTML # True if the output is not HTML
def xhtml? def xhtml?
@options[:output] == :xhtml not html?
end end
# True if the output is any flavor of HTML # True if the output is any flavor of HTML
@ -74,7 +74,7 @@ module Haml
} }
@options.rec_merge! options @options.rec_merge! options
unless [:xhtml, :html4].include?(@options[:output]) unless [:xhtml, :html4, :html5].include?(@options[:output])
raise Haml::Error, "Invalid output format #{@options[:output].inspect}" raise Haml::Error, "Invalid output format #{@options[:output].inspect}"
end end

View file

@ -432,4 +432,9 @@ class EngineTest < Test::Unit::TestCase
def test_xml_prolog_and_doctype_dont_result_in_a_leading_whitespace_in_html def test_xml_prolog_and_doctype_dont_result_in_a_leading_whitespace_in_html
assert_no_match /^\s+/, render("!!! xml\n!!!", :output => :html4) assert_no_match /^\s+/, render("!!! xml\n!!!", :output => :html4)
end end
# HTML5
def test_html5_doctype
assert_equal %{<!DOCTYPE html>\n}, render('!!!', :output => :html5)
end
end end