handlebars.java
handlebars.java copied to clipboard
Whitespace trimming does not work on partial blocks
Given this code (using 4.3.1):
Handlebars handlebars = new Handlebars();
Template template = handlebars.compile("root");
System.out.println(template.apply(null));
and this root
template:
BEGIN
{{~#>partial_test ~}}
MIDDLE
{{~/partial_test ~}}
END
and this partial_test
template:
{{~> @partial-block ~}}
I expect no blank lines in the output, as whitespace is being stripped at every tag entry and exit.
However what I actually get is:
BEGIN
MIDDLE
END
It seems like the whitespace strip is not respected on any partial tags.
This is frustrating, as it means there is no way to write a filter-style partial block, which does not add extra whitespace, without starting the content immediately after the closing brace of the {{#> }}
tag.
I've edited the originally submitted reproduction recipe, replacing with a simpler one, which also showcases an additional issue.