Fixed
This commit is contained in:
parent
96978e2f22
commit
da1e53b190
4
Makefile
4
Makefile
|
@ -26,7 +26,7 @@ with open("build/card.xml", "w") as f:
|
||||||
endef
|
endef
|
||||||
|
|
||||||
export PYTHON_MAKE_CARD_XML
|
export PYTHON_MAKE_CARD_XML
|
||||||
build/card.xml: card.yaml
|
build/card.xml: card.yaml templates/card.xml.j2
|
||||||
python3 -c "$$PYTHON_MAKE_CARD_XML"
|
python3 -c "$$PYTHON_MAKE_CARD_XML"
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,6 +37,8 @@ with open("style.html.j2") as f: jinja_data = f.read()
|
||||||
with open("style.js") as f: js_data = f.read()
|
with open("style.js") as f: js_data = f.read()
|
||||||
with open("build/style.xsl", "w") as f:
|
with open("build/style.xsl", "w") as f:
|
||||||
f.write(Environment(
|
f.write(Environment(
|
||||||
|
trim_blocks=True,
|
||||||
|
lstrip_blocks=True,
|
||||||
loader=FileSystemLoader('templates'))
|
loader=FileSystemLoader('templates'))
|
||||||
.get_template('style.xsl.j2')
|
.get_template('style.xsl.j2')
|
||||||
.render( css_data=css_data, jinja_data=jinja_data, js_data=js_data))
|
.render( css_data=css_data, jinja_data=jinja_data, js_data=js_data))
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
</div>
|
</div>
|
||||||
{%- endmacro -%}
|
{%- endmacro -%}
|
||||||
|
|
||||||
<div class="{{ card.template }}">
|
<div class="fjomp_card">
|
||||||
<header>{{ card.title }}</header>
|
<header>{{ card.title }}</header>
|
||||||
<figure>
|
<figure>
|
||||||
{% for figure in card.figures -%}
|
{% for figure in card.figures -%}
|
||||||
|
|
2
style.js
2
style.js
|
@ -28,4 +28,4 @@ env.addFilter('all', function(iterable) {
|
||||||
|
|
||||||
rendered = env.renderString(jinja_template, context);
|
rendered = env.renderString(jinja_template, context);
|
||||||
console.log(rendered);
|
console.log(rendered);
|
||||||
document.getElementById("my_card").innerHTML = rendered;
|
document.write(rendered);
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
<ability_card><yaml_data>
|
<ability_card><yaml_data>
|
||||||
{{ data }}
|
{{ data.strip() }}
|
||||||
</yaml_data></ability_card>
|
</yaml_data></ability_card>
|
||||||
|
|
|
@ -1,16 +1,21 @@
|
||||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||||
<xsl:output method="html" omit-xml-declaration="yes" indent="yes" />
|
<xsl:output method="xml" omit-xml-declaration="yes" />
|
||||||
<xsl:template match="/*">
|
<xsl:template match="/*">
|
||||||
<xsl:text disable-output-escaping='yes'><!DOCTYPE html>
|
|
||||||
</xsl:text>
|
|
||||||
|
|
||||||
{% set newline = "<xsl:text disable-output-escaping='yes'>\n</xsl:text>" %}
|
{% set newline = "<xsl:text disable-output-escaping='yes'>\n</xsl:text>" %}
|
||||||
{% set async = "media=\"none\" onload=\"if(media!='all')media='all'\"" %}
|
{% set async = "media=\"none\" onload=\"if(media!='all')media='all'\"" %}
|
||||||
|
|
||||||
{% filter replace("\n", newline) %}
|
<html>
|
||||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/js-yaml/3.13.1/js-yaml.min.js"/>
|
|
||||||
<script type="text/javascript" src="http://mozilla.github.io/nunjucks/files/nunjucks.min.js"/>
|
{% filter replace(">", ">foobarhuehuehue")
|
||||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/markdown-it/9.1.0/markdown-it.min.js"/>
|
| replace("<", "<xsl:text disable-output-escaping='yes'><</xsl:text>")
|
||||||
|
| replace(">foobarhuehuehue", "<xsl:text disable-output-escaping='yes'>></xsl:text>")
|
||||||
|
| replace("\n", newline) %}
|
||||||
|
|
||||||
|
<head>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/js-yaml/3.13.1/js-yaml.min.js"></script>
|
||||||
|
<script type="text/javascript" src="https://mozilla.github.io/nunjucks/files/nunjucks.min.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/markdown-it/9.1.0/markdown-it.min.js"></script>
|
||||||
|
|
||||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" {{async}}/>
|
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" {{async}}/>
|
||||||
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" {{async}}/>
|
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" {{async}}/>
|
||||||
|
@ -20,33 +25,42 @@
|
||||||
|
|
||||||
<title>Status Card</title>
|
<title>Status Card</title>
|
||||||
|
|
||||||
|
</head>
|
||||||
{% endfilter %}
|
{% endfilter %}
|
||||||
|
|
||||||
|
<body content_type="html5">
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
{{ css_data }}
|
{{ css_data.strip() }}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
{{ newline*2 }}
|
{{ newline*2 }}
|
||||||
|
|
||||||
<script type="text/html" id="yaml_data">---
|
<script type="text/html" id="yaml_data">
|
||||||
<xsl:value-of select="yaml_data"/>
|
<xsl:value-of select="yaml_data"/>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{{ newline*2 }}
|
{{ newline*2 }}
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var jinja_template = {{ jinja_data | tojson }};
|
var jinja_template =
|
||||||
|
{{ jinja_data.strip() | tojson | replace("\\n", "\\n\" +\n\"") }};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{{ newline*2 }}
|
{{ newline*2 }}
|
||||||
|
|
||||||
<div id="my_card"></div>
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
{{ js_data
|
{{ js_data.strip()
|
||||||
| replace(">", ">foobarhuehuehue")
|
| replace(">", ">foobarhuehuehue")
|
||||||
| replace("<", "<xsl:text disable-output-escaping='yes'><</xsl:text>")
|
| replace("<", "<xsl:text disable-output-escaping='yes'><</xsl:text>")
|
||||||
| replace(">foobarhuehuehue", "<xsl:text disable-output-escaping='yes'>></xsl:text>") }}
|
| replace(">foobarhuehuehue", "<xsl:text disable-output-escaping='yes'>></xsl:text>") }}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
{{ newline*2 }}
|
||||||
|
|
||||||
|
</body>
|
||||||
|
{{ newline }}
|
||||||
|
</html>
|
||||||
|
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
</xsl:stylesheet>
|
</xsl:stylesheet>
|
||||||
|
|
Loading…
Reference in New Issue