I'm having trouble getting j2html to format all of its generated output. Elements generated by most of the tags work as expected, but the 'each' tag doesn't format.
Consider the following Java method:
private void temp() {
List<String> middle = Arrays.asList("One", "Two", "Three");
String html =
html(
body(
p("Before"),
ul(
each(middle, item ->
li(
span(item)
)
)
),
p("After")
)
).renderFormatted();
System.out.println(html);
}
the generated HTML is:
<html>
<body>
<p>
Before
</p>
<ul>
<li><span>One</span></li><li><span>Two</span></li><li><span>Three</span></li>
</ul>
<p>
After
</p>
</body>
</html>
As we can see, the content of the 'each' block is printed as a single unformatted line. How do we fix this?
I have also encountered this bug, wherever you use each the text is all rendered in one line, I had already raised a bug here