Did someething

This commit is contained in:
Peder Bergebakken Sundt 2019-09-09 18:48:15 +02:00
parent fbe01f60b5
commit c41553fac8
4 changed files with 219 additions and 177 deletions

View File

@ -1,10 +1,11 @@
all: build/out.html
out.html: card.yaml build/card.xls style.html.j2 style.css
build/out.html: card.yaml build/card.xml build/style.xsl style.css
xsltproc \
--output out.html \
style.html.j2 \
build/card.xls
-o build/out.html \
build/style.xsl \
build/card.xml
define TMP_PYTHON_PROG
@ -20,14 +21,21 @@ out = Environment(
#print(out)
with open("build/card.xls", "w") as f:
f.write(data)
with open("build/card.xml", "w") as f:
f.write(out)
endef
export TMP_PYTHON_PROG
build/card.xls:
build/card.xml:
python -c "$$TMP_PYTHON_PROG"
build/style.xsl: style.html.j2
cp style.html.j2 build/style.xsl
.PHONY: dev
dev:
git ls-files | entr make all
.PHONY: clean
clean:

View File

@ -1,10 +1,30 @@
<!DOCTYPE html>
<script src="https://raw.githubusercontent.com/nodeca/js-yaml/master/dist/js-yaml.min.js"></script>
<script src="http://mozilla.github.io/nunjucks/files/nunjucks.min.js"></script>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css"/>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<!--
XSLT file for the status card style. This file is shared between all cards of this style.
This file transforms XML into renderable XHTML. The output must be a valid XHTML document.
If you want something more advanced than what XSLT can offer, feel free to go nuts with javascript here.
The XML can easily be converted to JSON using XSLT (https://www.bjelic.net/2012/08/01/coding/convert-xml-to-json-using-xslt/),
and if you just put that output into a <script> tag you have everything you need in javascript.
I strongly urge styles to produce an empty card even if the input is empty or mismatching.
The preview window looks sad otherwise.
-->
<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="/*">
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<title>Status Card</title>
<style type="text/css">
/**
* The Danner style of cards. Using grid layouts.
**/
.danner_card
{
display: grid;
@ -167,10 +187,12 @@
border: 0.1em solid #444444;
background-color: #eeeeee;
}
</style>
<xsl:template match="/*">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css"/>
</head>
<body>
<div class="danner_card">
@ -372,5 +394,9 @@
</xsl:if>
</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1 @@
todo

View File

@ -1,16 +1,23 @@
<!DOCTYPE html>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" omit-xml-declaration="yes" />
<xsl:template match="/*">
<xsl:text disable-output-escaping='yes'>&lt;!DOCTYPE html&gt;
</xsl:text>
<script src="https://raw.githubusercontent.com/nodeca/js-yaml/master/dist/js-yaml.min.js"></script>
<script src="http://mozilla.github.io/nunjucks/files/nunjucks.min.js"></script>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css"/>
<title>Status Card</title>
<style type="text/css">
{{ css_data }}
<xsl:include href="style.css"/>
</style>
<xsl:template match="/*">
<div class="fjomp_card">
asdasd<br/>
asdasd<br/>
asdasd<br/>
asdasd<br/>
</div>
</xsl:template>