--[[  (eepitch-lua51)  (eepitch-kill)  (eepitch-lua51) --]] -- mes = "aug" -- MES = "AGOSTO" -- year = 2009 -- w1, w2 = 2, 4 -- segunda, quarta -- aulas = 0 months = [[ January JANEIRO jan February FEVEREIRO fev March MARÇO mar April ABRIL apr May MAIO mai June JUNHO jun July JULHO jul August AGOSTO aug September SETEMBRO sep October OUTUBRO out November NOVEMBRO nov December DEZEMBRO dez ]] to_MES = {} to_mes = {} for _,sss in ipairs(splitlines(months)) do local Month_, MES_, mes_ = unpack(split(sss)) to_MES[Month_] = MES_ to_mes[Month_] = mes_ end m = function (str) Month = split(str)[1] year = split(str)[2] MES = to_MES[Month] mes = to_mes[Month] month = {[0] = MES} end putday = function (day) day = tonumber(day) if not day then return end local fday = format("%0d", day) aulas = aulas + 1 local str = format("AULA %d %04d-%s-%02d", aulas, year, mes, day) tinsert(month, str) -- print(str) end w = function (str) days = split(str) putday(days[w1]) putday(days[w2]) end months_2009_2 = function () months = {} month = {} e = function () tinsert(months, month); month = {} end -- m " August 2009 " -- Su Mo Tu We Th Fr Sa --" . . . . . . 1" --" 2 3 4 5 6 7 8" --" 9 10 11 12 13 14 15" --"16 17 18 19 20 21 22" w "23 24 25 26 27 28 29" w "30 31" e "" m " September 2009 " -- Su Mo Tu We Th Fr Sa w " . . 1 2 3 4 5" w " 6 7 8 9 10 11 12" w "13 14 15 16 17 18 19" w "20 21 22 23 24 25 26" w "27 28 29 30" e "" m " October 2009 " -- Su Mo Tu We Th Fr Sa w " . . . . 1 2 3" w " 4 5 6 7 8 9 10" w "11 12 13 14 15 16 17" w "18 19 20 21 22 23 24" w "25 26 27 28 29 30 31" e "" m " November 2009 " -- Su Mo Tu We Th Fr Sa w " 1 2 3 4 5 6 7" w " 8 9 10 11 12 13 14" w "15 16 17 18 19 20 21" w "22 23 24 25 26 27 28" w "29 30" e "" m " December 2009 " -- Su Mo Tu We Th Fr Sa w " 1 2 3 4 5" w " 6 7 8 9 10 11 12" w "13 14 15 16 17 18 19" --"20 21 22 23 24 25 26" --"27 28 29 30 31" e "" end formataula = function (str) return format(" [%s\n ]\n", str) end formatmonth = function (month) return format("[MES %s\n%s]\n", month[0], table.concat(map(formataula, month), "")) end formatmonths = function (months) return table.concat(map(formatmonth, months), "\n[br]\n\n") end domonths = function (w1_, w2_) aulas = 0 w1, w2 = w1_, w2_ months_2009_2() print(formatmonths(months)) end print("[# segundas e quartas: #]") domonths(2, 4) -- segunda, quarta print("[# terças e quartas: #]") domonths(3, 4) -- terça, quarta --[[ = months = splitlines = splitlines(months) = split w1, w2 = 2, 4 -- segunda, quarta months_2009_2() PP(months) = formatmonth(months[1]) = formatmonths(months) --]] -- (find-sh "lua51 ~/LUA/puro-calendario.lua") -- http://luaforge.net/projects/luasdl/ -- Local Variables: -- coding: raw-text-unix -- ee-anchor-format: "«%s»" -- End: