Skip to content

Commit 2d79b88

Browse files
doublerebelForbesLindesay
authored andcommitted
use native path module to parse include/extends file extension (pugjs#2334)
* [test] relative include without extension fails * [fix] use native path to parse extension
1 parent c695d7f commit 2d79b88

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

lib/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function compileBody(str, options){
5151
lex: lex,
5252
parse: function (tokens, filename) {
5353
tokens = tokens.map(function (token) {
54-
if (token.type === 'path' && token.val.indexOf('.') === -1) {
54+
if (token.type === 'path' && path.extname(token.val) === '') {
5555
return {
5656
type: 'path',
5757
line: token.line,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
extends ../../cases/auxiliary/layout
2+
3+
block content
4+
include ../../cases/auxiliary/include-from-root
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<html>
2+
<head>
3+
<title>My Application</title>
4+
</head>
5+
<body>
6+
<h1>hello</h1>
7+
</body>
8+
</html>
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include ../cases/auxiliary/extends-relative.pug

0 commit comments

Comments
 (0)