Awesome: make calendar prettier

This commit is contained in:
2013-10-27 01:17:22 +03:00
parent 6519255e4b
commit 56890b8407
2 changed files with 5 additions and 5 deletions

View File

@@ -15,7 +15,7 @@ function for_month(month, year, formats)
local month_last_day = os.date("*t", os.time{year = year, month = month + 1, day = 0})
for day = 1 - (prev_month_last_day.wday % 7), month_last_day.day do
if (day + prev_month_last_day.wday - 1) % 7 == 0 then
text = text .. "\n " .. string.format("%.2d", week)
text = text .. "\n " .. string.format("%.2d", week) .. " "
week = week + 1
end
local day_format, day_number
@@ -32,10 +32,10 @@ function for_month(month, year, formats)
day_number = day
end
text = text .. " " .. string.format(formats[day_format] or "%s", string.format("%2d", day_number))
text = text .. string.format(formats[day_format] or "%s", string.format(" %2d ", day_number))
end
return string.format("%.2d.%d", month_last_day.month, month_last_day.year) .. "\n" .. text
return string.format("%13s%.2d.%d", "", month_last_day.month, month_last_day.year) .. "\n\n" .. text
end
return { for_month = for_month }

View File

@@ -7,10 +7,10 @@ local vicious = require('vicious')
-- {{{ OK: Date and time
function calendar_for_month_markup(month, year)
local formats = {
today = '<span color="yellow">%s</span>',
today = '<span color="black" background="yellow">%s</span>',
prev_month = '<span color="#aaa">%s</span>'
}
return '<span font_desc="fixed">' .. calendar.for_month(month, year, formats) .. '</span>'
return '<span font_desc="monospace">' .. calendar.for_month(month, year, formats) .. '</span>'
end
function create(self, format)