--[[--------------------- This script makes an iso year-week-day calendar Syntax: mkisocal.lua year1 year2 year3 .. yearn > file arg: year1 .. yearn - the year(s) of the calendar to generate file - the name of the file to write the generated text calendar --]]--------------------- require"date" local htm_foot = [[]] local htm_head = [[]] local htm_yearhead = [[]] local htm_yearfoot = [[
YearWeekMonTueWedThuFriSatSun
]] function makecalendar(year, iow) local d = date():setisoyear(year,1,1) iow(htm_yearhead) iow("\n") while d:getisoyear() == year do iow(d:fmt("%G%V
%Y-%j")) repeat iow(d:fmt("%u
%b %d %Y")) until d:adddays(1):getisoweekday() == 1 iow("\n") end iow(htm_yearfoot) end local out = io.write out(htm_head) for k, v in ipairs(arg) do local d = tonumber(v); if d then makecalendar(d, out) end end out(htm_foot)