Skip to content

Commit

Permalink
Merge pull request #774 from geeqie/master
Browse files Browse the repository at this point in the history
Issue with including multiple extends of the common ancestor solved (#699)
  • Loading branch information
tj committed Sep 30, 2012
2 parents dd0db08 + f38734e commit 0c7e6e3
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/parser.js
Expand Up @@ -10,7 +10,8 @@
*/ */


var Lexer = require('./lexer') var Lexer = require('./lexer')
, nodes = require('./nodes'); , nodes = require('./nodes')
, utils = require('./utils');


/** /**
* Initialize `Parser` with the given input `str` and `filename`. * Initialize `Parser` with the given input `str` and `filename`.
Expand Down Expand Up @@ -485,7 +486,7 @@ Parser.prototype = {
var path = join(dir, path) var path = join(dir, path)
, str = fs.readFileSync(path, 'utf8') , str = fs.readFileSync(path, 'utf8')
, parser = new Parser(str, path, this.options); , parser = new Parser(str, path, this.options);
parser.blocks = this.blocks; parser.blocks = utils.extend({}, this.blocks);
parser.mixins = this.mixins; parser.mixins = this.mixins;


this.context(parser); this.context(parser);
Expand Down
11 changes: 10 additions & 1 deletion lib/utils.js
Expand Up @@ -46,4 +46,13 @@ var escape = exports.escape = function(str) {


exports.text = function(str){ exports.text = function(str){
return interpolate(escape(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 changes: 2 additions & 0 deletions test/cases/auxiliary/empty-block.jade
@@ -0,0 +1,2 @@
block test

5 changes: 5 additions & 0 deletions test/cases/auxiliary/extends-empty-block-1.jade
@@ -0,0 +1,5 @@
extends empty-block

block test
div test1

5 changes: 5 additions & 0 deletions test/cases/auxiliary/extends-empty-block-2.jade
@@ -0,0 +1,5 @@
extends empty-block

block test
div test2

2 changes: 2 additions & 0 deletions test/cases/include-extends-of-common-template.html
@@ -0,0 +1,2 @@
<div>test1</div>
<div>test2</div>
2 changes: 2 additions & 0 deletions test/cases/include-extends-of-common-template.jade
@@ -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.