port from an SSI-based setup to one using GNU M4
[~bandali/bndl.org] / feed.m4
diff --git a/feed.m4 b/feed.m4
new file mode 100644 (file)
index 0000000..712a9b5
--- /dev/null
+++ b/feed.m4
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
+  <title>Amin Bandali's Personal Site</title>
+  <id>tag:bandali.eu.org,2016:notes/</id>
+  <link href="https://bandali.eu.org/atom.xml" rel="self" type="application/atom+xml"/>
+  <link href="https://bandali.eu.org" rel="alternate" type="text/html"/>
+  <updated>syscmd(date -Iseconds -u | tr -d \\n)</updated>
+define(__feed)dnl
+define(`fordown',`ifelse($#,0,``$0'',`ifelse(eval($2>=$3),1,
+  `pushdef(`$1',$2)$4`'popdef(`$1')$0(`$1',decr($2),$3,`$4')')')')
+fordown(`__i',__latest,eval(__latest-10),`
+  syscmd(sed "s/\&/\&amp;/g;s/>/\&gt;/g;s/</\&lt;/g" __i.m4 | m4 -D__feed)')
+</feed>