Permalink
Browse files

Merge pull request #774 from geeqie/master

Issue with including multiple extends of the common ancestor solved (#699)
  • Loading branch information...
2 parents dd0db08 + f38734e commit 0c7e6e31d647c4feeabc0ac078ec85a0c518821d @tj tj committed Sep 30, 2012
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);
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;
+};
+
@@ -0,0 +1,2 @@
+block test
+
@@ -0,0 +1,5 @@
+extends empty-block
+
+block test
+ div test1
+
@@ -0,0 +1,5 @@
+extends empty-block
+
+block test
+ div test2
+
@@ -0,0 +1,2 @@
+<div>test1</div>
+<div>test2</div>
@@ -0,0 +1,2 @@
+include auxiliary/extends-empty-block-1
+include auxiliary/extends-empty-block-2

0 comments on commit 0c7e6e3

Please sign in to comment.