This commit is contained in:
Peder Bergebakken Sundt 2019-09-19 02:43:21 +02:00
parent 4c47f2111e
commit df6056c56c
5 changed files with 36 additions and 20 deletions

View File

@ -44,15 +44,15 @@ with open(sys.argv[2], "w") as f:
endef
export PYTHON_MAKE_JINJA2_RENDERED_CARD
build/test_card_rendered.html: test_card.yaml style.html.j2 templates/card_header.html.j2
build/test_card_rendered.html: test_card.yaml style.html.j2 build/style.css templates/card_header.html.j2
python3 -c "$$PYTHON_MAKE_JINJA2_RENDERED_CARD" "test_card.yaml" "build/test_card_rendered.html"
export PYTHON_MAKE_JINJA2_RENDERED_CARD
cards/build/%.html: cards/%.yaml style.html.j2 templates/card_header.html.j2
cards/build/%.html: cards/%.yaml style.html.j2 build/style.css templates/card_header.html.j2
python3 -c "$$PYTHON_MAKE_JINJA2_RENDERED_CARD" $< $@
export PYTHON_MAKE_JINJA2_RENDERED_CARD
cards/build/all.html: $(CARDS) style.html.j2 templates/card_header.html.j2
cards/build/all.html: $(CARDS) style.html.j2 build/style.css templates/card_header.html.j2
python3 -c "$$PYTHON_MAKE_JINJA2_RENDERED_CARD" ALL $@

View File

@ -29,28 +29,27 @@
<span class="oi" data-glyph="{{ figure.name }}"></span>
{% elif figure.type == "svg" %}
{# /cards/svg #}
{% if figure.color %}
{% if figure.color == true %}
<img src="https://pvv.ntnu.no/~pederbs/cards/svg/data/{{ figure.name }}">
{% else %}
<img src="https://pvv.ntnu.no/~pederbs/cards/svg/data/{{ figure.name }}" class="colored" style="--figure-color:{{ figure.color }}">
{% endif %}
{% 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 %}
<img src="https://pvv.ntnu.no/~pederbs/cards/img/data/{{ figure.name }}" class="colored" style="--figure-color:{{ figure.color }}">
{% 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 %}
{% endif %}
</div>
{% endmacro %}
<div class="fjomp_card">
<div class="fjomp_card{{" " + card.style if card.style}}">
<header>{{ card.title }}</header>
<figure>
{% for figure in card.figures %}

View File

@ -54,8 +54,9 @@
height: 100%;
}
img {
max-width: calc(var(--figure-size) * 0.9);
max-height: calc(var(--figure-size) * 0.9);
width: calc(var(--figure-size) * 0.9);
height: calc(var(--figure-size) * 0.9);
object-fit: contain;
}
img.colored {
transform: translateY(-10000px);
@ -128,7 +129,7 @@
background-color: #fff;
grid-template-rows: 1.6em var(--figure-size) 2.1em auto;
header {
margin-top: none;
margin-top: 0;
background-color: #ddd;
color: #333;
}
@ -152,3 +153,17 @@
background-color: #ddd;
}
}
.fjomp_card.item {
--figure-size: 1.35in;
--figure-size: 1.5in;
grid-template-columns: 1fr;
grid-template-areas:
"title"
"figure"
"costbar"
"description";
aside {
display: none;
}
}

View File

@ -87,7 +87,7 @@ def push_all():
fname = f"cards/{card_id}.yaml"
with open(fname) as f:
yaml_data = f.read()
xml_data = f"<ability_card><yaml_data>\n{yaml_data.strip()}\n</yaml_data>\n\n\n</ability_card>"
xml_data = f"<ability_card><yaml_data>\n{yaml_data.strip()}\n</yaml_data></ability_card>"
elif os.path.isfile(f"cards/{card_id}.xml"):
fname = f"cards/{card_id}.xml"
with open(fname) as f:

View File

@ -1,8 +1,10 @@
{% set async = "media=\"none\" onload=\"if(media!='all')media='all'\"" -%}
{% if is_local %}
<meta http-equiv="refresh" content="0.5">
{#
<script type="text/javascript" src="http://livejs.com/live.js"></script>
{#<meta http-equiv="refresh" content="3">#}
#}
{% endif %}
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/js-yaml/3.13.1/js-yaml.min.js"></script>