RPGs3_card_insanity/style.html.j2

204 lines
8.0 KiB
Plaintext
Raw Normal View History

2019-10-20 03:37:24 +02:00
{% set xml_image_not_done = [1] %}{# why must nunjucks suck so much? #}
2019-10-20 03:25:33 +02:00
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-20 03:25:33 +02:00
{% if figure.source == "xml" %}
{% set figure_name = xml.image if xml.image | startswith("http") else xml.image | split(":") | tail | join(":") %}
{% set figure_source = "url" if xml.image | startswith("http") else xml.image | split(":") | first %}
2019-10-20 03:37:24 +02:00
{% if xml_image_not_done.pop() %}{% endif %}
2019-10-20 03:25:33 +02:00
{% else %}
{% set figure_name = figure.name %}
{% set figure_source = figure.source %}
{% endif %}
2019-10-14 21:40:50 +02:00
<div class="layer" style="{{ figure_style }}">
2019-10-20 03:25:33 +02:00
{% if figure_source == "material-icons" %}
2019-09-11 05:09:42 +02:00
{# https://material.io/icons/ #}
2019-10-20 03:25:33 +02:00
<i class="material-icons figure">{{ figure_name }}</i>
{% elif figure_source == "mdi" %}
2019-09-11 05:09:42 +02:00
{# https://materialdesignicons.com/ #}
2019-10-20 03:25:33 +02:00
<i class="mdi mdi-{{ figure_name }}"></i>
{% elif figure_source == "fa" %}
2019-09-11 05:09:42 +02:00
{# http://fontawesome.io/icons/ #}
2019-10-20 03:25:33 +02:00
<i class="fa fa-{{ figure_name }}"></i>
{% elif figure_source == "lnr" %}
2019-09-11 05:09:42 +02:00
{# https://linearicons.com/free #}
2019-10-20 03:25:33 +02:00
<span class="lnr lnr-{{ figure_name }}"></span>
{% elif figure_source == "oi" %}
2019-09-11 05:09:42 +02:00
{# https://useiconic.com/open #}
2019-10-20 03:25:33 +02:00
<span class="oi" data-glyph="{{ figure_name }}"></span>
{% elif figure_source == "svg" %}
2019-10-14 21:40:50 +02:00
{# pvv.ntnu.no/~pederbs/cards/svg #}
2019-09-19 02:43:21 +02:00
{% if figure.color == true %}
2019-10-20 03:25:33 +02:00
<img src="https://pvv.ntnu.no/~pederbs/cards/svg/data/{{ figure_name }}">
2019-09-19 02:43:21 +02:00
{% elif figure.color %}
2019-10-20 03:25:33 +02:00
<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-10-20 03:25:33 +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-20 03:25:33 +02:00
{% elif figure_source in ["img", "emoji"] %}
2019-10-14 21:40:50 +02:00
{# pvv.ntnu.no/~pederbs/cards/img #}
{# /cards/emoji #}
2019-09-19 02:43:21 +02:00
{% if figure.color == true %}
2019-10-20 03:25:33 +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-20 03:25:33 +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-20 03:25:33 +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-20 03:25:33 +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 %}
2019-10-20 03:37:24 +02:00
{% if xml.image and xml_image_not_done | length %}
2019-10-14 21:40:50 +02:00
{{ 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-20 03:25:33 +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>
{% elif playcost | trim | split(" ") | length == 1 %}
<section>
<big>{{ 1 }}</big><br>
<small>{{ playcost }}</small>
</section>
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
2019-10-06 21:43:37 +02:00
{% for label, data in [
2019-10-20 03:25:33 +02:00
["Artistic Value", xml.artistic_value],
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>
2019-10-20 03:25:33 +02:00
<big>
{% for part in data | split("+") %}
{% if "death" not in part %}
{{"+" if not loop.first }}
{{ part }}
{% endif %}
{% endfor %}
</big><br>
{# <big>{{ data }}</big><br> #}
2019-10-14 21:40:50 +02:00
<small>{{ label }}</small>
</section>
2019-10-06 21:43:37 +02:00
{% 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 ) %}
2019-10-20 03:25:33 +02:00
{% if playcost | trim | split(" ") | first | is_number %}
{% elif playcost | trim | split(" ") | length == 1 %}
{% else %}
<li>{{ playcost }}</li>
2019-10-15 21:20:37 +02:00
{% 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 %}
2020-03-07 01:30:04 +01:00
<div class="markdown">{{ yaml.description | markdown | safe }}</div>
2019-10-15 21:20:37 +02:00
{% endif %}
{% if xml.description %}
2020-03-07 01:30:04 +01:00
<div class="markdown">{{ xml.description | markdown | safe }}</div>
2019-10-14 21:40:50 +02:00
{% endif %}
{% if yaml.steps %}
<ul>
{% for step in yaml.steps %}
<li>{{ step }}</li>
{% endfor %}
</ul>
{% endif %}
2020-03-07 01:29:38 +01:00
<div class="bottom" style="text-align: center; font-size:1.6em;">
{% for component in xml.components %}
{% if component["@db_entry"] | endswith("Mastery") %}
&#x274F; &#x274F; &#x274F; &#x274F; &#x274F;
&#x274F; &#x274F; &#x274F; &#x274F; &#x274F; <br>
{% endif %}
{% endfor %}
</div>
2019-10-06 12:58:50 +02:00
</div>
2019-09-10 00:52:30 +02:00
</div>
{#
2019-10-20 03:25:33 +02:00
{% for item in xml.components %}
{{item["@x"]}},
{{item["@y"]}},
{{item["@db_entry"]}}<br>
{% endfor %}
#}