-
Notifications
You must be signed in to change notification settings - Fork 641
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
Set blocks prints its content #914
Comments
I was trying to use {% set %} as a walkaround the bug #679, so I wouldn't have to use call that breaks variable context. It seems set block doesn't work in macros. As noted above, content is displayed and variable is empty. At top level, {% set %} block works as expected. |
Temporary workaround: overwrite the compileCapture: function(node, frame) {
// we need to temporarily override the current buffer id as 'output'
// so the set block writes to the capture output instead of the buffer
var oldbuf = this.buffer;
this.buffer = 'output';
this.emitLine('(function() {');
this.emitLine('var output = "";');
this.withScopedSyntax(function () {
this.compile(node.body, frame);
});
this.emitLine('return output;');
this.emitLine('})()');
// and of course, revert back to the old buffer id
this.buffer = oldbuf;
} PR incoming. |
4 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In 3.0.0 set block for some reason immediately prints it content.
outputs
As you can see, set print itself immediately, and
{{ test }}
call doesn't work.Should it be like that?
The text was updated successfully, but these errors were encountered: