Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #774 from geeqie/master

Issue with including multiple extends of the common ancestor solved (#699)
  • Loading branch information...
commit 0c7e6e31d647c4feeabc0ac078ec85a0c518821d 2 parents dd0db08 + f38734e
TJ Holowaychuk tj authored
5 lib/parser.js
View
@@ -10,7 +10,8 @@
*/
var Lexer = require('./lexer')
- , nodes = require('./nodes');
+ , nodes = require('./nodes')
+ , utils = require('./utils');
/**
* Initialize `Parser` with the given input `str` and `filename`.
@@ -485,7 +486,7 @@ Parser.prototype = {
var path = join(dir, path)
, str = fs.readFileSync(path, 'utf8')
, parser = new Parser(str, path, this.options);
- parser.blocks = this.blocks;
+ parser.blocks = utils.extend({}, this.blocks);
parser.mixins = this.mixins;
this.context(parser);
11 lib/utils.js
View
@@ -46,4 +46,13 @@ var escape = exports.escape = function(str) {
exports.text = function(str){
return interpolate(escape(str));
-};
+};
+
+// Extend a given object with all the properties of the source
+exports.extend = function(obj, src) {
+ for (var prop in src) {
+ obj[prop] = src[prop];
+ }
+ return obj;
+};
+
2  test/cases/auxiliary/empty-block.jade
View
@@ -0,0 +1,2 @@
+block test
+
5 test/cases/auxiliary/extends-empty-block-1.jade
View
@@ -0,0 +1,5 @@
+extends empty-block
+
+block test
+ div test1
+
5 test/cases/auxiliary/extends-empty-block-2.jade
View
@@ -0,0 +1,5 @@
+extends empty-block
+
+block test
+ div test2
+
2  test/cases/include-extends-of-common-template.html
View
@@ -0,0 +1,2 @@
+<div>test1</div>
+<div>test2</div>
2  test/cases/include-extends-of-common-template.jade
View
@@ -0,0 +1,2 @@
+include auxiliary/extends-empty-block-1
+include auxiliary/extends-empty-block-2
Please sign in to comment.
Something went wrong with that request. Please try again.