commit: 2692edd8187a5c533d7bddd2ffce5854fd5fc3e4
parent b69f17220167ce56e5522f9d5cd9d2a37c7a8419
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Fri,  7 Apr 2023 12:57:05 +0200
nginx_autoindex.xsl.in: Add styling for nginx autoindex
Diffstat:
3 files changed, 48 insertions(+), 0 deletions(-)
diff --git a/config.ninja b/config.ninja
@@ -7,6 +7,7 @@ build config.ninja: gen_config configure | ./articles
 
 build entry.xsl: xinclude entry.xsl.in | ./templates/head.xml ./templates/en/nav.xsl ./templates/en/footer.shtml
 build bookmarks.xsl: xinclude bookmarks.xsl.in | ./templates/head.xml ./templates/en/nav.xsl ./templates/en/footer.shtml
+build nginx_autoindex.xsl: xinclude nginx_autoindex.xsl.in | ./templates/head.xml ./templates/en/nav.xsl ./templates/en/footer.shtml
 build articles/2022$ Summary.html: article entry.xsl articles/2022$ Summary.xml
 build articles/Why$ I$ embraced$ Wayland.html: article entry.xsl articles/Why$ I$ embraced$ Wayland.xml
 build articles/cve.org-disaster.html: article entry.xsl articles/cve.org-disaster.xml
diff --git a/configure b/configure
@@ -13,6 +13,7 @@ build config.ninja: gen_config configure | ./articles
 
 build entry.xsl: xinclude entry.xsl.in | ${templates_en}
 build bookmarks.xsl: xinclude bookmarks.xsl.in | ${templates_en}
+build nginx_autoindex.xsl: xinclude nginx_autoindex.xsl.in | ${templates_en}
 EOF
 
 for i in articles/*.xml
diff --git a/nginx_autoindex.xsl.in b/nginx_autoindex.xsl.in
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" xmlns:xi="http://www.w3.org/2001/XInclude" version="1.0" xml:space="preserve">
+	<xsl:import href="templates/en/nav.xsl"/>
+	<xsl:output method="xml" encoding="UTF-8" indent="yes" omit-xml-declaration="yes"/>
+	<xsl:template match="/list"><xsl:text disable-output-escaping="yes"><!DOCTYPE html></xsl:text>
+<html xml:lang="en" lang="en">
+	<head>
+		<xi:include href="templates/head.xml" parse="xml" xpointer="xpointer(/xml/*)"/>
+		<title><xsl:value-of select="$document_uri"/> - lanodan's cyber-home</title>
+	</head>
+	<body>
+	<xsl:call-template name="nav"/>
+	<main>
+		<table class="sortable">
+			<thead>
+				<tr><th class="sorttable_sorted">Name</th><th>Size</th><th>Last Modified</th></tr>
+			</thead>
+			<tbody>
+				<xsl:apply-templates select="/list/directory"/>
+				<xsl:apply-templates select="/list/file"/>
+			</tbody>
+		</table>
+	</main>
+	<xi:include href="templates/en/footer.shtml" parse="xml"/>
+	<script src="/javascript/sorttable.js?serial=2023030902"></script>
+	</body>
+</html></xsl:template>
+<!--
+<list>
+<directory mtime="2022-07-11T07:56:48Z">ci</directory>
+<file mtime="2020-11-11T11:55:13Z" size="113550">0001-cmake-remove-as-much-as-possible.patch</file>
+</list>
+-->
+
+	<xsl:template match="/list/directory"><tr>
+			<td><a href="{./text()}"><xsl:value-of select="./text()"/>/</a></td>
+			<td data-value="0" data-type="int">0 B</td>
+			<td><xsl:value-of select="@mtime"/></td>
+		</tr></xsl:template>
+
+	<xsl:template match="/list/file"><tr>
+			<td><a href="{./text()}"><xsl:value-of select="./text()"/></a></td>
+			<td data-type="int" data-value="{@size}"><xsl:value-of select="@size"/> B</td>
+			<td><xsl:value-of select="@mtime"/></td>
+		</tr></xsl:template>
+</xsl:stylesheet>