fuck my ass i hate nunjucks
This commit is contained in:
parent
8de13889d3
commit
9161623fe9
100
style.html.j2
100
style.html.j2
|
@ -1,3 +1,5 @@
|
|||
{% set xml_image_note_done = [1] %}{# why must nunjucks suck so much? #}
|
||||
|
||||
{% macro figure_layer(figure) %}
|
||||
{% set figure_style %}{% filter cull_whitespace %}
|
||||
{% if figure.opacity!=1 %}
|
||||
|
@ -26,42 +28,51 @@
|
|||
;
|
||||
{% endfilter %}{% endset %}
|
||||
|
||||
{% 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 %}
|
||||
{% if xml_image_note_done.clear() %}{% endif %}
|
||||
{% else %}
|
||||
{% set figure_name = figure.name %}
|
||||
{% set figure_source = figure.source %}
|
||||
{% endif %}
|
||||
|
||||
<div class="layer" style="{{ figure_style }}">
|
||||
{% if figure.source == "material-icons" %}
|
||||
{% if figure_source == "material-icons" %}
|
||||
{# https://material.io/icons/ #}
|
||||
<i class="material-icons figure">{{ figure.name }}</i>
|
||||
{% elif figure.source == "mdi" %}
|
||||
<i class="material-icons figure">{{ figure_name }}</i>
|
||||
{% elif figure_source == "mdi" %}
|
||||
{# https://materialdesignicons.com/ #}
|
||||
<i class="mdi mdi-{{ figure.name }}"></i>
|
||||
{% elif figure.source == "fa" %}
|
||||
<i class="mdi mdi-{{ figure_name }}"></i>
|
||||
{% elif figure_source == "fa" %}
|
||||
{# http://fontawesome.io/icons/ #}
|
||||
<i class="fa fa-{{ figure.name }}"></i>
|
||||
{% elif figure.source == "lnr" %}
|
||||
<i class="fa fa-{{ figure_name }}"></i>
|
||||
{% elif figure_source == "lnr" %}
|
||||
{# https://linearicons.com/free #}
|
||||
<span class="lnr lnr-{{ figure.name }}"></span>
|
||||
{% elif figure.source == "oi" %}
|
||||
<span class="lnr lnr-{{ figure_name }}"></span>
|
||||
{% elif figure_source == "oi" %}
|
||||
{# https://useiconic.com/open #}
|
||||
<span class="oi" data-glyph="{{ figure.name }}"></span>
|
||||
{% elif figure.source == "svg" %}
|
||||
<span class="oi" data-glyph="{{ figure_name }}"></span>
|
||||
{% elif figure_source == "svg" %}
|
||||
{# pvv.ntnu.no/~pederbs/cards/svg #}
|
||||
{% if figure.color == true %}
|
||||
<img src="https://pvv.ntnu.no/~pederbs/cards/svg/data/{{ figure.name }}">
|
||||
<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 }}">
|
||||
<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">
|
||||
<img src="https://pvv.ntnu.no/~pederbs/cards/svg/data/{{ figure_name }}" class="colored">
|
||||
{% endif %}
|
||||
{% elif figure.source in ["img", "emoji"] %}
|
||||
{% elif figure_source in ["img", "emoji"] %}
|
||||
{# pvv.ntnu.no/~pederbs/cards/img #}
|
||||
{# /cards/emoji #}
|
||||
{% if figure.color == true %}
|
||||
<img src="https://pvv.ntnu.no/~pederbs/cards/{{ figure.source }}/data/{{ figure.name }}" class="colored">
|
||||
<img src="https://pvv.ntnu.no/~pederbs/cards/{{ figure_source }}/data/{{ figure_name }}" class="colored">
|
||||
{% elif figure.color %}
|
||||
<img src="https://pvv.ntnu.no/~pederbs/cards/{{ figure.source }}/data/{{ figure.name }}" class="colored" style="--figure-color: {{ figure.color }}">
|
||||
<img src="https://pvv.ntnu.no/~pederbs/cards/{{ figure_source }}/data/{{ figure_name }}" class="colored" style="--figure-color: {{ figure.color }}">
|
||||
{% else %}
|
||||
<img src="https://pvv.ntnu.no/~pederbs/cards/{{ figure.source }}/data/{{ figure.name }}">
|
||||
<img src="https://pvv.ntnu.no/~pederbs/cards/{{ figure_source }}/data/{{ figure_name }}">
|
||||
{% endif %}
|
||||
{% elif figure.source == "url" %}
|
||||
{% elif figure_source == "url" %}
|
||||
{% if figure.color == true %}
|
||||
<img src="{{ figure.name }}" class="colored">
|
||||
{% elif figure.color %}
|
||||
|
@ -87,7 +98,7 @@
|
|||
{% for figure in yaml.figures or [] %}
|
||||
{{ figure_layer(figure) }}
|
||||
{% endfor %}
|
||||
{% if xml.image %}
|
||||
{% if xml.image and xml_image_note_done %}
|
||||
{{ 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
|
||||
|
@ -95,20 +106,6 @@
|
|||
{% endif %}
|
||||
</figure>
|
||||
<div class="costbar">
|
||||
{% for label, data in [
|
||||
["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]
|
||||
] %}
|
||||
{% if data %}
|
||||
<section>
|
||||
<big>{{ data }}</big><br>
|
||||
<small>{{ label }}</small>
|
||||
</section>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% for playcosts in [xml.playcost, yaml.playcost] %}
|
||||
{% if playcosts %}
|
||||
{% for playcost in (playcosts.split(",") if playcosts | is_string else playcosts ) %}
|
||||
|
@ -117,18 +114,48 @@
|
|||
<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 %}
|
||||
{% for label, data in [
|
||||
["Artistic Value", xml.artistic_value],
|
||||
["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]
|
||||
] %}
|
||||
{% if data %}
|
||||
<section>
|
||||
<big>
|
||||
{% for part in data | split("+") %}
|
||||
{% if "death" not in part %}
|
||||
{{"+" if not loop.first }}
|
||||
{{ part }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</big><br>
|
||||
{# <big>{{ data }}</big><br> #}
|
||||
<small>{{ label }}</small>
|
||||
</section>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="description">
|
||||
<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>
|
||||
{% if playcost | trim | split(" ") | first | is_number %}
|
||||
{% elif playcost | trim | split(" ") | length == 1 %}
|
||||
{% else %}
|
||||
<li>{{ playcost }}</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
@ -157,6 +184,7 @@
|
|||
</div>
|
||||
|
||||
{#
|
||||
|
||||
{% for item in xml.components %}
|
||||
{{item["@x"]}},
|
||||
{{item["@y"]}},
|
||||
|
|
16
style.scss
16
style.scss
|
@ -17,7 +17,7 @@
|
|||
|
||||
display: grid;
|
||||
grid-template-columns: auto 1fr;
|
||||
grid-template-rows: 1.9em var(--figure-size) 2.1em auto;
|
||||
grid-template-rows: 1.9em var(--figure-size) 2.3em auto;
|
||||
grid-template-areas:
|
||||
"symbol title"
|
||||
"figure figure"
|
||||
|
@ -98,7 +98,9 @@
|
|||
list-style-type: none;
|
||||
padding: 0;
|
||||
|
||||
li {}
|
||||
li {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
.costbar {
|
||||
|
@ -113,6 +115,8 @@
|
|||
justify-content: center;
|
||||
text-align: center;
|
||||
|
||||
font-size: 1.1em;
|
||||
|
||||
section{
|
||||
font-size: 0.8em;
|
||||
margin-left: 0.5mm;
|
||||
|
@ -125,6 +129,7 @@
|
|||
margin: 1mm;
|
||||
border-radius: 1mm;
|
||||
background-color: #ddd;
|
||||
font-size: 0.9em;
|
||||
|
||||
ul, ol {
|
||||
padding-left: 1.5em;
|
||||
|
@ -136,8 +141,7 @@
|
|||
}
|
||||
|
||||
|
||||
.fjomp_card.item {
|
||||
.playcosts {
|
||||
display: none;
|
||||
}
|
||||
.fjomp_card.figure,
|
||||
.fjomp_card.repertoire {
|
||||
--figure-size: 2.4in;
|
||||
}
|
||||
|
|
|
@ -5,13 +5,13 @@ tags:
|
|||
playcost:
|
||||
- 'Element: fire'
|
||||
- BODY+5 POWER
|
||||
flavor: Enemies sure are squishy
|
||||
#flavor: Enemies sure are squishy
|
||||
description: Perform an attack
|
||||
steps:
|
||||
- Do A
|
||||
- Do A
|
||||
- Do A
|
||||
- Then B
|
||||
#steps:
|
||||
#- Do A
|
||||
#- Do A
|
||||
#- Do A
|
||||
#- Then B
|
||||
figures:
|
||||
- name: piuy/chicken
|
||||
source: img
|
||||
|
|
Loading…
Reference in New Issue