Skip to content
This repository was archived by the owner on Nov 21, 2019. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ env:
script:
- docker-compose --file docker-compose.yml --file docker-compose.ci.yml build
- .travis/smoke-test.sh
- docker-compose --file docker-compose.yml --file docker-compose.ci.yml run php vendor/bin/twigcs lint ./build/source/

after_success:
- docker run --name pattern-library-patterns patternlibrary_gulp npx gulp exportPatterns
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
},
"require": {
"php": "^7.2",
"friendsoftwig/twigcs": "^3.1",
"henrikbjorn/lurker": "^1.2",
"pattern-lab/core": "^2.0",
"pattern-lab/patternengine-twig": "^2.0",
Expand Down
148 changes: 147 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions docker-compose.ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ services:
build:
context: .
target: gulp
php:
build:
context: .
target: build
8 changes: 6 additions & 2 deletions source/patterns/01-molecules/reference/reference.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@

{%- set attributes = attributes|default({})|merge({class: attributes.class|default([])|merge(['reference']) }) -%}

{%- if doi is defined -%}
{%- set doi = 'https://doi.org/' ~ doi -%}
{%- endif -%}

{%- if href is not defined and doi is defined -%}
{%- set href = 'https://doi.org/'~doi -%}
{%- set href = doi -%}
{%- endif -%}

<article {{- html.attributes(attributes) }}>
Expand Down Expand Up @@ -50,7 +54,7 @@
{%- block doi -%}

{%- if doi -%}
{%- include 'atoms-link' with {attributes: {class: 'reference__doi', href: 'https://doi.org/'~doi}, text: 'https://doi.org/'~doi} only -%}
{%- include 'atoms-link' with {attributes: {class: 'reference__doi', href: doi}, text: doi} only -%}
{%- endif -%}

{%- endblock doi -%}
Expand Down
19 changes: 9 additions & 10 deletions source/patterns/02-organisms/content-header/content-header.twig
Original file line number Diff line number Diff line change
Expand Up @@ -93,25 +93,24 @@
{% set length = include('atoms-heading')|striptags|trim|length %}

{% if length < 20 %}
{% set lengthClass = 'xx-short' %}
{% set length_class = 'xx-short' %}
{% elseif length < 36 %}
{% set lengthClass = 'x-short' %}
{% set length_class = 'x-short' %}
{% elseif length < 46 %}
{% set lengthClass = 'short' %}
{% set length_class = 'short' %}
{% elseif length < 57 %}
{% set lengthClass = 'medium' %}
{% set length_class = 'medium' %}
{% elseif length < 80 %}
{% set lengthClass = 'long' %}
{% set length_class = 'long' %}
{% elseif length < 120 %}
{% set lengthClass = 'x-long' %}
{% set length_class = 'x-long' %}
{% else %}
{% set lengthClass = 'xx-long' %}
{% set length_class = 'xx-long' %}
{% endif %}

{% set attributes = attributes|default({})|merge({class: attributes.class|default([])|merge(['content-header__title', 'content-header__title--' ~ lengthClass]) }) %}
{% set level = 1 %}
{% set attributes = attributes|default({})|merge({class: attributes.class|default([])|merge(['content-header__title', 'content-header__title--' ~ length_class]) }) %}

{% include 'atoms-heading' %}
{% include 'atoms-heading' with {level: 1} %}

{%- endblock -%}

Expand Down
5 changes: 2 additions & 3 deletions source/patterns/03-templates/content-grid/content-grid.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

{%- set attributes = attributes|default({})|merge({class: attributes.class|default([])|merge(['content-grid']) }) -%}

{%- set hasSecondary = false -%}
{%- for area in content if area.area|default('full') == 'secondary' and area.content|default([])|length -%}
{%- set hasSecondary = true -%}
{%- set has_secondary = true -%} {# twigcs use-var has_secondary #}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{%- endfor -%}

{%- if hasSecondary -%}
{%- if has_secondary|default(false) -%}
{%- set attributes = attributes|merge({class: attributes.class|merge(['content-grid--has-secondary']) }) -%}
{%- endif -%}

Expand Down
5 changes: 2 additions & 3 deletions source/patterns/03-templates/listing-grid/listing-grid.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

{%- set attributes = attributes|default({})|merge({class: attributes.class|default([])|merge(['listing-grid']) }) -%}

{%- set hasSecondary = false -%}
{%- for area in content if area.area|default('full') == 'secondary' and area.content|default([])|length -%}
{%- set hasSecondary = true -%}
{%- set has_secondary = true -%} {# twigcs use-var has_secondary #}
{%- endfor -%}

{%- if hasSecondary -%}
{%- if has_secondary|default(false) -%}
{%- set attributes = attributes|merge({class: attributes.class|merge(['listing-grid--has-secondary']) }) -%}
{%- endif -%}

Expand Down
3 changes: 1 addition & 2 deletions source/patterns/03-templates/page-grid/page-grid.twig
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@
{%- with arguments|merge({_template: template}) only -%}

{%- set attributes = attributes|default({})|merge({class: attributes.class|default([])|merge(['page-grid__item', 'page-grid__main']), role: 'main'}) -%}
{%- set element = "main" -%}

{%- include _template -%}
{%- include _template with {element: 'main'} -%}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also friendsoftwig/twigcs#35, but I prefer the change.


{%- endwith -%}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
},
],
},
}, main: {
},
main: {
template: 'templates-content-grid',
arguments: {
content: [
Expand Down