Jekyll / Liquid:在表格模板

时间:2017-05-29 12:58:13

标签: ruby jekyll liquid

我尝试使用Jekyll和Liquid填充下表输出(请注意for循环中的变量是任意的):

<table>
    <thead>
        {% for row in headerrows %}
            <tr>
                {% for cell in headercells %}
                    <td>{{content}}</td>
                {% endfor %}
            </tr>
        {% endfor %}
    </thead>
    <tbody>
        {% for row in rows %}
            <tr>
                {% for cell in cells %}
                    <td>{{content}}</td>
                {% endfor %}
            </tr>
        {% endfor %}
    </tbody>
</table>

这样做的最佳方法是什么?如果我使用自定义标签的自定义插件,是否可以解析类似的内容:

{% table %}

    {% row %}

        {% header %}
        Header cell 1
        {% endheader %}

        {% header %}
        Header cell 2   
        {% endheader %}

        {% header %}
        Header cell 3
        {% endheader %}

    {% endrow %}

    {% row %}

        {% cell %}
        Cell 1 content.
        {% endcell %}

        {% cell %}
        Cell 2 content.
        {% endcell %}

        {% cell %}
        Cell 3 content.
        {% endcell %}

    {% endrow %}

{% endtable %}

...进入数组,然后在模板中的for循环中进行处理?

0 个答案:

没有答案
相关问题