summaryrefslogtreecommitdiff
path: root/activity.lua
diff options
context:
space:
mode:
Diffstat (limited to 'activity.lua')
-rw-r--r--activity.lua27
1 files changed, 26 insertions, 1 deletions
diff --git a/activity.lua b/activity.lua
index 9a602b5..405dc05 100644
--- a/activity.lua
+++ b/activity.lua
@@ -3,7 +3,32 @@ local git = require "activity.git"
local activity = {}
-function activity.generate_table (year, lookup, format)
+local
+function generate_rolling (lookup, format, date)
+ date = date or os.date"*t"
+ local rows = ""
+ local weekdays = {"", "Mon", "", "Wed", "", "Fri", ""}
+
+ for index, weekday in pairs(weekdays) do
+ rows = rows .. format.label(weekday)
+ for week=0,51 do
+ rows = rows .. format.cell(0)
+ end
+ if date.wday >= index then
+ rows = rows .. format.cell(0)
+ else
+ rows = rows .. format.spot()
+ end
+ rows = rows .. "\n"
+ end
+ return format.start_document"Activity" .. format.start_table() .. rows .. format.end_table() .. format.end_document()
+end
+
+
+function activity.generate_table (year, lookup, format, ...)
+ if year == "rolling" then
+ return generate_rolling(lookup, format, ...)
+ end
year = year or dates.this_year()
local function day_of_year (first_weekday, week, weekday)