<table class="govuk-table
  {%- if params.classes %} {{ params.classes }}{% endif %}"{% for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
  {% if params.caption %}
  <caption class="govuk-table__caption
  {%- if params.captionClasses %} {{ params.captionClasses }}{% endif %}">{{ params.caption }}</caption>
  {% endif %}
  {% if params.head %}
  <thead class="govuk-table__head">
    <tr class="govuk-table__row">
    {% for item in params.head %}
      <th class="govuk-table__header
      {%- if item.format %} govuk-table__header--{{ item.format }}{% endif %}"
      {%- if item.colspan %} colspan="{{ item.colspan }}"{% endif %}
      {%- if item.rowspan %} rowspan="{{ item.rowspan }}"{% endif %} scope="col">{{ item.html |safe if item.html else item.text }}</th>
    {% endfor %}
    </tr>
  </thead>
  {% endif %}
  <tbody class="govuk-table__body">
    {% for row in params.rows %}
    <tr class="govuk-table__row">
    {% for cell in row %}
      {% if loop.first and params.firstCellIsHeader %}
      <th class="govuk-table__header" scope="row">{{ cell.html | safe if cell.html else cell.text }}</th>
      {% elseif loop.first %}
      <td class="govuk-table__cell
      {%- if cell.format %} govuk-table__cell--{{ cell.format }}{% endif %}"
      {%- if cell.colspan %} colspan="{{ cell.colspan }}"{% endif %}
      {%- if cell.rowspan %} rowspan="{{ cell.rowspan }}"{% endif %}>{{ cell.html | safe if cell.html else cell.text }}</td>
      {% else %}
      <td class="govuk-table__cell {% if cell.format %}govuk-table__cell--{{ cell.format }}{% endif %}"
      {%- if cell.colspan %} colspan="{{ cell.colspan }}"{% endif %}
      {%- if cell.rowspan %} rowspan="{{ cell.rowspan }}"{% endif %}>{{ cell.html | safe if cell.html else cell.text }}</td>
      {% endif %}
    {% endfor %}
    </tr>
    {% endfor %}
  </tbody>
</table>