RPGs3_card_insanity/templates/style.xsl.j2

79 lines
1.8 KiB
Django/Jinja

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" omit-xml-declaration="yes" />
<xsl:template match="/*">
{% set newline = "<xsl:text disable-output-escaping='yes'>\n</xsl:text>" %}
<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>")
| replace("\n", newline)
| replace("</xsl:text><xsl:text disable-output-escaping='yes'>", "") %}
<head>
{{ card_header }}
<title>Status Card</title>
</head>
{% endfilter %}
<body content_type="html5">
<style type="text/css">
{{ css_data.strip() }}
</style>
{{ newline*2 }}
<script type="text/html" id="yaml_data">
<xsl:value-of select="yaml_data"/>
</script>
{{ newline*2 }}
{# 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 }}
<script type="text/javascript">
var jinja_template =
{{ jinja_data.strip() | tojson | replace("\\n", "\\n\" +\n\"") }};
</script>
{{ newline*2 }}
<script type="text/javascript">
{{ js_data.strip()
| replace(">", ">foobarhuehuehue")
| replace("&", "&spismegdinnisse")
| replace("<", "<xsl:text disable-output-escaping='yes'>&lt;</xsl:text>")
| replace(">foobarhuehuehue", "<xsl:text disable-output-escaping='yes'>&gt;</xsl:text>")
| replace("&spismegdinnisse", "<xsl:text disable-output-escaping='yes'>&amp;</xsl:text>") }}
</script>
{{ newline*2 }}
</body>
{{ newline }}
</html>
</xsl:template>
</xsl:stylesheet>