Closed Zane-XY closed 9 months ago
First see this: https://github.com/samskivert/jmustache#newline-trimming
Second I could not reproduce your problem.
@Test
public void testTrim()
throws Exception {
String template = //
"""
{{#useBeanValidation}}{{> beanValidation}}{{/useBeanValidation}}
public Integer getZip() {
return zip;
}""";
var m = Map.of("useBeanValidation", true, "beanValidation", "@Validation");
StringReader sr = new StringReader("@Min(1) @Max(99999)");
Mustache.TemplateLoader loader = name -> sr;
String actual = Mustache.compiler()
.withLoader(loader)
.compile(template).execute(m);
String expected = "@Min(1) @Max(99999)\n" // notice new line
+ "public Integer getZip() {\n"
+ " return zip;\n"
+ "}";
assertEquals(expected, actual);
}
@samskivert
I could not reproduce this. I think we can close this issue.
Trying to modify the template in the swagger code generator. The template is like
the expected result is
however this gives
the line break after
{{/useBeanValidation}}
is not preserved.