Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

more specific type check for TemplateRefs, allow variables for extends

  • Loading branch information...
commit d23181fb328fde75a33e37b281ef5d62e5d10fc7 1 parent d68622c
@jlongster authored
Showing with 9 additions and 6 deletions.
  1. +3 −3 src/parser.js
  2. +6 −3 tests/test.js
View
6 src/parser.js
@@ -192,9 +192,9 @@ var Parser = Object.extend({
var node = new nodeType(tag.lineno, tag.colno);
node.template = this.parsePrimary();
- if(!((node.template instanceof nodes.Literal ||
- node.template instanceof nodes.Value) &&
- lib.isString(node.template.value))) {
+ if(!(node.template instanceof nodes.Literal &&
+ lib.isString(node.template.value)) &&
+ !(node.template instanceof nodes.Symbol)) {
this.fail('parseExtends: string or value expected');
}
View
9 tests/test.js
@@ -585,6 +585,10 @@ describe('compiler', function() {
'{% block block1 %}BAR{% endblock %}' +
'{% block block2 %}BAZ{% endblock %}');
s.should.equal('FooBARBAZFizzle');
+
+ s = render('hola {% extends tmpl %} hizzle mumble',
+ { tmpl: 'base.html' });
+ s.should.equal('FooBarBazFizzle');
});
it('should render parent blocks with super()', function() {
@@ -601,9 +605,8 @@ describe('compiler', function() {
{ name: 'james' });
s.should.equal('hello world FooInclude james');
-
- s = render('hello world {% include templ %}',
- { name: 'thedude', templ: "include.html" });
+ s = render('hello world {% include tmpl %}',
+ { name: 'thedude', tmpl: "include.html" });
s.should.equal('hello world FooInclude thedude');
});
Please sign in to comment.
Something went wrong with that request. Please try again.