From 77f2e56afbe5aab5c4a5a8190a69e2a71b6702c8 Mon Sep 17 00:00:00 2001 From: Sergey Lukin Date: Tue, 28 Apr 2015 09:38:08 +0300 Subject: atom.xml added --- _scripts/generate_atom.lua | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 _scripts/generate_atom.lua (limited to '_scripts') 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)) + -- cgit v1.2.3