11.2. Thymeleaf解析器级别注释块
解析器级别注释块指的是在Thymeleaf解析时,会被简单地从模版里移除的代码。它们看起来就像这样:
<!--/* This code will be removed at Thymeleaf parsing time! */-->
Thymeleaf会移除<!--/*
和*/-->
之间的所有东西。所以,当模版被静态地打开时,这些注释块也可以用来展示代码:
<!--/*-->
<div>
you can see me only before Thymeleaf processes me!
</div>
<!--*/-->
这在使用许多的<tr>
展示表格原型时,很有用。比如:
<table>
<tr th:each="x : ${xs}">
...
</tr>
<!--/*-->
<tr>
...
</tr>
<tr>
...
</tr>
<!--*/-->
</table>