weixin_39975810 2020-11-30 06:59
浏览 0

Parser-level comment blocks

Parser-level comment blocks are code that will be simply removed from the template when thymeleaf parses them. They should look like this:

 html
<!--/* This code will be removed at thymeleaf parsing time! */-->

Thymeleaf should remove absolutely everything between <!--/* and */-->, so these comment blocks can be used for displaying code when a template is statically open, knowing that it will be removed when thymeleaf processes it:

 html
<!--/*--> 
  <div>
     you can see me only before thymeleaf processes me!
  </div>
<!--*/-->

This might come very handy for prototyping tables with a lot of <tr>'s, for example:

 html
<table>
   <tr th:each="x : ${xs}">
     ...
   </tr>
   <!--/*-->
   <tr>
     ...
   </tr>
   <tr>
     ...
   </tr>
   <!--*/-->
</table>

该提问来源于开源项目:thymeleaf/thymeleaf

  • 写回答

2条回答 默认 最新

  • weixin_39975810 2020-11-30 06:59
    关注

    Added to 2.1.0-SNAPSHOT

    评论

报告相同问题?