112 lines
2.4 KiB
Django/Jinja
112 lines
2.4 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>" %}
|
|
{% set gt = "<xsl:text disable-output-escaping='yes'>></xsl:text>" %}
|
|
{% set lt = "<xsl:text disable-output-escaping='yes'><</xsl:text>" %}
|
|
{% set amp = "<xsl:text disable-output-escaping='yes'>&</xsl:text>" %}
|
|
<html>
|
|
|
|
{% filter replace(">", ">foobarhuehuehue")
|
|
| replace("<", lt)
|
|
| replace(">foobarhuehuehue", gt)
|
|
| 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="margin:0px;">
|
|
|
|
<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",
|
|
"artistic_value",
|
|
"playcost"] %}
|
|
{{lt}}script type="text/html" class="xml_data" id="xml_data_{{ value }}"{{gt}}<xsl:value-of select="{{ value }}"/>{{lt}}/script{{gt}}
|
|
{{ newline }}
|
|
{% endfor %}
|
|
|
|
{{ newline }}
|
|
|
|
<xsl:for-each select="component">
|
|
|
|
{{lt}}script type="text/html" class="xml_component" id="xml_component{#
|
|
#}_<xsl:value-of select="position()"/>_{#
|
|
#}x"{{gt}}
|
|
<xsl:value-of select="@x"/>
|
|
{{lt}}/script{{gt}}
|
|
{{ newline }}
|
|
|
|
{{lt}}script type="text/html" class="xml_component" id="xml_component{#
|
|
#}_<xsl:value-of select="position()"/>_{#
|
|
#}y"{{gt}}
|
|
<xsl:value-of select="@y"/>
|
|
{{lt}}/script{{gt}}
|
|
{{ newline }}
|
|
|
|
{{lt}}script type="text/html" class="xml_component" id="xml_component{#
|
|
#}_<xsl:value-of select="position()"/>_{#
|
|
#}db_entry"{{gt}}
|
|
<xsl:value-of select="@db_entry"/>
|
|
{{lt}}/script{{gt}}
|
|
{{ newline }}
|
|
|
|
</xsl:for-each>
|
|
|
|
|
|
|
|
|
|
{{ 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("<", lt)
|
|
| replace(">foobarhuehuehue", gt)
|
|
| replace("&spismegdinnisse", amp) }}
|
|
</script>
|
|
|
|
{{ newline*2 }}
|
|
|
|
</body>
|
|
{{ newline }}
|
|
</html>
|
|
|
|
</xsl:template>
|
|
</xsl:stylesheet>
|