Skip to content

Commit

Permalink
Merge pull request #181 from forumone/add-raw-remove-if-has
Browse files Browse the repository at this point in the history
added |raw where needed and removed if has_? calls
  • Loading branch information
coreylafferty committed Dec 12, 2018
2 parents f9fcf45 + e05f704 commit cd408df
Show file tree
Hide file tree
Showing 48 changed files with 89 additions and 111 deletions.
Expand Up @@ -4,9 +4,9 @@
<h4>Heading Level 4</h4>
<h5>Heading Level 5</h5>
<h6>Heading Level 6</h6>
<h1><a href="{{ url }}">Heading Level 1 Link</a></h1>
<h2><a href="{{ url }}">Heading Level 2 Link</a></h2>
<h3><a href="{{ url }}">Heading Level 3 Link</a></h3>
<h4><a href="{{ url }}">Heading Level 4 Link</a></h4>
<h5><a href="{{ url }}">Heading Level 5 Link</a></h5>
<h6><a href="{{ url }}">Heading Level 6 Link</a></h6>
<h1><a href="{{ url|raw }}">Heading Level 1 Link</a></h1>
<h2><a href="{{ url|raw }}">Heading Level 2 Link</a></h2>
<h3><a href="{{ url|raw }}">Heading Level 3 Link</a></h3>
<h4><a href="{{ url|raw }}">Heading Level 4 Link</a></h4>
<h5><a href="{{ url|raw }}">Heading Level 5 Link</a></h5>
<h6><a href="{{ url|raw }}">Heading Level 6 Link</a></h6>
@@ -1,4 +1,4 @@
<p><a href="{{ url }}">This is a text link</a></p>
<p><a href="{{ url|raw }}">This is a text link</a></p>

<p><strong>Strong is used to indicate strong importance</strong></p>

Expand Down
2 changes: 1 addition & 1 deletion _starter-kit/_patterns/01-base/images/hero-image.twig
@@ -1 +1 @@
<img {% if custom_classes %}class="{{ custom_classes }}" {% endif %}src="{{ img.hero.src }}" alt="{{ img.hero.alt }}"{% if img.hero.height %} height="{{ img.hero.height }}"{% endif %}{% if img.hero.width %} width="{{ img.hero.width }}"{% endif %}>
<img {% if custom_classes %}class="{{ custom_classes }}" {% endif %}src="{{ img.hero.src }}" alt="{{ img.hero.alt|raw }}"{% if img.hero.height %} height="{{ img.hero.height }}"{% endif %}{% if img.hero.width %} width="{{ img.hero.width }}"{% endif %}>
2 changes: 1 addition & 1 deletion _starter-kit/_patterns/01-base/images/thumbnail-image.twig
@@ -1 +1 @@
<img {% if custom_classes %}class="{{ custom_classes }}" {% endif %}src="{{ img.thumbnail.src }}" alt="{{ img.thumbnail.alt }}"{% if img.thumbnail.height %} height="{{ img.thumbnail.height }}"{% endif %}{% if img.thumbnail.width %} width="{{ img.thumbnail.width }}"{% endif %}>
<img {% if custom_classes %}class="{{ custom_classes }}" {% endif %}src="{{ img.thumbnail.src }}" alt="{{ img.thumbnail.alt|raw }}"{% if img.thumbnail.height %} height="{{ img.thumbnail.height }}"{% endif %}{% if img.thumbnail.width %} width="{{ img.thumbnail.width }}"{% endif %}>
2 changes: 1 addition & 1 deletion _starter-kit/_patterns/02-layouts/nav/nav.twig
@@ -1,5 +1,5 @@
<nav role="navigation">
<h2 class="visually-hidden">{{ label }}</h2>
<h2 class="visually-hidden">{{ label|raw }}</h2>
{% block content %}
{{ content|raw }}
{% endblock %}
Expand Down
1 change: 0 additions & 1 deletion _starter-kit/_patterns/02-layouts/section/section.md
Expand Up @@ -11,7 +11,6 @@ _Layout for Section_.
* class: [string] any classes added by user or system.
* has_constrain: [boolean] True/False whether to add a constraint to block.
* constrain_classes: [string] Constrain classes used to control layout.
* has_label: [boolean] True/False whether block label should be displayed.
* label_element: [string] HTML element to use for block label.
* label: [string] The configured label of the block if visible.
* title_attributes: [array] HTML attributes for the label element.
Expand Down
4 changes: 2 additions & 2 deletions _starter-kit/_patterns/02-layouts/section/section.twig
Expand Up @@ -6,9 +6,9 @@
<div class="{{ constrain_classes ?: "l-constrain" }}">
{% endif %}

