mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
force :xhtml if options[:mime_type] == 'text/xml'
If options[:mime_type] is defined and the value == 'text/xml' then an instanced Haml::Engine will always use :xhtml
This commit is contained in:
parent
82e2e35c80
commit
6d91d9fb83
2 changed files with 32 additions and 0 deletions
|
@ -101,6 +101,8 @@ module Haml
|
|||
@options.merge! options.reject {|k, v| v.nil?}
|
||||
@index = 0
|
||||
|
||||
@options[:format] = :xhtml if @options[:mime_type] == 'text/xml'
|
||||
|
||||
unless [:xhtml, :html4, :html5].include?(@options[:format])
|
||||
raise Haml::Error, "Invalid output format #{@options[:format].inspect}"
|
||||
end
|
||||
|
|
|
@ -1528,6 +1528,36 @@ HAML
|
|||
render("%div{data_val, :data => {:foo => 'blip', :brat => 'wurst'}}"))
|
||||
end
|
||||
|
||||
def test_xml_doc_using_html5_format_and_mime_type
|
||||
assert_equal(<<XML, render(<<HAML, { :format => :html5, :mime_type => 'text/xml' }))
|
||||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<root>
|
||||
<element />
|
||||
<hr />
|
||||
</root>
|
||||
XML
|
||||
!!! XML
|
||||
%root
|
||||
%element/
|
||||
%hr
|
||||
HAML
|
||||
end
|
||||
|
||||
def test_xml_doc_using_html4_format_and_mime_type
|
||||
assert_equal(<<XML, render(<<HAML, { :format => :html4, :mime_type => 'text/xml' }))
|
||||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<root>
|
||||
<element />
|
||||
<hr />
|
||||
</root>
|
||||
XML
|
||||
!!! XML
|
||||
%root
|
||||
%element/
|
||||
%hr
|
||||
HAML
|
||||
end
|
||||
|
||||
# New attributes
|
||||
|
||||
def test_basic_new_attributes
|
||||
|
|
Loading…
Add table
Reference in a new issue