Moduł:Portal: Różnice pomiędzy wersjami
Z Nonsensopedii, polskiej encyklopedii humoru
Ostrzyciel (dyskusja • edycje) M |
Ostrzyciel (dyskusja • edycje) M (paddingi) |
||
Linia 29: | Linia 29: | ||
lstack = table.concat(lstack, '\n') |
lstack = table.concat(lstack, '\n') |
||
rstack = table.concat(rstack, '\n') |
rstack = table.concat(rstack, '\n') |
||
local td = '<td width="50%" style="vertical-align: top; |
local td = '<td width="50%" style="vertical-align: top; padding-' |
||
return '<tr>' .. td .. |
return '<tr>' .. td .. 'right: 15px">' .. lstack .. '</td>' .. |
||
td .. 'left: 15px">' .. rstack .. '</td></tr>' |
|||
end |
end |
||
Wersja z 19:11, 23 cze 2020
local tools = require('Moduł:Narzędzia')
local p = {}
local function makePanel(args, stack, num)
text = args['panel' .. num]
if text == '-' or text == '' then return end
title = args['ptytuł' .. num] or ''
table.insert(stack, '<h2>' .. title .. '</h2>\n' .. text)
end
function p.desktop(frame)
local args = tools.getArgs(frame)
local lstack, rstack = {}, {}
local function subpanel(num)
if num % 2 == 1 then
makePanel(args, lstack, num)
else
makePanel(args, rstack, num)
end
end
for i = 1, 50 do
if args['panel' .. i] ~= nil then subpanel(i)
else break end
end
lstack = table.concat(lstack, '\n')
rstack = table.concat(rstack, '\n')
local td = '<td width="50%" style="vertical-align: top; padding-'
return '<tr>' .. td .. 'right: 15px">' .. lstack .. '</td>' ..
td .. 'left: 15px">' .. rstack .. '</td></tr>'
end
function p.mobile(frame)
local args = tools.getArgs(frame)
local stack = {}
for i = 1, 50 do
if args['panel' .. i] ~= nil then makePanel(args, stack, i)
else break end
end
return table.concat(stack, '\n')
end
return p