diff options
author | Aki <please@ignore.pl> | 2024-09-03 21:35:27 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2024-09-03 21:36:47 +0200 |
commit | 84d611c78ac65113ed8cc7838994669de270d4d0 (patch) | |
tree | 5832af26d8c4bfe0c48773e2dc69f3ecb1da52ef /generate-atom.lua | |
parent | ed586b4fe54c9a3125cd7050f79a1b0d441644be (diff) | |
download | huh-84d611c78ac65113ed8cc7838994669de270d4d0.zip huh-84d611c78ac65113ed8cc7838994669de270d4d0.tar.gz huh-84d611c78ac65113ed8cc7838994669de270d4d0.tar.bz2 |
Diffstat (limited to 'generate-atom.lua')
-rwxr-xr-x | generate-atom.lua | 21 |
1 files changed, 21 insertions, 0 deletions
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"<entry>" + print(string.format("<title>%s</title>", page.title)) + print(string.format("<id>%s</id>", url)) + print(string.format([[<link href="%s"/>]], url)) + -- TODO: Unlike shell implementation, updated date here is sourced only from the file and never from git! + print(string.format("<updated>%s</updated>", page.updated or page.published)) + print(string.format("<published>%s</published>", page.published)) + print"</entry>" + count = count - 1 +end |