{% macro render_table(data,
                      titles=None,
                      primary_key='id',
                      primary_key_title='#',
                      caption=None,
                      table_classes=None,
                      header_classes=None,
                      responsive=False,
                      responsive_class='table-responsive',
                      show_actions=False,
                      actions_title='Actions',
                      view_url=None,
                      edit_url=None,
                      delete_url=None,
                      action_pk_placeholder=':primary_key') %}

  {%- if not titles -%}
    {% set titles = get_table_titles(data, primary_key, primary_key_title) %}
  {%- endif -%}
  {%- if responsive %}
<div class="{{ responsive_class }}">
  {%- endif %}
{| class="wikitable{% if table_classes %}{{ ' ' + table_classes }}{% endif %}"
  {%- if caption %}
|+ {{ caption }}
  {% endif %}
|-{%- if header_classes -%}class="{{ header_classes }}"{%- endif -%}
  {%- for title in titles %}
! scope="col" | {{ title[1] }}
  {%- endfor -%}
  {%- if show_actions %}
! scope="col" | {{ actions_title }}
  {%- endif %}
|-
  {%- for row in data %}
       {%- for title in titles %}
         {%- if title[0] == primary_key %}
! scope="row" | {{ row[title[0]] }}
         {%- else %}
| {{ row[title[0]] }}
         {%- endif -%}
       {%- endfor %}
|-
   {%- endfor %}
|}
  {% if responsive %}
</div>
  {% endif %}
{% endmacro %}
{#----------------------------------------------------------------------------#}
{% macro get_table_titles(data, primary_key, primary_key_title) %}

{% endmacro %}
{#----------------------------------------------------------------------------#}
