RPGs3_card_insanity/style.html.j2

167 lines
6.3 KiB
Plaintext
Raw Normal View History

2019-09-11 05:09:42 +02:00
{% macro figure_layer(figure) %}
{% set figure_style %}{% filter cull_whitespace %}
2019-10-14 21:40:50 +02:00
{% if figure.opacity!=1 %}
opacity: {{ figure.opacity }};
{% endif %}
{% if figure.color!=1 %}
color: {{ figure.color }};
{% endif %}
2019-09-10 00:52:30 +02:00
transform:
2019-10-14 21:40:50 +02:00
{% if figure.offset and 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 and figure.scale!=1 %}
scale({{figure.scale | string | replace("[", "") | replace("]", "") }})
{% endif %}
2019-09-10 00:52:30 +02:00
;
2019-09-11 05:09:42 +02:00
{% endfilter %}{% endset %}
2019-09-09 18:48:15 +02:00
2019-10-14 21:40:50 +02:00
<div class="layer" style="{{ figure_style }}">
{% if figure.source == "material-icons" %}
2019-09-11 05:09:42 +02:00
{# https://material.io/icons/ #}
2019-09-10 00:52:30 +02:00
<i class="material-icons figure">{{ figure.name }}</i>
2019-10-14 21:40:50 +02:00
{% elif figure.source == "mdi" %}
2019-09-11 05:09:42 +02:00
{# https://materialdesignicons.com/ #}
2019-09-10 00:52:30 +02:00
<i class="mdi mdi-{{ figure.name }}"></i>
2019-10-14 21:40:50 +02:00
{% elif figure.source == "fa" %}
2019-09-11 05:09:42 +02:00
{# http://fontawesome.io/icons/ #}
2019-09-10 00:52:30 +02:00
<i class="fa fa-{{ figure.name }}"></i>
2019-10-14 21:40:50 +02:00
{% elif figure.source == "lnr" %}
2019-09-11 05:09:42 +02:00
{# https://linearicons.com/free #}
2019-09-10 00:52:30 +02:00
<span class="lnr lnr-{{ figure.name }}"></span>
2019-10-14 21:40:50 +02:00
{% elif figure.source == "oi" %}
2019-09-11 05:09:42 +02:00
{# https://useiconic.com/open #}
<span class="oi" data-glyph="{{ figure.name }}"></span>
2019-10-14 21:40:50 +02:00
{% elif figure.source == "svg" %}
{# pvv.ntnu.no/~pederbs/cards/svg #}
2019-09-19 02:43:21 +02:00
{% 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 }}">
2019-09-11 05:09:42 +02:00
{% else %}
2019-09-19 02:43:21 +02:00
<img src="https://pvv.ntnu.no/~pederbs/cards/svg/data/{{ figure.name }}" class="colored">
2019-09-11 05:09:42 +02:00
{% endif %}
2019-10-14 21:40:50 +02:00
{% elif figure.source in ["img", "emoji"] %}
{# pvv.ntnu.no/~pederbs/cards/img #}
{# /cards/emoji #}
2019-09-19 02:43:21 +02:00
{% if figure.color == true %}
2019-10-14 21:40:50 +02:00
<img src="https://pvv.ntnu.no/~pederbs/cards/{{ figure.source }}/data/{{ figure.name }}" class="colored">
2019-09-19 02:43:21 +02:00
{% elif figure.color %}
2019-10-14 21:40:50 +02:00
<img src="https://pvv.ntnu.no/~pederbs/cards/{{ figure.source }}/data/{{ figure.name }}" class="colored" style="--figure-color: {{ figure.color }}">
2019-09-11 05:09:42 +02:00
{% else %}
2019-10-14 21:40:50 +02:00
<img src="https://pvv.ntnu.no/~pederbs/cards/{{ figure.source }}/data/{{ figure.name }}">
2019-09-11 05:09:42 +02:00
{% endif %}
2019-10-14 21:40:50 +02:00
{% elif figure.source == "url" %}
2019-10-06 12:58:50 +02:00
{% 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 %}
2019-09-11 05:09:42 +02:00
{% endif %}
2019-09-10 00:52:30 +02:00
</div>
2019-09-11 05:09:42 +02:00
{% endmacro %}
2019-09-10 00:52:30 +02:00
2019-10-14 21:40:50 +02:00
<div class="fjomp_card{{" " + yaml.style if yaml.style}}">
<header>
2019-10-14 21:40:50 +02:00
{{ yaml.name or xml.name }}
</header>
2019-10-20 02:09:57 +02:00
{% if xml.symbol %}
2019-10-14 21:40:50 +02:00
<div class="symbol">
{{ xml.symbol }}
</div>
{% endif %}
2019-09-10 00:52:30 +02:00
<figure>
2019-10-20 02:09:57 +02:00
{% for figure in yaml.figures or [] %}
2019-10-14 21:40:50 +02:00
{{ figure_layer(figure) }}
{% endfor %}
{% if xml.image %}
{{ figure_layer({
'name': xml.image if xml.image | startswith("http") else xml.image | split(":") | tail | join(":"),
'source': "url" if xml.image | startswith("http") else xml.image | split(":") | first
}) }}
{% endif %}
2019-09-10 00:52:30 +02:00
</figure>
2019-10-06 12:58:50 +02:00
<div class="costbar">
2019-10-06 21:43:37 +02:00
{% for label, data in [
2019-10-14 21:40:50 +02:00
["Difficulty", xml.difficulty or yaml.difficulty],
["Power", xml.power or yaml.power],
["Range", xml.range or yaml.range],
["Duration", xml.duration or yaml.duration],
["CP", xml.cp or yaml.cp]
2019-10-06 21:43:37 +02:00
] %}
{% if data %}
2019-10-14 21:40:50 +02:00
<section>
<big>{{ data }}</big><br>
<small>{{ label }}</small>
</section>
2019-10-06 21:43:37 +02:00
{% endif %}
{% endfor %}
2019-10-15 21:20:37 +02:00
{% for playcosts in [xml.playcost, yaml.playcost] %}
{% if playcosts %}
{% for playcost in (playcosts.split(",") if playcosts | is_string else playcosts ) %}
{% if playcost | trim | split(" ") | first | is_number %}
<section>
<big>{{ playcost | trim | split(" ") | first }}</big><br>
<small>{{ playcost | trim | split(" ") | tail | join(" ") }}</small>
</section>
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
2019-10-06 12:58:50 +02:00
</div>
<div class="description">
2019-10-15 21:20:37 +02:00
<ul>
{% for playcosts in [xml.playcost, yaml.playcost] %}
{% if playcosts %}
{% for playcost in (playcosts.split(",") if playcosts | is_string else playcosts ) %}
{% if not playcost | trim | split(" ") | first | is_number %}
<li>{{ playcost | trim }}</li>
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
</ul>
2019-10-14 21:40:50 +02:00
{% if yaml.flavor %}
<center><i>"{{ yaml.flavor }}"</i></center>
{% endif %}
{% if yaml.description %}
<center>{{ yaml.description | markdown | safe }}</center>
2019-10-15 21:20:37 +02:00
{% endif %}
{% if xml.description %}
2019-10-14 21:40:50 +02:00
<center>{{ xml.description | markdown | safe }}</center>
{% endif %}
{% if yaml.steps %}
<ul>
{% for step in yaml.steps %}
<li>{{ step }}</li>
{% endfor %}
</ul>
{% endif %}
2019-10-06 12:58:50 +02:00
</div>
2019-09-10 00:52:30 +02:00
</div>
{#
{% for item in xml.components %}
{{item["@x"]}},
{{item["@y"]}},
{{item["@db_entry"]}}<br>
{% endfor %}
#}