{% if has_label %}
{% if label %}
{{ title_prefix }}
<{{ label_element ?: "h2" }}{{- title_attributes.addClass(title_classes,'l-section__title')|raw -}}>{{ label }}</{{ label_element ?: "h2" }}>
<{{ label_element ?: "h2" }}{{- title_attributes.addClass(title_classes,'l-section__title')|raw -}}>{{ label|raw }}</{{ label_element ?: "h2" }}>
{{ title_suffix }}
{% endif %}

Expand Down
1 change: 0 additions & 1 deletion _starter-kit/_patterns/02-layouts/section/section.yml
Expand Up @@ -7,7 +7,6 @@ attributes:
-
has_constrain: false
constrain_classes: l-constrain
has_label: true
label_element: h2
label: Section title
title_attributes:
Expand Down
2 changes: 1 addition & 1 deletion _starter-kit/_patterns/03-components/author/author.twig
@@ -1,3 +1,3 @@
<div class="author">
<a href="{{ url }}">{{ author }}</a>
<a href="{{ url|raw }}">{{ author|raw }}</a>
</div>
@@ -1,12 +1,12 @@
<nav class="breadcrumb {{ modifier_classes }}" role="navigation" aria-labelledby="breadcrumb-label">
<h2 class="breadcrumb__title visually-hidden" id="breadcrumb-label">{{ heading|default('You are here') }}</h2>
<h2 class="breadcrumb__title visually-hidden" id="breadcrumb-label">{{ heading|default('You are here')|raw }}</h2>
<ol class="breadcrumb__list">
{% for item in breadcrumb %}
<li class="breadcrumb__item">
{% if item.url %}
<a class="breadcrumb__link" href="{{ item.url }}">{{ item.text }}</a>
<a class="breadcrumb__link" href="{{ item.url|raw }}">{{ item.text|raw }}</a>
{% else %}
{{ item.text }}
{{ item.text|raw }}
{% endif %}
</li>
{% endfor %}
Expand Down
4 changes: 2 additions & 2 deletions _starter-kit/_patterns/03-components/button/button.twig
@@ -1,5 +1,5 @@
{% if is_button_tag %}
<button class="button {{ modifier_classes }}"{% if is_disabled %} disabled{% endif %}>{{ text }}</button>
<button class="button {{ modifier_classes }}"{% if is_disabled %} disabled{% endif %}>{{ text|raw }}</button>
{% else %}
<a href="{{ url }}" class="button {{ modifier_classes }}">{{ text }}</a>
<a href="{{ url|raw }}" class="button {{ modifier_classes }}">{{ text|raw }}</a>
{% endif %}
6 changes: 3 additions & 3 deletions _starter-kit/_patterns/03-components/card/card.twig
Expand Up @@ -2,8 +2,8 @@
<div class="card__body">
<div class="card__header">
<h3 class="card__title">
{% if url %}<a href="{{ url }}">{% endif %}
{{title}}
{% if url %}<a href="{{ url|raw }}">{% endif %}
{{ title|raw }}
{% if url %}</a>{% endif %}
</h3>
</div>
Expand All @@ -18,7 +18,7 @@
</div>
{% if media %}
<div class="card__media">
{% if url %}<a href="{{ url }}">{% endif %}
{% if url %}<a href="{{ url|raw }}">{% endif %}
{{ media|raw }}
{% if url %}</a>{% endif %}
</div>
Expand Down
@@ -1,3 +1,3 @@
<div class="copyright">
&copy; {{ year.long }} Copyright {{ site_name }}.
&copy; {{ year.long }} Copyright {{ site_name|raw }}.
</div>
2 changes: 1 addition & 1 deletion _starter-kit/_patterns/03-components/date/date.twig
Expand Up @@ -12,6 +12,6 @@
{% elseif format == "short-datetime" %}
{% include "base-short-datetime" %}
{% else %}
{{ content }}
{{ content|raw }}
{% endif %}
</div>
2 changes: 1 addition & 1 deletion _starter-kit/_patterns/03-components/field/field.twig
@@ -1,6 +1,6 @@
<{{ element ?: 'div' }}{{- attributes.addClass(classes)|raw -}}>
{% if not label_hidden %}
<{{ label_element ?: 'h3' }}{{- title_attributes.addClass(title_classes)|raw -}}>{{ label }}</{{ label_element ?: 'h3' }}>
<{{ label_element ?: 'h3' }}{{- title_attributes.addClass(title_classes)|raw -}}>{{ label|raw }}</{{ label_element ?: 'h3' }}>
{% endif %}
{% if multiple %}
<div class="field__items">
Expand Down
@@ -1,6 +1,6 @@
<fieldset class="fieldset fieldset--default">
<legend class="fieldset__legend">
<span class="fieldset__legend-text">{{ legend }}</span>
<span class="fieldset__legend-text">{{ legend|raw }}</span>
</legend>
<div class="fieldset__content">
{{ content|raw }}
Expand Down
6 changes: 3 additions & 3 deletions _starter-kit/_patterns/03-components/file/file.twig
@@ -1,5 +1,5 @@
<div class="file">
<img class="file__icon" alt="{{ file.mime }}" src="{{ file.icon }}">
<a href="#" class="file__link">{{ file.name }}</a>
<span class="file__size">({{ file.size}})</span>
<img class="file__icon" alt="{{ file.mime|raw }}" src="{{ file.icon }}">
<a href="#" class="file__link">{{ file.name|raw }}</a>
<span class="file__size">({{ file.size }})</span>
</div>
@@ -1,4 +1,4 @@
<div class="form-item form-item--checkbox">
<input class="form-item__checkbox" id="{{ checkbox_id }}" type="checkbox" {% if checkbox_disabled %}disabled{% endif %} {% if checkbox_checked %}checked{% endif %}>
<label class="form-item__label is-after" for="{{ checkbox_id }}">{{ checkbox_label}}</label>
<label class="form-item__label is-after" for="{{ checkbox_id }}">{{ checkbox_label|raw }}</label>
</div>
@@ -1,4 +1,4 @@
<div class="form-item form-item--radio">
<input class="form-item__radio" id="{{ radio_option_id }}" name="radios" aria-describedby="edit-radios-description" type="radio"{% if radio_option_disabled %} disabled{% endif %}>
<label class="form-item__label is-after" for="{{ radio_option_id }}">{{ radio_option_label }}</label>
<label class="form-item__label is-after" for="{{ radio_option_id }}">{{ radio_option_label|raw }}</label>
</div>
Expand Up @@ -9,11 +9,7 @@ _Component for Hero Bg Image_
* image: [string] Background image for component.
* image_alt: [string] Alt text for image.
* has_overlay: [boolean] True/False identifying component has overlay class.
* has_title: [boolean] True/False identifying component has title.
* title: [string] Title of hero.
* has_subtitle: [boolean] True/False identifying component has subtitle.
* subtitle: [string] Subtitle of hero.
* has_summary: [boolean] True/False identifying component has summary.
* summary: [string] Summary of hero.
* has_call_to_action: [boolean] True/False identifying component has a button element.
* call_to_action_content: Content for the call to action section.
Expand Up @@ -8,16 +8,16 @@

