RPGs3_card_insanity/templates/style.xsl.j2

81 lines
1.7 KiB
Plaintext
Raw Normal View History

2019-09-09 18:54:25 +02:00
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
2019-09-10 17:54:18 +02:00
<xsl:output method="xml" omit-xml-declaration="yes" />
2019-09-09 18:54:25 +02:00
<xsl:template match="/*">
2019-09-10 00:52:30 +02:00
{% set newline = "<xsl:text disable-output-escaping='yes'>\n</xsl:text>" %}
2019-10-06 21:43:37 +02:00
{% set gt = "<xsl:text disable-output-escaping='yes'>&gt;</xsl:text>" %}
{% set lt = "<xsl:text disable-output-escaping='yes'>&lt;</xsl:text>" %}
{% set amp = "<xsl:text disable-output-escaping='yes'>&amp;</xsl:text>" %}
2019-09-10 17:54:18 +02:00
<html>
{% filter replace(">", ">foobarhuehuehue")
2019-10-06 21:43:37 +02:00
| replace("<", lt)
| replace(">foobarhuehuehue", gt)
2019-09-18 22:46:23 +02:00
| replace("\n", newline)
| replace("</xsl:text><xsl:text disable-output-escaping='yes'>", "") %}
2019-09-10 17:54:18 +02:00
<head>
2019-09-18 22:46:23 +02:00
{{ card_header }}
2019-09-09 18:54:25 +02:00
<title>Status Card</title>
2019-09-09 19:29:27 +02:00
2019-09-10 17:54:18 +02:00
</head>
2019-09-10 00:52:30 +02:00
{% endfilter %}
2019-09-10 17:54:18 +02:00
<body content_type="html5">
2019-09-09 18:54:25 +02:00
<style type="text/css">
2019-09-10 17:54:18 +02:00
{{ css_data.strip() }}
2019-09-09 18:54:25 +02:00
</style>
2019-09-10 00:52:30 +02:00
{{ newline*2 }}
2019-09-10 17:54:18 +02:00
<script type="text/html" id="yaml_data">
2019-09-09 20:18:24 +02:00
<xsl:value-of select="yaml_data"/>
2019-09-09 18:54:25 +02:00
</script>
2019-09-10 00:52:30 +02:00
{{ newline*2 }}
2019-09-09 20:18:24 +02:00
2019-10-06 16:03:07 +02:00
{# just name all the xml fields of interest here #}
{% for value in [
"name",
"description",
"image",
"cp",
"range",
"power",
"symbol",
"difficulty",
"duration",
"playcost"] %}
2019-10-06 21:43:37 +02:00
{{lt}}script type="text/html" class="xml_data" id="xml_data_{{ value }}"{{gt}}<xsl:value-of select="{{ value }}"/>{{lt}}/script{{gt}}
2019-10-06 16:03:07 +02:00
{{ newline }}
{% endfor %}
{{ newline*2 }}
2019-09-09 18:54:25 +02:00
<script type="text/javascript">
2019-09-10 17:54:18 +02:00
var jinja_template =
{{ jinja_data.strip() | tojson | replace("\\n", "\\n\" +\n\"") }};
2019-09-09 19:29:27 +02:00
</script>
2019-09-10 00:52:30 +02:00
{{ newline*2 }}
2019-09-09 19:29:27 +02:00
<script type="text/javascript">
2019-09-10 17:54:18 +02:00
{{ js_data.strip()
2019-09-10 00:52:30 +02:00
| replace(">", ">foobarhuehuehue")
2019-10-06 16:03:07 +02:00
| replace("&", "&spismegdinnisse")
2019-10-06 21:43:37 +02:00
| replace("<", lt)
| replace(">foobarhuehuehue", gt)
| replace("&spismegdinnisse", amp) }}
2019-09-09 18:54:25 +02:00
</script>
2019-09-10 17:54:18 +02:00
{{ newline*2 }}
</body>
{{ newline }}
</html>
2019-09-09 18:54:25 +02:00
</xsl:template>
</xsl:stylesheet>