Skip to content

Commit

Permalink
kirby
Browse files Browse the repository at this point in the history
  • Loading branch information
lindenb committed Aug 30, 2023
1 parent a9ff2df commit aa03da2
Show file tree
Hide file tree
Showing 4 changed files with 281 additions and 0 deletions.
103 changes: 103 additions & 0 deletions stylesheets/comics/layout2html.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
<?xml version='1.0' encoding="UTF-8" ?>
<xsl:stylesheet
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
xmlns:g="http://www.gexf.net/1.1draft"
xmlns:viz="http://www.gexf.net/1.1draft/viz"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:h='http://www.w3.org/1999/xhtml'
version='1.0'
>
<xsl:output method="xml" indent="yes"/>
<xsl:variable name="width" select="number(100)"/>
<xsl:variable name="height" select="number(150)"/>

<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<div style="display: grid; grid-template-columns:1fr 1fr 1fr 1fr 1fr 1fr 1fr ;grid-gap: 20px;">
<xsl:apply-templates select="layouts/layout"/>
</div>
</body>
</html>
</xsl:template>

<xsl:template match="layout">
<span>
<b><xsl:value-of select="@id"/></b>
<svg>
<xsl:attribute name="width" select="$width + 1"/>
<xsl:attribute name="height" select="$height + 1"/>
<style>
.layout {fill:yellow;}
.panel {fill:gray;stroke:black;}
</style>
<g>
<rect class="layout">

<xsl:attribute name="width">
<xsl:value-of select="$width"/>
</xsl:attribute>


<xsl:attribute name="height">
<xsl:value-of select="$height"/>
</xsl:attribute>


</rect>
<xsl:apply-templates select="panel"/>

</g>
</svg>
</span>
</xsl:template>

<xsl:template match="panel">
<xsl:variable name="w">
<xsl:call-template name="maxX">
<xsl:with-param name="node" select=".."/>
</xsl:call-template>
</xsl:variable>


<xsl:variable name="h">
<xsl:call-template name="maxY">
<xsl:with-param name="node" select=".."/>
</xsl:call-template>
</xsl:variable>

<rect class="panel">
<xsl:attribute name="x">
<xsl:value-of select="$width * (number(@x) div $w)"/>
</xsl:attribute>
<xsl:attribute name="y">
<xsl:value-of select="$height * (number(@y) div $h)"/>
</xsl:attribute>
<xsl:attribute name="width">
<xsl:value-of select="$width * (number(@width) div $w)"/>
</xsl:attribute>
<xsl:attribute name="height">
<xsl:value-of select="$height * (number(@height) div $h)"/>
</xsl:attribute>

</rect>
</xsl:template>

<xsl:template name="maxX">
<xsl:param name="node"/>
<xsl:for-each select="$node/panel">
<xsl:sort select="number(@width) + number(@x)" data-type="number" order="descending"/>
<xsl:if test="position() = 1"><xsl:value-of select="(number(@width) + number(@x))"/></xsl:if>
</xsl:for-each>
</xsl:template>

<xsl:template name="maxY">
<xsl:param name="node"/>
<xsl:for-each select="$node/panel">
<xsl:sort select="number(@height) + number(@y)" data-type="number" order="descending"/>
<xsl:if test="position() = 1"><xsl:value-of select="(number(@height) + number(@y))"/></xsl:if>
</xsl:for-each>
</xsl:template>

</xsl:stylesheet>

