Module:MultiTabs: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
mNo edit summary |
||
(4 intermediate revisions by the same user not shown) | |||
Line 10: | Line 10: | ||
function p.create( frame ) | function p.create( frame ) | ||
local int = GetTableLng(frame.args | local myTable = frame.args | ||
return | for i = #myTable, 1, -1 do | ||
if myTable[i] == "" then | |||
table.remove(myTable, i) | |||
elseif myTable[i] == nil then | |||
table.remove(myTable, i) | |||
end | |||
end | |||
local int = GetTableLng(myTable) | |||
local width = 100/int | |||
local toReturn = '<div style="display:flex;border-bottom: 1px solid black;text-align:center;vertical-align: middle;line-height: 50px;font-size: 20px;">' | |||
for i = 1,int,1 | |||
do | |||
toReturn = toReturn..'\n<div style="border: 1px solid black;width:'..width..'%;max-width:300px;height:50px;margin:4px;">'..frame.args[i].."</div>" | |||
end | |||
toReturn = toReturn.."</div>" | |||
return frame:preprocess(toReturn) | |||
end | end | ||
return p | return p |
Latest revision as of 21:54, 23 October 2023
Read Template:MultiTabs
local p = {} --p stands for package
function GetTableLng(tbl)
local getN = 0
for n in pairs(tbl) do
getN = getN + 1
end
return getN
end
function p.create( frame )
local myTable = frame.args
for i = #myTable, 1, -1 do
if myTable[i] == "" then
table.remove(myTable, i)
elseif myTable[i] == nil then
table.remove(myTable, i)
end
end
local int = GetTableLng(myTable)
local width = 100/int
local toReturn = '<div style="display:flex;border-bottom: 1px solid black;text-align:center;vertical-align: middle;line-height: 50px;font-size: 20px;">'
for i = 1,int,1
do
toReturn = toReturn..'\n<div style="border: 1px solid black;width:'..width..'%;max-width:300px;height:50px;margin:4px;">'..frame.args[i].."</div>"
end
toReturn = toReturn.."</div>"
return frame:preprocess(toReturn)
end
return p