translate style 6 from xsl to html

This commit is contained in:
Peder Bergebakken Sundt 2022-11-30 00:26:06 +01:00
parent dd3182f385
commit 67e724f64c
3 changed files with 55 additions and 4 deletions

View File

@ -2,6 +2,5 @@
cd "$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)"
xsltproc \
<(./render.sh) \
test_card.xml
#xsltproc <(./render.sh) test_card.xml
echo TODO

View File

@ -6,4 +6,5 @@ css_data="$(sass --style expanded style.scss)" \
jinja_data="$(cat style.html.j2)" \
js_data="$(cat style.js)" \
card_header="$(j2 templates/card_header.html.j2)" \
j2 templates/style.xsl.j2
j2 templates/style.html.j2
#j2 templates/style.xsl.j2

View File

@ -0,0 +1,51 @@
<!DOCTYPE html>
{{ card_header }}
<title>Status Card</title>
<style type="text/css">
{{ css_data.strip() }}
</style>
<body style="margin:0px;">
<script type="text/html" id="yaml_data">
##DATA::/ability_card/yaml_data##
</script>
{# just name all the xml fields of interest here #}
{% for value in [
"name",
"description",
"image",
"cp",
"range",
"power",
"symbol",
"difficulty",
"duration",
"artistic_value",
"playcost",
] %}
<script type="text/html" class="xml_data" id="xml_data_{{ value }}">##DATA::/ability_card/{{ value }}##</script>
{% endfor %}
{# 2hacky4me #}
<script type="text/javascript">
const component_data = ##JSON::/ability_card/component##;
var i = 1;
for (const component of component_data) {
document.write('<script type="text/html" class="xml_component" id="xml_component_' + i + '_x">' + component.attributes.x + '</script' + '>');
document.write('<script type="text/html" class="xml_component" id="xml_component_' + i + '_y">' + component.attributes.y + '</script' + '>');
document.write('<script type="text/html" class="xml_component" id="xml_component_' + i + '_db_entry">' + component.attributes.db_entry + '</script' + '>');
i += 1;
}
</script>
<script type="text/javascript">
var jinja_template =
{{ jinja_data.strip() | tojson | replace("\\n", "\\n\" +\n\"") }};
</script>
<script type="text/javascript">
{{ js_data }}
</script>