It seems like this problem came up a few times in the past. I'm using Version 3.2.3. of Nunjucks and I'm trying to use a custom async tag to fetch some content, unfortunately I can't get it to work even with the bare minimum.
Simple Example:
function TestExtension() {
this.tags = ['test'];
this.parse = function (parser, nodes, lexer) {
let tok = parser.nextToken();
let args = parser.parseSignature(null, true);
parser.advanceAfterBlockEnd(tok.value);
let body = parser.parseUntilBlocks('endtest');
parser.advanceAfterBlockEnd();
return new nodes.CallExtensionAsync(this, 'run', args, [body]);
};
this.run = function (context, arg1, content, callback) {
setTimeout(100, () => {
callback(null, nunjucks.runtime.SafeString('Hello world?'));
});
};
}
let env = new nunjucks.Environment();
env.addExtension('TestExtension', new TestExtension());
If I use any of my custom tags using CallExtensionAsync the result of renderString is empty. Is there anything I could be doing wrong or is there any chance to get the problem fixed if it's a bug in the codebase?
It seems like this problem came up a few times in the past. I'm using Version 3.2.3. of Nunjucks and I'm trying to use a custom async tag to fetch some content, unfortunately I can't get it to work even with the bare minimum.
Simple Example:
If I use any of my custom tags using
CallExtensionAsync
the result ofrenderString
is empty. Is there anything I could be doing wrong or is there any chance to get the problem fixed if it's a bug in the codebase?