-
Notifications
You must be signed in to change notification settings - Fork 124
Open
Description
Hello,
I was struggling while trying to use a partial more than once within the same compiled template. The compiler raises the exception "Unsupported: Compiled recursive templates will be supported in a later release" as it thinks (erroneously) that there is a recursion in the partial.
Here's a test case that raises the error:
[Test]
public void Partials_Multiple_Usage()
{
var template = Template("{{>text}} after partial {{>text}}");
var compiled = template.Compile<TestObject>(name =>
name == "text" ? Template("{{TestString}} {{#Sub.TestBool}}I am in you{{/Sub.TestBool}}") : null);
var result = compiled(new TestObject { TestString = "a", Sub = new SubObject { TestBool = true } });
Assert.AreEqual("a I am in you after partial a I am in you", result);
}IMO. the problem is that the recusion check in CompileContext.cs (line 198-199) is not really checking for recursion, rather for multiple inclusion. An those are legal in Mustache as far as I know.
I'll try to provide a true recursion check in the next days if you'd like.
Metadata
Metadata
Assignees
Labels
No labels