logo

blog

My website can't be that messy, right? git clone https://hacktivis.me/git/blog.git

nginx_autoindex.xsl.in (2335B)


  1. <?xml version="1.0" encoding="utf-8"?>
  2. <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" xmlns:str="http://exslt.org/strings" exclude-result-prefixes="str">
  3. <!--
  4. # Do not put $uri/
  5. try_files $uri $uri/index.html @autoindex;
  6. location @autoindex {
  7. autoindex on;
  8. autoindex_format xml;
  9. xslt_string_param document_uri "$document_uri";
  10. xslt_stylesheet /srv/web/hacktivis.me/nginx_autoindex.xsl;
  11. }
  12. -->
  13. <xsl:import href="templates/en/nav.xsl"/>
  14. <xsl:output method="xml" encoding="UTF-8" indent="yes" omit-xml-declaration="yes"/>
  15. <xsl:template match="/list"><xsl:text disable-output-escaping="yes">&lt;!DOCTYPE html&gt;</xsl:text>
  16. <html xml:lang="en" lang="en">
  17. <head>
  18. <xi:include href="templates/head.xml" parse="xml" xpointer="xpointer(/xml/*)"/>
  19. <link rel="stylesheet" href="/css/sorttable.css?serial=2020091801"/>
  20. <title><xsl:value-of select="$document_uri"/> - lanodan's cyber-home</title>
  21. </head>
  22. <body>
  23. <xsl:call-template name="nav"/>
  24. <main>
  25. <table class="sortable">
  26. <thead>
  27. <tr><th class="sorttable_sorted">Name</th><th>Size</th><th>Last Modified</th></tr>
  28. </thead>
  29. <tbody>
  30. <xsl:apply-templates select="/list/directory"/>
  31. <xsl:apply-templates select="/list/file"/>
  32. </tbody>
  33. </table>
  34. </main>
  35. <xi:include href="templates/en/footer.shtml" parse="xml"/>
  36. <script src="/javascript/sorttable.js?serial=2023030902"></script>
  37. </body>
  38. </html></xsl:template>
  39. <!--
  40. <list>
  41. <directory mtime="2022-07-11T07:56:48Z">ci</directory>
  42. <file mtime="2020-11-11T11:55:13Z" size="113550">0001-cmake-remove-as-much-as-possible.patch</file>
  43. </list>
  44. -->
  45. <xsl:template match="/list/directory"><tr>
  46. <td><a href="./{str:encode-uri(./text(), true(), 'UTF-8')}/"><xsl:value-of select="./text()"/>/</a></td>
  47. <td data-value="0" data-type="int">0 B</td>
  48. <td><xsl:value-of select="@mtime"/></td>
  49. </tr></xsl:template>
  50. <xsl:template match="/list/file"><tr>
  51. <td><a href="./{str:encode-uri(./text(), true(), 'UTF-8')}"><xsl:value-of select="./text()"/></a></td>
  52. <td data-type="int" data-value="{@size}"><xsl:number value="@size" grouping-separator=" " grouping-size="3"/> B</td>
  53. <td><xsl:value-of select="@mtime"/></td>
  54. </tr></xsl:template>
  55. </xsl:stylesheet>