<div class="{{ classes }}" style="background-image: url({{ image|raw }});" role="img" aria-label="{{ image_alt|raw }}">
<div class="hero-bg-image__content">
{% if has_title %}
{% if title %}
<h1 class="hero-bg-image__title">{{ title|raw }}</h1>
{% endif %}
{% if has_subtitle %}
{% if subtitle %}
<h3 class="hero-bg-image__subtitle">{{ subtitle|raw }}</h3>
{% endif %}
{% if has_summary %}
{% if summary %}
<div class="hero-bg-image__text">{{ summary|raw }}</div>
{% endif %}
{% if has_call_to_action %}
{% if call_to_action_content %}
<div class="hero-bg-image__call-to-action">
{% block call_to_action %}
{{ call_to_action_content|raw }}
Expand Down
Expand Up @@ -3,13 +3,9 @@ custom_classes: false
image: "https://picsum.photos/1600/800?image=11"
image_alt: "alt text"
has_overlay: true
has_title: true
title: "Hero Title"
has_subtitle: true
subtitle: "Hero Subtitle"
has_summary: true
summary: "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>"
has_call_to_action: true
call_to_action_content:
join():
- include():
Expand Down
Expand Up @@ -8,11 +8,7 @@ _Component for Hero Inline Image_
* custom_classes: [string] Classes to modify the default component styling.
* media: [string] Background image for component.
* has_overlay: [boolean] True/False identifying component has overlay class.
* has_title: [boolean] True/False identifying component has title.
* title: [string] Title of hero.
* has_subtitle: [boolean] True/False identifying component has subtitle.
* subtitle: [string] Subtitle of hero.
* has_summary: [boolean] True/False identifying component has summary.
* summary: [string] Summary of hero.
* has_call_to_action: [boolean] True/False identifying component has a button element.
* call_to_action_content: Content for the call to action section.
Expand Up @@ -11,16 +11,16 @@
{{ media|raw }}
</div>
<div class="hero-inline-image__content">
{% if has_title %}
<h1 class="hero-inline-image__title">{{ title }}</h1>
{% if title %}
<h1 class="hero-inline-image__title">{{ title|raw }}</h1>
{% endif %}
{% if has_subtitle %}
<h3 class="hero-inline-image__subtitle">{{ subtitle }}</h3>
{% if subtitle %}
<h3 class="hero-inline-image__subtitle">{{ subtitle|raw }}</h3>
{% endif %}
{% if has_summary %}
{% if summary %}
<div class="hero-inline-image__text">{{ summary|raw }}</div>
{% endif %}
{% if has_call_to_action %}
{% if call_to_action_content %}
<div class="hero-inline-image__call-to-action">
{% block call_to_action %}
{{ call_to_action_content|raw }}
Expand Down
Expand Up @@ -9,11 +9,8 @@ media: |-
</picture>
has_overlay: true
title: "Hero Title"
has_subtitle: true
subtitle: "Hero Subtitle"
has_summary: true
summary: "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>"
has_call_to_action: true
call_to_action_content:
join():
- include():
Expand Down
Expand Up @@ -2,13 +2,13 @@
<div class="l-media">
{% if image %}
<div class="l-media__object">
<a href="{{ url }}">{{ image|raw }}</a>
<a href="{{ url|raw }}">{{ image|raw }}</a>
</div>
{% endif %}
<div class="l-media__content">
<h2><a href="{{ url }}">{{ title }}</a></h2>
<h2><a href="{{ url|raw }}">{{ title|raw }}</a></h2>
{{ date|raw }}
{{ summary | raw }}
{{ summary|raw }}
</div>
</div>
</article>
2 changes: 1 addition & 1 deletion _starter-kit/_patterns/03-components/list/list.twig
@@ -1,5 +1,5 @@
<ul class="list {{ modifier_classes }}">
{% for item in list %}
<li>{{ item.text }}</li>
<li>{{ item.text|raw }}</li>
{% endfor %}
</ul>
6 changes: 3 additions & 3 deletions _starter-kit/_patterns/03-components/messages/messages.twig
@@ -1,14 +1,14 @@
<div {% if type == 'error' %} role="alert" {% else %} role="contentinfo" {% endif %} {% if heading %}aria-label="{{ heading }}"{% endif %}{{- attributes|raw -}}>
<div {% if type == 'error' %} role="alert" {% else %} role="contentinfo" {% endif %} {% if heading %}aria-label="{{ heading|raw }}"{% endif %}{{- attributes|raw -}}>
{% if messages|length > 1 %}
<h2 class="visually-hidden">{{ heading }}</h2>
<h2 class="visually-hidden">{{ heading|raw }}</h2>
<ul class="messages__list">
{% for message in messages %}
<li class="messages__item">{{- message|raw -}}</li>
{% endfor %}
</ul>
{% else %}
<div class="messages__content">
<h2 class="visually-hidden">{{ heading }}</h2>
<h2 class="visually-hidden">{{ heading|raw }}</h2>
{{- messages|first|raw -}}
</div>
{% endif %}
Expand Down
@@ -1 +1 @@
<h1 class="page-title">{{ page_title }}</h1>
<h1 class="page-title">{{ page_title|raw }}</h1>
@@ -1,11 +1,11 @@
{% if items.previous or items.next %}
<nav class="pager pager--mini" role="navigation" aria-labelledby="pagination-heading">
<h4 id="pagination-heading" class="visually-hidden">{{ heading|default('Pagination') }}</h4>
<h4 id="pagination-heading" class="visually-hidden">{{ heading|default('Pagination')|raw }}</h4>
<ul class="pager__items js-pager__items">

