词条 | Module:Sandbox/Tokoko/Calendar |
释义 | require('Module:No globals') local p = {} local root = {} local function addRow(row) table.insert(root, row) end local function getMonthNameInGeorgian(month) return ({"იანვარი","თებერვალი","მარტი","აპრილი","მაისი","ივნისი","ივლისი","აგვისტო","სექტემბერი","ოქტომბერი","ნოემბერი","დეკემბერი"})[month] end local function isLeapYear(year) end local function getDaysInMonth(month, year) return month == 2 and isLeapYear(year) and 29 or ("\\31\\28\\31\\30\\31\\30\\31\\31\\30\\31\\30\\31"):byte(month) end function p.main(frame) local year = tonumber(frame.args.year) local month = tonumber(frame.args.month) local headerColor = (frame.args.headerColor and frame.args.headerColor ~= "") and frame.args.headerColor or "#C0C0C0" local color = (frame.args.color and frame.args.color ~= "") and frame.args.color or "#DCDCDC" local firstWeekday = tonumber(os.date("%w",os.time{year=year, month=month, day=1})) local monthName = getMonthNameInGeorgian(month) local prevMonthName = getMonthNameInGeorgian((month - 2) % 12 + 1) local nextMonthName = getMonthNameInGeorgian(month % 12 + 1) local daysInMonth = getDaysInMonth(month, year)
addRow("{| class=\\"toccolours\\" style=\\"text-align:center;\\" cellpadding=2 cellspacing=0\") addRow("|- class=\\"navbox-title\\"\") addRow("|align=center| <<\") addRow("|colspan=\\"5\\"|" .. monthName .. "\") addRow("|align=center| >>\") --addRow("{{DOWs|start=Sunday|class=navbox-title|style=border: none; {{{weekstyle|}}}}}\")
addRow("|- class=\\"navbox-title\\"\") addRow("|width=\\"14%\\"|ორშ\") addRow("|width=\\"14%\\"|სამ\") addRow("|width=\\"14%\\"|ოთხ\") addRow("|width=\\"14%\\"|ხუთ\") addRow("|width=\\"14%\\"|პარ\") addRow("|width=\\"14%\\"|შაბ\") addRow("|width=\\"14%\\"|კვი\") addRow("|-\") for i = 1, (firstWeekday - 1) % 7 do addRow("|\") end for i = 1, daysInMonth do addRow("|" .. i .. "\") addRow(((i + firstWeekday - 1) % 7 == 0 and "|-\" or "")) end --addRow("|- style=\\"background:" .. color .. ";\\"\") --addRow("|colspan=\\"7\\"|" .. year .. "\") --addRow("|}") return table.concat(root) end return p |
随便看 |
|
开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。