Module:Sandbox/Xoristzatziki/testparams: Difference between revisions
Appearance
Content deleted Content added
No edit summary |
mNo edit summary |
||
Line 26: | Line 26: | ||
local monthon = mhnas[tonumber(args['Μήνας'])].name |
local monthon = mhnas[tonumber(args['Μήνας'])].name |
||
local monthg = mhnas[tonumber(args['Μήνας'])].gen |
local monthg = mhnas[tonumber(args['Μήνας'])].gen |
||
local firstday = tonumber(args['1day']) |
|||
for xcounter = 1,7 do |
for xcounter = 1,7 do |
||
if |
if firstday > xcounter then |
||
currentdays[xcounter] = '|colspan="1"| ' |
currentdays[xcounter] = '|colspan="1"| ' |
||
else |
else |
||
tmpnum = (xcounter - |
tmpnum = (xcounter - firstday + 1) |
||
currentdays[xcounter] = '| [[' .. tmpnum .. ' ' .. monthg .. '|' .. tmpnum ..']]' |
currentdays[xcounter] = '| [[' .. tmpnum .. ' ' .. monthg .. '|' .. tmpnum ..']]' |
||
end |
end |
||
end |
end |
||
for xcounter = 8,28 do |
for xcounter = 8,28 do |
||
tmpnum = (xcounter - |
tmpnum = (xcounter - firstday + 1) |
||
currentdays[xcounter] = '| [[' .. tmpnum .. ' ' .. monthg .. '|' .. tmpnum ..']]' |
currentdays[xcounter] = '| [[' .. tmpnum .. ' ' .. monthg .. '|' .. tmpnum ..']]' |
||
end |
end |
||
for xcounter = 29,35 do |
for xcounter = 29,35 do |
||
if args['daycount'] + |
if args['daycount'] + firstday > xcounter then |
||
tmpnum = (xcounter - |
tmpnum = (xcounter - firstday + 1) |
||
currentdays[xcounter] = '| [[' .. tmpnum .. ' ' .. monthg .. '|' .. tmpnum ..']]' |
currentdays[xcounter] = '| [[' .. tmpnum .. ' ' .. monthg .. '|' .. tmpnum ..']]' |
||
else |
else |
Revision as of 14:48, 3 April 2013
_calendar ={}
--αρχή μεταβλητής justanenter
justanenter = [=[
]=]
--τέλος μεταβλητής justanenter
mhnas = { {['name'] = 'Ιανουάριος', ['gen'] = 'Ιανουαρίου'},
{['name'] = 'Φεβρουάριος', ['gen'] = 'Φεβρουαρίου'},
{['name'] = 'Μάρτιος', ['gen'] = 'Μαρτίου'},
{['name'] = 'Απρίλιος', ['gen'] = 'Απριλίου'},
{['name'] = 'Μάιος', ['gen'] = 'Μαΐου'},
{['name'] = 'Ιούνιος', ['gen'] = 'Ιουνίου'},
{['name'] = 'Ιούλιος', ['gen'] = 'Ιουλίου'},
{['name'] = 'Αύγουστος', ['gen'] = 'Αυγούστου'},
{['name'] = 'Σεπτέμβριος', ['gen'] = 'Σεπτεμβρίου'},
{['name'] = 'Οκτώβριος', ['gen'] = 'Οκτωβρίου'},
{['name'] = 'Νοέμβριος', ['gen'] = 'Νοεμβρίου'},
{['name'] = 'Δεκέμβριος', ['gen'] = 'Δεκεμβρίου'},
}
fulltableforcal1 = function (args)
local currentdays = {}
local tmpnum = 0
local monthon = mhnas[tonumber(args['Μήνας'])].name
local monthg = mhnas[tonumber(args['Μήνας'])].gen
local firstday = tonumber(args['1day'])
for xcounter = 1,7 do
if firstday > xcounter then
currentdays[xcounter] = '|colspan="1"| '
else
tmpnum = (xcounter - firstday + 1)
currentdays[xcounter] = '| [[' .. tmpnum .. ' ' .. monthg .. '|' .. tmpnum ..']]'
end
end
for xcounter = 8,28 do
tmpnum = (xcounter - firstday + 1)
currentdays[xcounter] = '| [[' .. tmpnum .. ' ' .. monthg .. '|' .. tmpnum ..']]'
end
for xcounter = 29,35 do
if args['daycount'] + firstday > xcounter then
tmpnum = (xcounter - firstday + 1)
currentdays[xcounter] = '| [[' .. tmpnum .. ' ' .. monthg .. '|' .. tmpnum ..']]'
else
currentdays[xcounter] = '|colspan="1"| '
end
end
newtable = [=[{| class="toccolours" style="float:]=] .. args['float'] .. [=[; margin-left: 1em; text-align:center;"
|- style="background:]=] .. args['color'] .. [=[;"
|colspan="7"|'''[[]=] .. monthon .. [=[]]'''
|- style="background:]=] .. args['color2'] .. [=[;"
|width="14%"| Κυρ.
|width="14%"| Δευτ.
|width="14%"| Τρ.
|width="14%"| Τετ.
|width="14%"| Πεμ.
|width="14%"| Παρ.
|width="14%"| Σαβ.
|-]=]
local daytoshow = 0
for xcounter = 1,7 do
for ycounter = 1,5 do
--if ycounter < 2 then
--daytoshow = xcounter
--else
daytoshow = (((ycounter - 1 ) * 7) + xcounter)
--mw.log(type(daytoshow))
newtable = newtable .. justanenter .. currentdays[daytoshow] .. justanenter
end
newtable = newtable .. justanenter .. '|-'
end
newtable = newtable .. [=[
|colspan="7"|
|- style="background:]=] .. args['color2'] .. [=["
|colspan="7"| ]=] .. args['yearlink'] .. justanenter .. [=[
|}]=]
return newtable
end
function _calendar.Cal1(frame)
local args = frame.args
return frame:preprocess(fulltableforcal1(args))
end
function _calendar.test()
local args = {}
args['color2'] = '#ccccff'
-- args['Μήνας'] = 'Ιούλιος'
args['Μήνας'] = 6
-- args['Γεν-Μήνα'] = 'Ιουλίου'
args['color'] = '#ccccff'
args['color2'] = 'ccccff'
args['1day'] = 2
args['float'] = 'float'
args['yearlink'] = '[[2013]]'
args['daycount'] = 30
-- args[1] = 'arg1'
-- args['1a'] = 'arg1a'
-- args[2] = 'arg2'
-- args[3] = 'arg3'
-- args[4] = 'arg4'
return fulltableforcal1(args)
end
return _calendar