From 84d611c78ac65113ed8cc7838994669de270d4d0 Mon Sep 17 00:00:00 2001 From: Aki Date: Tue, 3 Sep 2024 21:35:27 +0200 Subject: Sketched generate-atom to generate RSS/Atom feeds along with index --- generate-atom.lua | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 generate-atom.lua (limited to 'generate-atom.lua') diff --git a/generate-atom.lua b/generate-atom.lua new file mode 100755 index 0000000..075dbb5 --- /dev/null +++ b/generate-atom.lua @@ -0,0 +1,21 @@ +#!/usr/bin/env lua +local datetime = require"huh.datetime" +local config = require"huh.config".load(arg[1]) +local posts = require"huh.blog".posts(config) +local prefix = "https://ignore.pl/" +local count = 5 +for _, page in pairs(posts) do + if count <= 0 then + break + end + local url = prefix .. page.filename + print"" + print(string.format("%s", page.title)) + print(string.format("%s", url)) + print(string.format([[]], url)) + -- TODO: Unlike shell implementation, updated date here is sourced only from the file and never from git! + print(string.format("%s", page.updated or page.published)) + print(string.format("%s", page.published)) + print"" + count = count - 1 +end -- cgit v1.1