Permalink
Browse files

Added; doctype value is now case-insensitive

should still be defined lowercase
  • Loading branch information...
tj committed Jun 1, 2011
1 parent 9a7dfea commit 6f0e0d7149cd2c1e3e96eef8211c0c9516813659
Showing with 7 additions and 1 deletion.
  1. +5 −0 Readme.md
  2. +1 −1 lib/compiler.js
  3. +1 −0 test/jade.test.js
View
@@ -364,6 +364,11 @@ or
doctype html
+doctypes are case-insensitive, so the following are equivalent:
+
+ doctype Basic
+ doctype basic
+
Will output the _html 5_ doctype. Below are the doctypes
defined by default, which can easily be extended:
View
@@ -82,7 +82,7 @@ Compiler.prototype = {
*/
setDoctype: function(name){
- var doctype = doctypes[name || 'default'];
+ var doctype = doctypes[(name || 'default').toLowerCase()];
if (!doctype) throw new Error('unknown doctype "' + name + '"');
this.doctype = doctype;
this.terse = '5' == name || 'html' == name;
View
@@ -35,6 +35,7 @@ module.exports = {
'test doctypes': function(assert){
assert.equal('<?xml version="1.0" encoding="utf-8" ?>', render('!!! xml'));
assert.equal('<!DOCTYPE html>', render('doctype html'));
+ assert.equal('<!DOCTYPE html>', render('doctype HTML'));
assert.equal('<!DOCTYPE html>', render('!!! 5'));
assert.equal('<!DOCTYPE html>', render('!!!', { doctype:'html' }));
assert.equal('<!DOCTYPE html>', render('!!! html', { doctype:'xml' }));

0 comments on commit 6f0e0d7

Please sign in to comment.