Skip to content

Commit b7f69f3

Browse files
committed
Provide option to set the default doctype name
1 parent ed56981 commit b7f69f3

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/Phug/Compiler.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ public function __construct(array $options = null)
113113
'basedir' => null,
114114
'extensions' => ['', '.pug', '.jade'],
115115
'default_tag' => 'div',
116+
'default_doctype' => 'html',
116117
'pre_compile' => [],
117118
'pre_compile_node' => [],
118119
'post_compile' => [],

src/Phug/Compiler/DoctypeCompiler.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ public function compileNode(NodeInterface $node, ElementInterface $parent = null
1919
);
2020
}
2121

22-
return new DoctypeElement($node->getName());
22+
$name = $node->getName() ?: $this->getCompiler()->getOption('default_doctype');
23+
24+
return new DoctypeElement($name);
2325
}
2426
}

0 commit comments

Comments
 (0)