{% macro dataValue(dValue) %}
  {% if dValue | is_object %}
    <table>
      {% for dValueKey, dValueValue in dValue %}
        <tr>
          <td>{{ dValueKey }}<td>
          <td>{{ dataValue(dValueValue) }}</td>
        </tr>
      {% endfor %}
    </table>
  {% elif dValue | is_array %}
    <ul>
      {% for arrayValue in dValue %}
        <li>{{ dataValue(arrayValue) }}</li>
      {% endfor %}
    </ul>
  {% else %}
    {{ dValue }}
  {% endif %}
{% endmacro %}
{% macro dataTable(components, submissionData, title) %}
  {% for component in components %}
    {% if component.type == 'well' %}
      {{ dataTable(component.components, submissionData) }}
    {% elif component.type == 'columns' %}
      {% for column in component.columns %}
        {{ dataTable(column.components, submissionData) }}
      {% endfor %}
    {% endif %}
  {% endfor %}
  <table>
    <tbody>
      {% if title %}
        <tr><td colspan="2"><h2>{{ title }}</h2></td></tr>
      {% endif %}
      {% for component in components %}
        {% if component.type == 'panel' %}
        {% elif component.type == 'well' %}
        {% elif component.type == 'fieldset' %}
        {% elif component.type == 'columns' %}
        {% elif not submissionData[component.key] %}
        {% else %}
          <tr>
            <td><strong>{{ component.label }}</strong></td>
            <td>
              {% if component.type == 'password' %}
                --- PASSWORD ---
              {% elif component.type == 'address' %}
                {{ submissionData[component.key].formatted_address }}
              {% else %}
                {{ dataValue(submissionData[component.key]) }}
              {% endif %}
            </td>
          </tr>
        {% endif %}
      {% endfor %}
    </tbody>
  </table>
  {% for component in components %}
    {% if component.type == 'panel' %}
      {{ dataTable(component.components, submissionData, component.title) }}
    {% elif component.type == 'fieldset' %}
      {{ dataTable(component.components, submissionData, component.legend) }}
    {% endif %}
  {% endfor %}
{% endmacro %}
{% macro table(components, title) %}
  {{ dataTable(components, data, title) }}
{% endmacro %}