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

Prevent escaping of other patterns included in share #846

Merged
Merged
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
48 changes: 29 additions & 19 deletions packages/components/bolt-share/src/share.twig
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@

{# Share inline #}
{% if isFlat is sameas(true) %}
{% set items = items|merge([include("@bolt-components-headline/text.twig", {
tag: "span",
text: text,
weight: "bold",
transform: "uppercase",
size: "small",
attributes: create_attribute(attributes|default({})).addClass("u-bolt-color-gray-dark c-bolt-share--inline-heading")
})]) %}
{% set item %}
{% include "@bolt-components-headline/text.twig" with {
tag: "span",
text: text,
weight: "bold",
transform: "uppercase",
size: "small",
attributes: create_attribute(attributes|default({})).addClass("u-bolt-color-gray-dark c-bolt-share--inline-heading")
} only %}
{% endset %}
{% set items = items|merge([item]) %}
{% endif %}

{% for source in sources %}
Expand All @@ -44,21 +47,28 @@
{% endif %}

{% if sourceName %}
{% set items = items|merge([include("@bolt-components-link/link.twig", {
text: sourceName,
url: source.url,
icon: {
name: sourceIcon,
position: "before",
size: "medium"
},
attributes: create_attribute(attributes|default({})).addClass("js-bolt-share__"~source.name).setAttribute("target",sourceTarget)
})]) %}
{% set item %}
{% include "@bolt-components-link/link.twig" with {
text: sourceName,
url: source.url,
icon: {
name: sourceIcon,
position: "before",
size: "medium"
},
attributes: create_attribute(attributes|default({})).addClass("js-bolt-share__"~source.name).setAttribute("target",sourceTarget)
} only %}
{% endset %}

{% set items = items|merge([item]) %}
{% endif %}
{% endfor %}

{% if copyToClipboard %}
{% set items = items|merge([include("@bolt-components-copy-to-clipboard/copy-to-clipboard.twig", copyToClipboard)]) %}
{% set item %}
{% include "@bolt-components-copy-to-clipboard/copy-to-clipboard.twig" with copyToClipboard only %}
{% endset %}
{% set items = items|merge([item]) %}
{% endif %}

{% set attributes = create_attribute(attributes|default({})) %}
Expand Down