140 changes: 140 additions & 0 deletions stylesheets/comics/layouts.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
<?xml version="1.0"?>
<layouts>
<layout id="kirby3p1">
<panel x="0" y="0" width="1" height="1"/>
<panel x="0" y="1" width="1" height="1"/>
<panel x="0" y="2" width="1" height="1"/>
</layout>
<layout id="kirby3p2">
<panel x="0" y="0" width="2" height="1"/>
<panel x="0" y="1" width="1" height="2"/>
<panel x="1" y="1" width="1" height="2"/>
</layout>
<layout id="kirby3p3">
<panel x="0" y="0" width="1" height="2"/>
<panel x="1" y="0" width="1" height="1"/>
<panel x="1" y="1" width="1" height="1"/>
</layout>
<layout id="kirby3p4">
<panel x="0" y="0" width="1" height="1"/>
<panel x="1" y="0" width="1" height="1"/>
<panel x="0" y="1" width="2" height="2"/>
</layout>
<layout id="kirby4p1">
<panel x="0" y="0" width="1" height="1"/>
<panel x="0" y="1" width="1" height="1"/>
<panel x="0" y="2" width="1" height="1"/>
<panel x="0" y="3" width="1" height="1"/>
</layout>
<layout id="kirby4p2">
<panel x="0" y="0" width="2" height="1"/>
<panel x="0" y="1" width="1" height="1"/>
<panel x="1" y="1" width="1" height="1"/>
<panel x="0" y="2" width="2" height="1"/>
</layout>
<layout id="kirby4p3">
<panel x="0" y="0" width="1" height="1"/>
<panel x="1" y="0" width="1" height="1"/>
<panel x="0" y="1" width="1" height="1"/>
<panel x="1" y="1" width="1" height="1"/>
</layout>
<layout id="kirby4p4">
<panel x="0" y="0" width="1" height="1"/>
<panel x="1" y="0" width="1" height="1"/>
<panel x="0" y="1" width="1" height="2"/>
<panel x="1" y="1" width="1" height="2"/>
</layout>
<layout id="kirby4p5">
<panel x="0" y="0" width="1" height="3"/>
<panel x="1" y="0" width="1" height="1"/>
<panel x="1" y="1" width="1" height="1"/>
<panel x="1" y="2" width="1" height="1"/>
</layout>
<layout id="kirby4p6">
<panel x="0" y="0" width="1" height="2"/>
<panel x="1" y="0" width="1" height="2"/>
<panel x="2" y="0" width="1" height="2"/>
<panel x="0" y="2" width="3" height="1"/>
</layout>
<layout id="kirby5p1">
<panel x="0" y="0" width="2" height="1"/>
<panel x="0" y="1" width="1" height="1"/>
<panel x="1" y="1" width="1" height="1"/>
<panel x="0" y="2" width="1" height="1"/>
<panel x="1" y="2" width="1" height="1"/>
</layout>
<layout id="kirby5p2">
<panel x="0" y="0" width="1" height="1"/>
<panel x="1" y="0" width="1" height="1"/>
<panel x="0" y="1" width="1" height="1"/>
<panel x="1" y="1" width="1" height="1"/>
<panel x="0" y="2" width="2" height="1"/>
</layout>
<layout id="kirby5p3">
<panel x="0" y="0" width="1" height="1"/>
<panel x="1" y="0" width="1" height="1"/>
<panel x="2" y="0" width="1" height="1"/>
<panel x="0" y="1" width="3" height="1"/>
<panel x="0" y="2" width="3" height="1"/>
</layout>
<layout id="kirby5p4">
<panel x="0" y="0" width="2" height="1"/>
<panel x="2" y="0" width="2" height="1"/>
<panel x="4" y="0" width="2" height="1"/>
<panel x="0" y="1" width="3" height="2"/>
<panel x="3" y="1" width="3" height="2"/>
</layout>
<layout id="kirby5p5">
<panel x="0" y="0" width="3" height="1"/>
<panel x="0" y="1" width="1" height="1"/>
<panel x="1" y="1" width="1" height="1"/>
<panel x="2" y="1" width="1" height="1"/>
<panel x="0" y="2" width="3" height="1"/>
</layout>
<layout id="kirby6p1">
<panel x="0" y="0" width="1" height="1"/>
<panel x="1" y="0" width="1" height="1"/>
<panel x="0" y="1" width="1" height="1"/>
<panel x="1" y="1" width="1" height="1"/>
<panel x="0" y="2" width="1" height="1"/>
<panel x="1" y="2" width="1" height="1"/>
</layout>
<layout id="kirby6p2">
<panel x="0" y="0" width="1" height="1"/>
<panel x="1" y="0" width="1" height="1"/>
<panel x="2" y="0" width="1" height="1"/>
<panel x="0" y="1" width="1" height="2"/>
<panel x="1" y="1" width="2" height="1"/>
<panel x="1" y="2" width="2" height="1"/>
</layout>
<layout id="kirby7p1">
<panel x="0" y="0" width="3" height="1"/>
<panel x="3" y="0" width="3" height="1"/>
<panel x="0" y="1" width="2" height="1"/>
<panel x="2" y="1" width="2" height="1"/>
<panel x="4" y="1" width="2" height="1"/>
<panel x="0" y="2" width="3" height="1"/>
<panel x="3" y="2" width="3" height="1"/>
</layout>
<layout id="kirby8p1">
<panel x="0" y="0" width="1" height="1"/>
<panel x="1" y="0" width="1" height="1"/>
<panel x="0" y="1" width="1" height="1"/>
<panel x="1" y="1" width="1" height="1"/>
<panel x="0" y="2" width="1" height="1"/>
<panel x="1" y="2" width="1" height="1"/>
<panel x="0" y="3" width="1" height="1"/>
<panel x="1" y="3" width="1" height="1"/>
</layout>
<layout id="kirby9p1">
<panel x="0" y="0" width="1" height="1"/>
<panel x="1" y="0" width="1" height="1"/>
<panel x="2" y="0" width="1" height="1"/>
<panel x="0" y="1" width="1" height="1"/>
<panel x="1" y="1" width="1" height="1"/>
<panel x="2" y="1" width="1" height="1"/>
<panel x="0" y="2" width="1" height="1"/>
<panel x="1" y="2" width="1" height="1"/>
<panel x="2" y="2" width="1" height="1"/>
</layout>
</layouts>
37 changes: 37 additions & 0 deletions stylesheets/imgur/imgur2atom.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version='1.0' encoding="UTF-8" ?>
<xsl:stylesheet
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
xmlns:a="http://www.w3.org/2005/Atom"
xmlns:h='http://www.w3.org/1999/xhtml'
xmlns:date="http://exslt.org/dates-and-times"
exclude-result-prefixes="a h date"
version='1.0'>
<xsl:output method="xml" ident="yes"/>