{% if items.previous %}
<li class="pager__item pager__item--previous">
<a class="pager__link pager__link--previous" href="{{ items.previous.href }}" title="{{ 'Go to previous page'|t }} " rel="prev"{{ items.previous.attributes|without('href', 'title', 'rel') }}>
<a class="pager__link pager__link--previous" href="{{ items.previous.href|raw }}" title="{{ 'Go to previous page'|t }} " rel="prev"{{ items.previous.attributes|without('href', 'title', 'rel') }}>
<span class="visually-hidden">{{ 'Previous page'|t }}</span>
<span aria-hidden="true">‹</span>
</a>
Expand All @@ -21,7 +21,7 @@

{% if items.next %}
<li class="pager__item pager__item--next">
<a class="pager__link pager__link--next" href="{{ items.next.href }}" title="{{ 'Go to next page'|t }}" rel="next"{{ items.next.attributes|without('href', 'title', 'rel') }}>
<a class="pager__link pager__link--next" href="{{ items.next.href|raw }}" title="{{ 'Go to next page'|t }}" rel="next"{{ items.next.attributes|without('href', 'title', 'rel') }}>
<span class="visually-hidden">{{ 'Next page'|t }}</span>
<span aria-hidden="true">›</span>
</a>
Expand Down
12 changes: 6 additions & 6 deletions _starter-kit/_patterns/03-components/pager/pager.twig
Expand Up @@ -13,13 +13,13 @@

