Skip to content

Commit

Permalink
Fix block warnings when block is inside "code"
Browse files Browse the repository at this point in the history
[fixes #1589]
  • Loading branch information
ForbesLindesay committed Jul 16, 2014
1 parent 1ed3d42 commit ef43965
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ exports.walkAST = function walkAST(ast, before, after) {
case 'Mixin':
case 'Tag':
case 'When':
case 'Code':
ast.block && walkAST(ast.block, before, after);
break;
case 'Attrs':
case 'BlockComment':
case 'Code':
case 'Comment':
case 'Doctype':
case 'Filter':
Expand All @@ -44,4 +44,4 @@ exports.walkAST = function walkAST(ast, before, after) {
break;
}
after && after(ast);
};
};
1 change: 1 addition & 0 deletions test/cases/blocks-in-if.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>ajax contents</p>
19 changes: 19 additions & 0 deletions test/cases/blocks-in-if.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//- see https://github.com/visionmedia/jade/issues/1589
-var ajax = true

-if( ajax )
//- return only contents if ajax requests
block contents
p ajax contents

-else
//- return all html
doctype html
html
head
meta( charset='utf8' )
title sample
body
block contents
p all contetns

0 comments on commit ef43965

Please sign in to comment.