Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update DS components to ensure compatibility with Jinja #3380

Merged
merged 4 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/components/details/_macro.njk
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
{% if params.headingAttributes %}{% for attribute, value in (params.headingAttributes.items() if params.headingAttributes is mapping and params.headingAttributes.items else params.headingAttributes) %}{{ ' ' }}{{ attribute }}{% if value %}="{{ value }}"{% endif %}{% endfor %}{% endif %}
>
{% set titleTag = params.headingLevel | default(2) %}
{% set openingTag = "<h" + titleTag %}
{% set closingTag = "</h" + titleTag + ">" %}
{% set openingTag = "<h" ~ titleTag %}
{% set closingTag = "</h" ~ titleTag ~ ">" %}
{{ openingTag | safe }}
class="ons-details__title">{{ params.title }}{{ closingTag | safe }}
<span class="ons-details__icon">
Expand Down
4 changes: 2 additions & 2 deletions src/components/document-list/_macro.njk
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
>
{% for document in params.documents %}
{% set titleTag = params.headingLevel | default(2) %}
{% set openingTag = "<h" + titleTag %}
{% set closingTag = "</h" + titleTag + ">" %}
{% set openingTag = "<h" ~ titleTag %}
{% set closingTag = "</h" ~ titleTag ~ ">" %}
{% set documentItem %}
{% if document.thumbnail %}
<div
Expand Down
8 changes: 4 additions & 4 deletions src/components/panel/_macro.njk
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@

{% if params.title %}
{% if params.variant == 'error' %}
{% set defaultTitleTag = "h" + 2 %}
{% set defaultTitleTag = "h" ~ 2 %}
{% else %}
{% set defaultTitleTag = "div" %}
{% endif %}
{% set headingLevel = "h" + params.headingLevel if params.headingLevel else undefined %}
{% set headingLevel = "h" ~ params.headingLevel if params.headingLevel else undefined %}
{% set titleTag = headingLevel | default(defaultTitleTag) %}
{% set openingTag = "<" + titleTag %}
{% set closingTag = "</" + titleTag + ">" %}
{% set openingTag = "<" ~ titleTag %}
{% set closingTag = "</" ~ titleTag ~ ">" %}
<div class="ons-panel__header">
{{ openingTag | safe }} id="alert"{% if params.variant %}data-qa="{{ params.variant }}-header"{% endif %}
class="ons-panel__title ons-u-fs-r--b">{{ params.title | safe }}{{ closingTag | safe }}
Expand Down
4 changes: 2 additions & 2 deletions src/components/share-page/_macro.njk
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

{% if params.title %}
{% set titleTag = params.headingLevel | default(2) %}
{% set openingTag = "<h" + titleTag %}
{% set closingTag = "</h" + titleTag + ">" %}
{% set openingTag = "<h" ~ titleTag %}
{% set closingTag = "</h" ~ titleTag ~ ">" %}
{{ openingTag | safe }}
class="ons-u-fs-r--b ons-u-mb-xs">{{ params.title }}{{ closingTag | safe }}
{% endif %}
Expand Down
4 changes: 2 additions & 2 deletions src/components/summary/_macro.njk
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
{% for group in summary.groups %}
<div {% if group.id %}id="{{ group.id }}"{% endif %} class="ons-summary__group{{ variantClasses }}">
{% if group.title %}
{% set openingHeadingTag = "<h" + headingLevel %}
{% set closingHeadingTag = "</h" + headingLevel + ">" %}
{% set openingHeadingTag = "<h" ~ headingLevel %}
{% set closingHeadingTag = "</h" ~ headingLevel ~ ">" %}
{{ openingHeadingTag | safe }}
class="ons-summary__group-title">{{ group.title }}{{ closingHeadingTag | safe }}
{% endif %}
Expand Down
4 changes: 2 additions & 2 deletions src/components/tabs/_macro.njk
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

<section class="{{ classes }}" {% if params.noInitialActiveTab %}data-no-initial-active-tab="true"{% endif %}>
{% set titleTag = params.headingLevel | default(2) %}
{% set openingTag = "<h" + titleTag %}
{% set closingTag = "</h" + titleTag + ">" %}
{% set openingTag = "<h" ~ titleTag %}
{% set closingTag = "</h" ~ titleTag ~ ">" %}
{{ openingTag | safe }}
class="ons-tabs__title ons-u-fs-r--b
ons-u-mt-no{{ ' ' + params.titleClasses if params.titleClasses else '' }}">{{ params.title }}{{ closingTag | safe }}
Expand Down
4 changes: 2 additions & 2 deletions src/components/timeline/_macro.njk
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

<div class="ons-timeline{{ ' ' + params.classes if params.classes else '' }}">
{% set titleTag = params.headingLevel | default(2) %}
{% set openingTag = "<h" + titleTag %}
{% set closingTag = "</h" + titleTag + ">" %}
{% set openingTag = "<h" ~ titleTag %}
{% set closingTag = "</h" ~ titleTag + ">" %}
alessioventuriniAND marked this conversation as resolved.
Show resolved Hide resolved
{% for item in params.timelineItems %}
<div class="ons-timeline__item">
{{ openingTag | safe }} class="ons-timeline__heading">{{ item.heading }}{{ closingTag | safe }}
Expand Down
Loading