diff --git a/src/components/table/_macro.njk b/src/components/table/_macro.njk index 163aebfd7b..4acff3b127 100644 --- a/src/components/table/_macro.njk +++ b/src/components/table/_macro.njk @@ -2,22 +2,6 @@ {% from "components/button/_macro.njk" import onsButton %} {% from "components/icon/_macro.njk" import onsIcon %} {% set variants = params.variants if params.variants %} - {% set hasRowSpan = false %} - {% for row in params.thList %} - {% for th in row.ths %} - {% if th.rowspan %} - {% set hasRowSpan = true %} - {% endif %} - {% endfor %} - {% endfor %} - - {% for row in params.trs %} - {% for td in row.tds %} - {% if td.rowspan %} - {% set hasRowSpan = true %} - {% endif %} - {% endfor %} - {% endfor %}
+ {# Uses multiple loops to set the rowspan class so that it can work in both nunjucks and jinja2 environments due to the scoping rules of each language #} {% if params.caption %} - {% endif %} @@ -43,7 +28,7 @@ {% if params.thList %} {% set thGroups = params.thList %} {% else %} - {% set thGroups = [ { ths: params.ths } ] %} + {% set thGroups = [ { "ths": params.ths } ] %} {% endif %} {% for headerCols in thGroups %}
+ {{ params.caption }}