RPGs3_card_insanity/templates/style.xsl.j2

79 lines
1.8 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-09-10 17:54:18 +02:00
<html>
{% filter replace(">", ">foobarhuehuehue")
| replace("<", "<xsl:text disable-output-escaping='yes'>&lt;</xsl:text>")
| replace(">foobarhuehuehue", "<xsl:text disable-output-escaping='yes'>&gt;</xsl:text>")
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"] %}
<script type="text/html" class="xml_data" id="xml_data_{{ value }}"><xsl:value-of select="{{ value }}"/></script>
{{ 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-09-10 00:52:30 +02:00
| replace("<", "<xsl:text disable-output-escaping='yes'>&lt;</xsl:text>")
2019-10-06 16:03:07 +02:00
| replace(">foobarhuehuehue", "<xsl:text disable-output-escaping='yes'>&gt;</xsl:text>")
| replace("&spismegdinnisse", "<xsl:text disable-output-escaping='yes'>&amp;</xsl:text>") }}
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>