mirror of
https://github.com/SebastianStork/kita.git
synced 2026-01-21 14:31:35 +01:00
feat: add inline_svg shortcode
This commit is contained in:
parent
e3c3255113
commit
9d208b7bd1
1 changed files with 10 additions and 3 deletions
|
|
@ -1,9 +1,16 @@
|
|||
{% set img = body | trim_start_matches(pat=" %}<!---->
|
||||
{% set alt = img | first() %}<!---->
|
||||
{% set src = img | last() %}<!---->
|
||||
{% set ignore_names = ["inline svg", "inline-svg", "inline_svg"] %}
|
||||
{% set_global src = img | last() %}<!---->
|
||||
{% set ignore_names = ["inline svg", "inline-svg", "inline_svg"] %}<!---->
|
||||
|
||||
{% for asset in page.assets -%}<!---->
|
||||
{% if asset is ending_with("/" ~ src) %}<!---->
|
||||
{% set_global src = asset %}<!---->
|
||||
{% endif %}<!---->
|
||||
{% endfor %}<!---->
|
||||
|
||||
<figure class="inline-svg">
|
||||
{{ load_data(path="@" ~ page.path ~ src) | safe}}<!---->
|
||||
{{ load_data(path=src) | safe}}<!---->
|
||||
{% if alt and not ignore_names is containing(alt | lower) %}
|
||||
<figcaption>{{ alt }}</figcaption>
|
||||
{% endif %}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue