Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: jadejs/jade
...
head fork: jadejs/jade
  • 7 commits
  • 6 files changed
  • 0 commit comments
  • 3 contributors
5 lib/parser.js
View
@@ -135,6 +135,9 @@ Parser.prototype = {
this.context(parser);
var ast = parser.parse();
this.context();
+ // hoist mixins
+ for (var name in this.mixins)
+ ast.unshift(this.mixins[name]);
return ast;
}
@@ -475,6 +478,8 @@ Parser.prototype = {
var path = join(dir, path)
, str = fs.readFileSync(path, 'utf8')
, parser = new Parser(str, path, this.options);
+ parser.blocks = this.blocks;
+ parser.mixins = this.mixins;
this.context(parser);
var ast = parser.parse();
7 test/cases/auxiliary/layout.include.jade
View
@@ -0,0 +1,7 @@
+html
+ head
+ title My Application
+ block head
+ body
+ block content
+ include window
14 test/cases/inheritance.extend.include.html
View
@@ -0,0 +1,14 @@
+<html>
+ <head>
+ <title>My Application</title>
+ <script src="jquery.js"></script>
+ </head>
+ <body>
+ <h2>Page</h2>
+ <p>Some content</p>
+ <div class="window"><a href="#" class="close">Close</a>
+ <h2>Awesome</h2>
+ <p>Now we can extend included blocks!</p>
+ </div>
+ </body>
+</html>
13 test/cases/inheritance.extend.include.jade
View
@@ -0,0 +1,13 @@
+
+extend auxiliary/layout.include
+
+block head
+ script(src='jquery.js')
+
+block content
+ h2 Page
+ p Some content
+
+block window-content
+ h2 Awesome
+ p Now we can extend included blocks!
9 test/cases/inheritance.extend.mixins.html
View
@@ -0,0 +1,9 @@
+<html>
+ <head>
+ <title>My Application</title>
+ </head>
+ <body>
+ <h1>The meaning of life</h1>
+ <p>Foo bar baz!</p>
+ </body>
+</html>
11 test/cases/inheritance.extend.mixins.jade
View
@@ -0,0 +1,11 @@
+
+extend auxiliary/layout
+
+mixin article(title)
+ if title
+ h1= title
+ block
+
+block content
+ +article("The meaning of life")
+ p Foo bar baz!

No commit comments for this range

Something went wrong with that request. Please try again.