diff options
Diffstat (limited to '_scripts/generate_latest.lua')
-rw-r--r-- | _scripts/generate_latest.lua | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/_scripts/generate_latest.lua b/_scripts/generate_latest.lua new file mode 100644 index 0000000..2289ddd --- /dev/null +++ b/_scripts/generate_latest.lua @@ -0,0 +1,14 @@ +#!/uar/bin/lua + +yaml = require('yaml') +data = yaml.load(io.read("*a")) +table.sort(data, function(a,b) + return (a.date or a.updated) > (b.date or b.updated) +end) + +t = {} +for i=1, 10 do + t[i] = data[i] +end +io.write(yaml.dump(t)) + |