{% if items %}
<nav class="pager {{ modifier_classes }}" role="navigation" aria-labelledby="pagination-heading">
<h4 id="pagination-heading" class="visually-hidden">{{ heading|default('Pagination') }}</h4>
<h4 id="pagination-heading" class="visually-hidden">{{ heading|default('Pagination')|raw }}</h4>
<ul class="pager__items js-pager__items">

{# Print first item if we are not on the first page. #}
{% if items.first %}
<li class="pager__item pager__item--first">
<a class="pager__link pager__link--first" href="{{ items.first.href }}" title="{{ 'Go to first page'|t }}"{{ items.first.attributes|without('href', 'title') }}>
<a class="pager__link pager__link--first" href="{{ items.first.href|raw }}" title="{{ 'Go to first page'|t }}"{{ items.first.attributes|without('href', 'title') }}>
<span class="visually-hidden">{{ 'First page'|t }}</span>
<span aria-hidden="true">First</span>
</a>
Expand All @@ -29,7 +29,7 @@
{# Print previous item if we are not on the first page. #}
{% if items.previous %}
<li class="pager__item pager__item--previous">
<a class="pager__link pager__link--previous" href="{{ items.previous.href }}" title="{{ 'Go to previous page'|t }}" rel="prev"{{ items.previous.attributes|without('href', 'title', 'rel') }}>
<a class="pager__link pager__link--previous" href="{{ items.previous.href|raw }}" title="{{ 'Go to previous page'|t }}" rel="prev"{{ items.previous.attributes|without('href', 'title', 'rel') }}>
<span class="visually-hidden">{{ 'Previous page'|t }}</span>
<span aria-hidden="true">Previous</span>
</a>
Expand All @@ -50,7 +50,7 @@
</span>
{{- key -}}
{% else %}
<a class="pager__link" href="{{ item.href }}" title="{{ 'Go to page @key'|t({'@key': key}) }}"{{ item.attributes|without('href', 'title') }}>
<a class="pager__link" href="{{ item.href|raw }}" title="{{ 'Go to page @key'|t({'@key': key}) }}"{{ item.attributes|without('href', 'title') }}>
<span class="visually-hidden">
{{ 'Page'|t }}
</span>
Expand All @@ -68,7 +68,7 @@
{# Print next item if we are not on the last page. #}
{% if items.next %}
<li class="pager__item pager__item--next">
<a class="pager__link pager__link--next" href="{{ items.next.href }}" title="{{ 'Go to next page'|t }}" rel="next"{{ items.next.attributes|without('href', 'title', 'rel') }}>
<a class="pager__link pager__link--next" href="{{ items.next.href|raw }}" title="{{ 'Go to next page'|t }}" rel="next"{{ items.next.attributes|without('href', 'title', 'rel') }}>
<span class="visually-hidden">{{ 'Next page'|t }}</span>
<span aria-hidden="true">Next</span>
</a>
Expand All @@ -78,7 +78,7 @@
{# Print last item if we are not on the last page. #}
{% if items.last %}
<li class="pager__item pager__item--last">
<a class="pager__link pager__link--last" href="{{ items.last.href }}" title="{{ 'Go to last page'|t }}"{{ items.last.attributes|without('href', 'title') }}>
<a class="pager__link pager__link--last" href="{{ items.last.href|raw }}" title="{{ 'Go to last page'|t }}"{{ items.last.attributes|without('href', 'title') }}>
<span class="visually-hidden">{{ 'Last page'|t }}</span>
<span aria-hidden="true">Last</span>
</a>
Expand Down
8 changes: 4 additions & 4 deletions _starter-kit/_patterns/03-components/progress/progress.twig
@@ -1,10 +1,10 @@
<div class="progress" data-drupal-progress>
{% if label %}
<div class="progress__label">{{ label }}</div>
<div class="progress__label">{{ label|raw }}</div>
{% endif %}
<div class="progress__track">
<div class="progress__bar" style="width: {{ percent }}"></div>
<div class="progress__bar" style="width: {{ percent|raw }}"></div>
</div>
<div class="progress__percentage">{{ percent }}</div>
<div class="progress__description">{{ message }}</div>
<div class="progress__percentage">{{ percent|raw }}</div>
<div class="progress__description">{{ message|raw }}</div>
</div>
4 changes: 2 additions & 2 deletions _starter-kit/_patterns/03-components/site-logo/site-logo.twig
@@ -1,3 +1,3 @@
<a class="site-logo" href="{{ url }}" title="{{ 'Home'|t }}" rel="home">
<img class="site-logo__image" src="{{ site_logo }}" alt="{{ 'Home'|t }}" />
<a class="site-logo" href="{{ url|raw }}" title="{{ 'Home'|t }}" rel="home">
<img class="site-logo__image" src="{{ site_logo|raw }}" alt="{{ 'Home'|t }}" />
</a>

0 comments on commit cd408df

Please sign in to comment.