{% if title is not none %}
<h1>{{title}}</h1>
{%endif%}

{% macro header_footer(limit, total_rows, total_cols, partitions, df_type) %}
<div class="info_items" style="margin: 10px 0; font-family: sans-serif; font-size: 10px;">Viewing {{limit}} of {{total_rows}} rows / {{total_cols}} columns</div>
<div class="info_items" style="margin: 10px 0; font-family: sans-serif; font-size: 10px;">{{partitions}} partition(s) {{df_type}}</div>

{% endmacro %}

{{header_footer(limit, total_rows, total_cols, partitions)}}
<span class="optimus_table_container" style="display: inline-flex; flex-direction: column;">
    <table class="optimus_table" style="font-size: 12px; margin: 0;">
        <thead style="font-family: sans-serif; border-bottom: 1px solid currentColor;">
        <tr>
            {%for col in cols: %}
            <th style="{{'background-color: rgba(240,240,0,0.18); ' if col[0] in highlight else ''}}">
                <div class="column_name" style="font-size: 1.2em;">{{col[0]}}</div>
                <div class="data_type" style="font-size: 0.8em; font-weight: normal;">{{loop.index}} ({{col[1]}})</div>
                {% if col[2] != undefined %}
                <div class="data_type" style="font-size: 0.8em; font-weight: normal;">
                    {% if col[2] == true %}
                    nullable
                    {% else %}
                    not nullable
                    {% endif %}
                </div>
                {% endif %}
            </th>
            {% endfor %}
        </tr>

        </thead>
        <tbody style="font-family: monospace;">
        {%for r in data:%}
        <tr>
            {%for k,v in r.items(): %}
            <td style="border: 0px; {{'background-color: rgba(240,240,0,0.18); ' if k in highlight else ''}}">
                <div title="{{v|string|replace(" ", "&#8901;")|safe}}" style="min-height: 14px;">
                    {% if truncate == true %}
                    {{v|string|replace(" ",  "&#8901;")|truncate(128)|safe}}
                    {% else %}
                    {{v|string|replace(" ",  "&#8901;")|safe}}
                    {% endif %}
                </div>
            </td>
            {% endfor %}
        </tr>
        {% endfor %}
        </tbody>
    </table>
    <div class="optimus_table_border" style="background-color: currentColor; opacity: 0.2; height: 1px; width: 100%;"></div>
</span>
{{header_footer(limit, total_rows, total_cols,partitions, df_type)}}