我想创建一个树枝循环来剪切一长串li和div,每个循环中有3个项目
<div class="tabs">
<ul>
<li><a href="#tab1" class="tab-link">Word 01</a></li>
<li><a href="#tab2" class="tab-link">Word 02</a></li>
<li><a href="#tab3" class="tab-link">Word 03</a></li>
</ul>
<div id="tab1" class="tab-content">Definition of word 01</div>
<div id="tab2" class="tab-content">Definition of word 02</div>
<div id="tab3" class="tab-content">Definition of word 03</div>
</div>
<div class="tabs">
<ul>
<li><a href="#tab4" class="tab-link">Word 04</a></li>
<li><a href="#tab5" class="tab-link">Word 05</a></li>
<li><a href="#tab6" class="tab-link">Word 06</a></li>
</ul>
<div id="tab4" class="tab-content">Definition of word 04</div>
<div id="tab5" class="tab-content">Definition of word 05</div>
<div id="tab6" class="tab-content">Definition of word 06</div>
</div>
我写了这个:
<div class="tabs">
<ul class="list--words nostyle">
{% for post in posts %}
<li><a href="#">{{post.title}}</a></li>
{% if loop.index % 3 == 0 %}
</ul></div><div class="tabs"><ul class="list--words nostyle">
{% endif %}
{% endfor %}
</ul>
</div>
但我不知道如何插入我的3个标签内容?