RPGs3_card_insanity/style.html.j2

133 lines
5.2 KiB
Django/Jinja

{% macro figure_layer(figure) %}
{% set figure_style %}{% filter cull_whitespace %}
{% if figure.opacity!=1 %}opacity: {{ figure.opacity }};{% endif %}
{% if figure.color!=1 %}color: {{ figure.color }};{% endif %}
transform:
{% if figure.offset|any %}translate({{ figure.offset[0]*100 }}%, {{ figure.offset[1]*100 }}%){% endif %}
{% if figure.rotation %}rotate({{ figure.rotation }}deg){% endif %}
{% if figure.flip_x %}scaleX(-1){% endif %}
{% if figure.flip_y %}scaleY(-1){% endif %}
{% if figure.scale!=1 %}scale({{ figure.scale }}){% endif %}
;
{% endfilter %}{% endset %}
<div style="{{ figure_style }}">
{% if figure.type == "material-icons" %}
{# https://material.io/icons/ #}
<i class="material-icons figure">{{ figure.name }}</i>
{% elif figure.type == "mdi" %}
{# https://materialdesignicons.com/ #}
<i class="mdi mdi-{{ figure.name }}"></i>
{% elif figure.type == "fa" %}
{# http://fontawesome.io/icons/ #}
<i class="fa fa-{{ figure.name }}"></i>
{% elif figure.type == "lnr" %}
{# https://linearicons.com/free #}
<span class="lnr lnr-{{ figure.name }}"></span>
{% elif figure.type == "oi" %}
{# https://useiconic.com/open #}
<span class="oi" data-glyph="{{ figure.name }}"></span>
{% elif figure.type == "svg" %}
{# /cards/svg #}
{% if figure.color == true %}
<img src="https://pvv.ntnu.no/~pederbs/cards/svg/data/{{ figure.name }}">
{% elif figure.color %}
<img src="https://pvv.ntnu.no/~pederbs/cards/svg/data/{{ figure.name }}" class="colored" style="--figure-color: {{ figure.color }}">
{% else %}
<img src="https://pvv.ntnu.no/~pederbs/cards/svg/data/{{ figure.name }}" class="colored">
{% endif %}
{% elif figure.type == "img" %}
{# /cards/img #}
{% if figure.color == true %}
<img src="https://pvv.ntnu.no/~pederbs/cards/img/data/{{ figure.name }}" class="colored">
{% elif figure.color %}
<img src="https://pvv.ntnu.no/~pederbs/cards/img/data/{{ figure.name }}" class="colored" style="--figure-color: {{ figure.color }}">
{% else %}
<img src="https://pvv.ntnu.no/~pederbs/cards/img/data/{{ figure.name }}">
{% endif %}
{% elif figure.type == "url" %}
{% if figure.color == true %}
<img src="{{ figure.name }}" class="colored">
{% elif figure.color %}
<img src="{{ figure.name }}" class="colored" style="--figure-color: {{ figure.color }}">
{% else %}
<img src="{{ figure.name }}">
{% endif %}
{% endif %}
</div>
{% endmacro %}
{% macro named_icon_to_emoji(name) %}
{% if "AIR" in name | upper %} 🌪
{% elif "ALCHEMY" in name | upper %} ⚗️
{% elif "ANIMAL" in name | upper %} 🐾
{% elif "COMBAT" in name | upper %} ⚔️
{% elif "CRAFTING" in name | upper %}
{% elif "DARK" in name | upper %} 💀
{% elif "DEFENCE" in name | upper %} 🛡
{% elif "EARTH" in name | upper %} 🌱
{% elif "FIRE" in name | upper %} 🔥
{% elif "HOLY" in name | upper %} ☀️
{% elif "INNATE" in name | upper %} 🧙
{% elif "MAGIC" in name | upper %} 🔮
{% elif "MARKSMANSHIP" in name | upper %} 🎯
{% elif "MARTIAL" in name | upper %} 🥊
{% elif "META" in name | upper %} 🧩
{% elif "PERFORMANCE" in name | upper %} 🎺
{% elif "SHAPESHIFTING" in name | upper %} 🐻
{% elif "SKULLDUGGERY" in name | upper %} ⚰️
{% elif "TECHNIQUE" in name | upper %} 🎲
{% elif "WATER" in name | upper %} 🌊
{% elif "WEAPONMASTER" in name | upper %} 🤺
{% else %} {{name}}
{% endif %}
{% endmacro %}
<div class="fjomp_card{{" " + card.style if card.style}}">
<header>
{{ card.title }}
</header>
{% if card.icon %}
<div class="icon">
{{ named_icon_to_emoji(card.icon) }}
</div>
{% endif %}
<figure>
{% for figure in card.figures %}
{{ figure_layer(figure) }}
{% endfor %}
</figure>
<aside>
<ul>
{% for property in card.properties %}
<li>{{ property }}</li>
{% endfor %}
</ul>
</aside>
<div class="costbar">
{% for cost in card.costs %}
<section>
{% if cost.split() | length == 2 and cost.split()[0].isnumeric() %}
<big>{{ cost.split()[0] }}</big><br>
<small>{{ cost.split()[1] }}</small>
{% else %}
{{ cost }}
{% endif %}
</section>
{% endfor %}
</div>
<div class="description">
<center><i>"{{ card.flavor }}"</i></center>
<center>{{ card.description | markdown | safe }}</center>
{% if card.steps %}
<ul>
{% for step in card.steps %}
<li>{{ step }}</li>
{% endfor %}
</ul>
{% endif %}
</div>
</div>
{# <br><pre>{{ card }}</pre> #}