diff options
| author | Sergey Lukin <sergej.lukin@gmail.com> | 2015-04-28 09:38:08 +0300 |
|---|---|---|
| committer | Natanael Copa <ncopa@alpinelinux.org> | 2015-05-07 06:56:24 +0200 |
| commit | 77f2e56afbe5aab5c4a5a8190a69e2a71b6702c8 (patch) | |
| tree | 57cb7997cc845219ff18a988f21f1a5531e8c97f /_scripts | |
| parent | 399a142532fda81dab5be46840db36b83ca12484 (diff) | |
| download | alpine-mksite-77f2e56afbe5aab5c4a5a8190a69e2a71b6702c8.tar.bz2 alpine-mksite-77f2e56afbe5aab5c4a5a8190a69e2a71b6702c8.tar.xz | |
atom.xml added
Diffstat (limited to '_scripts')
| -rw-r--r-- | _scripts/generate_atom.lua | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/_scripts/generate_atom.lua b/_scripts/generate_atom.lua new file mode 100644 index 0000000..d434772 --- /dev/null +++ b/_scripts/generate_atom.lua @@ -0,0 +1,23 @@ +#!/usr/bin/lua + +local yaml = require('yaml') +local lustache = require('lustache') + +local function filecontent(filename) + local file=assert(io.open(filename, "r")) + local content = file:read ("*a") + file:close() + return content +end + +template = filecontent(arg[1]) +entries = yaml.load(filecontent(arg[2])) + +for k,v in ipairs(entries) do + -- timestamps in Atom must conform to RFC 3339 + entries[k].updated = v.date.."T00:00:00Z" +end +local data = {updated=os.date('!%Y-%m-%dT%H:%M:%SZ'), entries=entries} + +io.write(lustache:render(template, data)) + |
