Open jcachat opened 1 year ago
@jcachat , can you please provide test to reproduce the issue?
This demonstrates it:
[Fact]
public void SubExpressionsEncoding()
{
var handlebars = Handlebars.Create();
handlebars.RegisterHelper("func1", (writer, context, args) => {
writer.Write(args[0]);
});
handlebars.RegisterHelper("func2", (writer, context, args) => {
writer.Write("test&test");
});
var template = handlebars.Compile("{{func2}}");
var output = template(new { });
Assert.Equal("test&test", output);
// This test will pass if you change func2 to writer.Write("test&test", false) but then the first test fails
template = handlebars.Compile("{{func1 (func2)}}");
output = template(new { });
Assert.Equal("test&test", output);
}
I am having an issue with a subexpression being encoded/escaped when I have something like this:
where func1 and func2 are helpers I have defined.
Prior to v2, this was working fine as long as func2 did "writer.Write(output)". In v2, I can make this work if I change that to "writer.Write(output, false)". But then I have issues if I try to use func2 on it's own like this:
I can't find any way in v2 to make this work consistently. Is this a bug? Or is there some way I can know inside func2 whether it is being used in a subexpression?