commit: 4534608f787924afeef3be5ea9da75fbe715af10
parent b30dcd229faf808d21fc85ffe0a7c226ced1028a
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Sun, 17 Mar 2024 14:41:40 +0100
bookmarks.atom.xsl: new
Diffstat:
3 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -9,3 +9,4 @@ datalove
 /notes/index.xhtml
 /feed.atom
 *.br
+/bookmarks.atom
diff --git a/bookmarks.atom.xsl b/bookmarks.atom.xsl
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/2005/Atom" version="1.0" xml:space="preserve">
+	<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
+	<xsl:template match="/xbel"><xsl:text disable-output-escaping="yes"><![CDATA[<?xml-stylesheet type="text/xsl" href="atom.xsl"?>]]></xsl:text>
+<feed xmlns="http://www.w3.org/2005/Atom">
+	<title>Bookmarks feed — Cyber-Home of Lanodan</title>
+	<id>https://hacktivis.me/bookmarks.atom</id>
+	<link href="https://hacktivis.me/bookmarks.atom" rel="self" />
+	<link href="https://hacktivis.me/bookmarks" rel="alternate" />
+	<author>
+		<name>Haelwenn (lanodan) Monnier</name>
+	</author>
+
+	<!-- Technically XBEL doesn't have modified for the <xbel> element but whatever-->
+	<updated><xsl:value-of select="/xbel/@modified"/></updated>
+
+<xsl:apply-templates select="/xbel/bookmark"/>
+</feed></xsl:template>
+
+<xsl:template match="bookmark">	<entry>
+		<title><xsl:value-of select="title"/></title>
+		<link rel="alternate" type="text/html" href="{@href}"/>
+		<xsl:if test="@added"><published><xsl:value-of select="@added"/></published></xsl:if>
+		<xsl:if test="@modified"><updated><xsl:value-of select="@modified"/></updated></xsl:if>
+		<xsl:if test="desc"><content type="text"><xsl:value-of select="desc"/></content></xsl:if>
+	</entry>
+</xsl:template>
+</xsl:stylesheet>
diff --git a/build.ninja b/build.ninja
@@ -23,6 +23,8 @@ include config.ninja
 
 build bookmarks.html: xslt bookmarks.xsl bookmarks.xbel
 build bookmarks.html.br: brotli bookmarks.html
+build bookmarks.atom: xslt bookmarks.atom.xsl bookmarks.xbel
+build bookmarks.atom.br: brotli bookmarks.atom
 
 build feed.atom: xinclude feed.atom.in
 build atom.xsl: xinclude atom.xsl.in