test mkdocs
This commit is contained in:
5
cz/pluglets/tile_grid/templates/j2-macros/tile-image.j2
Normal file
5
cz/pluglets/tile_grid/templates/j2-macros/tile-image.j2
Normal file
@ -0,0 +1,5 @@
|
||||
{% import 'pluglets/tile_grid/templates/j2-macros/tile-util.j2' as tile_util %}
|
||||
{% macro make_image( tile ) -%}
|
||||
<img src="{{ tile.img_src }}" alt="{{ tile.alt_text|default('', true ) }}"
|
||||
{%- if tile_util.is_image_only(tile) == "true" -%}{%- if tile.tooltip is defined and tile.tooltip|string|length %} title="{{ tile.tooltip }}"{% endif %}{% endif %} >
|
||||
{%- endmacro -%}
|
5
cz/pluglets/tile_grid/templates/j2-macros/tile-link.j2
Normal file
5
cz/pluglets/tile_grid/templates/j2-macros/tile-link.j2
Normal file
@ -0,0 +1,5 @@
|
||||
{% import 'pluglets/tile_grid/templates/j2-macros/tile-util.j2' as tile_util %}
|
||||
{% macro make_link_start( tile ) -%}
|
||||
<div class="terminal-mkdocs-tile-link"><a href="{{ tile.link_href }}"
|
||||
{%- if tile_util.is_link_only(tile) == "true" or tile_util.is_linked_image(tile) == "true" %}{%- if tile.tooltip is defined and tile.tooltip|string|length %} title="{{ tile.tooltip }}"{% endif %}{% endif %} >
|
||||
{%- endmacro -%}
|
55
cz/pluglets/tile_grid/templates/j2-macros/tile-util.j2
Normal file
55
cz/pluglets/tile_grid/templates/j2-macros/tile-util.j2
Normal file
@ -0,0 +1,55 @@
|
||||
{%- macro has_caption( tile ) -%}
|
||||
{%- if tile.caption is defined and tile.caption|string|length -%}
|
||||
true
|
||||
{%- else -%}
|
||||
false
|
||||
{%- endif -%}
|
||||
{%- endmacro -%}
|
||||
|
||||
{%- macro has_image( tile ) -%}
|
||||
{%- if tile.img_src is defined and tile.img_src|string|length -%}
|
||||
true
|
||||
{%- else -%}
|
||||
false
|
||||
{%- endif -%}
|
||||
{%- endmacro -%}
|
||||
|
||||
{%- macro has_link( tile ) -%}
|
||||
{%- if tile.link_href is defined and tile.link_href|string|length -%}
|
||||
true
|
||||
{%- else -%}
|
||||
false
|
||||
{%- endif -%}
|
||||
{%- endmacro -%}
|
||||
|
||||
{%- macro is_image_only( tile ) -%}
|
||||
{%- if has_image(tile) == "true" and has_link(tile) != "true" -%}
|
||||
true
|
||||
{%- else -%}
|
||||
false
|
||||
{%- endif -%}
|
||||
{%- endmacro -%}
|
||||
|
||||
{%- macro is_link_only( tile ) -%}
|
||||
{%- if has_link(tile) == "true" and has_image(tile) != "true" -%}
|
||||
true
|
||||
{%- else -%}
|
||||
false
|
||||
{%- endif -%}
|
||||
{%- endmacro -%}
|
||||
|
||||
{%- macro is_linked_image( tile ) -%}
|
||||
{%- if has_image(tile) == "true" and has_link(tile) == "true" -%}
|
||||
true
|
||||
{%- else -%}
|
||||
false
|
||||
{%- endif -%}
|
||||
{%- endmacro -%}
|
||||
|
||||
{%- macro is_valid( tile ) -%}
|
||||
{%- if is_image_only(tile) == "true" or is_link_only(tile) == "true" or is_linked_image(tile) == "true" -%}
|
||||
true
|
||||
{%- else -%}
|
||||
false
|
||||
{%- endif -%}
|
||||
{%- endmacro -%}
|
33
cz/pluglets/tile_grid/templates/j2-macros/tile.j2
Normal file
33
cz/pluglets/tile_grid/templates/j2-macros/tile.j2
Normal file
@ -0,0 +1,33 @@
|
||||
|
||||
{% import 'pluglets/tile_grid/templates/j2-macros/tile-image.j2' as image_helper %}
|
||||
{% import 'pluglets/tile_grid/templates/j2-macros/tile-link.j2' as link_helper %}
|
||||
{% import 'pluglets/tile_grid/templates/j2-macros/tile-util.j2' as tile_util %}
|
||||
|
||||
{% macro make_tile( tile, use_markup ) %}
|
||||
{%- set ns = namespace(is_valid=false, has_link=false, has_image=false, has_caption=false) -%}
|
||||
{%- set ns.has_image = tile_util.has_image(tile) == "true" -%}
|
||||
{%- set ns.has_link = tile_util.has_link(tile) == "true" -%}
|
||||
{%- set ns.has_caption = tile_util.has_caption(tile) == "true" -%}
|
||||
{%- set ns.is_valid = tile_util.is_valid(tile) == "true" -%}
|
||||
{%- if ns.is_valid -%}
|
||||
<div {% if tile.tile_id is defined and tile.tile_id|string|length %} id="{{ tile.tile_id }}" {% endif %}class="terminal-mkdocs-tile {{ tile.tile_css }}">
|
||||
<figure>
|
||||
{% if ns.has_link -%}{{ link_helper.make_link_start(tile) }}{% endif %}
|
||||
{%- if ns.has_image %}
|
||||
{{ image_helper.make_image(tile) }}
|
||||
{%- endif -%}
|
||||
{%- if ns.has_link -%}
|
||||
{% if ns.has_image %}
|
||||
</a></div>{% else %}{{ tile.alt_text|default(tile.link_href, true) }}</a></div>{%- endif %}
|
||||
{%- endif -%}
|
||||
{%- if ns.has_caption -%}
|
||||
{%- if use_markup %}
|
||||
<figcaption>{{ tile.caption|string|trim|markup }}</figcaption>
|
||||
{% else %}
|
||||
<figcaption>{{ tile.caption|string|trim }}</figcaption>
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
</figure>
|
||||
</div>
|
||||
{%- endif -%}
|
||||
{% endmacro %}
|
Reference in New Issue
Block a user