Допустим, у меня есть два шаблона Thymeleaf:
index.html:
<!DOCTYPE html>
<html>
<head></head>
<body>
<header>foo</header>
<section>
<div th:replace="fragments/main :: content"></div>
</section>
<footer>bar</footer>
</body>
</html>
фрагменты/main.html:
<!DOCTYPE html>
<html>
<head></head>
<body>
<div th:fragment="content">
<p>This is the main content.</p>
</div>
</body>
</html>
Как я могу запретить Tymeleaf включать div
который определяет фрагмент в композитный вывод? То есть, как мне заставить Thymleaf сгенерировать следующий вывод:
<!DOCTYPE html>
<html>
<head></head>
<body>
<header>foo</header>
<section>
<p>This is the main content.</p>
</section>
<footer>bar</footer>
</body>
</html>
Вместо:
<!DOCTYPE html>
<html>
<head></head>
<body>
<header>foo</header>
<section>
<div>
<p>This is the main content.</p>
</div>
</section>
<footer>bar</footer>
</body>
</html>