Navigation Menu

Skip to content

Commit

Permalink
Handle the HTML 5 doctype and add doctype tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
reid committed Jan 7, 2010
1 parent 12e4e29 commit 9257949
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/haml.js
Expand Up @@ -24,6 +24,8 @@ Haml.to_html = function (json) {
return '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n';
case '1.1':
return '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\n';
case '5':
return "<!DOCTYPE html>\n";
case 'strict':
return '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n';
}
Expand Down
5 changes: 5 additions & 0 deletions test/doctype.haml
@@ -0,0 +1,5 @@
!!!
!!! strict
!!! 1.1
!!! 5
!!! xml
5 changes: 5 additions & 0 deletions test/doctype.html
@@ -0,0 +1,5 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<!DOCTYPE html>
<?xml version='1.0' encoding='utf-8' ?>

0 comments on commit 9257949

Please sign in to comment.