Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"news" in for-loop variable name gives TypeError #42

Open
johannesmik opened this issue Jul 30, 2017 · 0 comments
Open

"news" in for-loop variable name gives TypeError #42

johannesmik opened this issue Jul 30, 2017 · 0 comments

Comments

@johannesmik
Copy link

Following situation:

test.tpl

{% for i in news %}
{{ i.title }}
{% endfor %}

test.js

require("jinjs").registerExtension(".tpl");
var main_template = require("./test");
var context = { news : [{title: "test one"}, {title: "test two"}]};
console.log(main_template.render(context));

Then, node test.js gives me the following error:

var _fref = new $$.s || [], _prev_loop = $$.loop, _prev_key = $$['i'], _prev_value = null, k = null, v = null, i = 0, l = 0, x = null, last_v = null, last_k = null;
            ^

TypeError: $$.s is not a constructor

Changing to foo and the error goes away

If I replace news with foo or bnews, then the error doesn't occur anymore.

However, the error still occurs for words like newsarticles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant