<!DOCTYPE html/> when Config.closeEmptyTags=true
kicktipp opened this issue · comments
This test fails.
import static j2html.TagCreator.document;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import j2html.Config;
public class DoctypeTest
{
@Test
public void test ( )
{
Config.closeEmptyTags = true;
assertEquals("<!DOCTYPE html>", document().render());
}
}
Fix:
public static RawHtml document() { return new RawHtml("<!DOCTYPE html>"); }
public static String document(ContainerTag htmlTag) {
if (htmlTag.getTagName().equals("html")) {
return document().render() + htmlTag.render();
}
throw new IllegalArgumentException("Only HTML-tag can follow document declaration");
}
Thanks. Want to create a PR?
Merged.
Released as part of 1.2.1
<dependency>
<groupId>com.j2html</groupId>
<artifactId>j2html</artifactId>
<version>1.2.1</version>
</dependency>
http://search.maven.org/#artifactdetails%7Ccom.j2html%7Cj2html%7C1.2.1%7Cjar