<xsl:template match="/">
<feed xmlns="http://www.w3.org/2005/Atom">
<title><xsl:value-of select="normalize-space(html/head/title)"/></title>
<updated><xsl:value-of select="date:date-time()"/></updated>
<xsl:apply-templates select="//a[@href and img/@src]"/>
</feed>
</xsl:template>

<xsl:template match="a">
<entry xmlns="http://www.w3.org/2005/Atom">
<id><xsl:value-of select="@href"/></id>
<link><xsl:value-of select="@href"/></link>
<updated><xsl:value-of select="date:date-time()"/></updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<a target="_blank">
<xsl:attribute name="href">https://imgur.com<xsl:value-of select="@href"/></xsl:attribute>
<img>
<xsl:attribute name="src">https:<xsl:value-of select="img/@src"/></xsl:attribute>
</img>
</a>
</div>
</content>
</entry>
</xsl:template>

</xsl:stylesheet>
1 change: 1 addition & 0 deletions stylesheets/rss/atom2slideshow.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function init() {
};
function show(idx) {
if(idx&lt;0 ||idx &gt;=feeds.length) return;
window.scrollTo(0,0);
var feed = feeds[idx];
var root= document.getElementById("content");
while(root.firstChild) root.removeChild(root.firstChild);
Expand Down

0 comments on commit aa03da2

Please sign in to comment.