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

[Haml] [html2haml] Don't die on XHTML Strict doctypes.

Closes gh-57
This commit is contained in:
Nathan Weizenbaum 2009-11-11 14:46:38 -08:00
parent 90fb7c3066
commit dcad1e06df
3 changed files with 12 additions and 4 deletions

View file

@ -8,6 +8,8 @@
* Don't print warnings when escaping attributes containing non-ASCII characters
in Ruby 1.9.
* Don't crash when parsing an XHTML Strict doctype in `html2haml`.
## [2.2.13](http://github.com/nex3/haml/commit/2.2.13)
* Allow users to specify {file:HAML_REFERENCE.md#encoding_option `:encoding => "ascii-8bit"`}

View file

@ -152,10 +152,7 @@ module Haml
end
version = " #{version}" if version
if strictness
strictness[0] = strictness[0] - 32
strictness = " #{strictness}"
end
strictness = " #{strictness.capitalize}" if strictness
"#{tabulate(tabs)}!!!#{version}#{strictness}\n"
end

View file

@ -112,6 +112,15 @@ HTML
render_rhtml('<p foo="<%= "#{bar} baz" %>"></p>'))
end
# Regression Tests
def test_xhtml_strict_doctype
assert_equal('!!! Strict', render(<<HTML))
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
HTML
end
protected
def render(text, options = {})