Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
whateverJinja で箇条書きにしたいというリストがあります。
whatever
<ol> {% for item in whatever %} <tr> <td> <li> {{ item }}</li> </td> </tr> {% endfor %} </ol>
ただし、これをこのように実装すると、連番ではなく順序付けられていないリスト出力が得られます。
それよりも
実際には、html に問題があります (python/jinja ではありません)。tr/タグを外せtdばOKです。
tr
td
更新: テーブル タグの使用を主張する場合は、ol/タグを削除し、jinjaループで暗黙的に定義されているオブジェクトをli使用します。あれは、loopfor
ol
li
loop
for
<td>{{loop.index}}. {{item}}</td>
列挙されたアイテムを提供します。