Module:MultiTabs: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
No edit summary |
||
Line 12: | Line 12: | ||
local int = GetTableLng(frame.args) | local int = GetTableLng(frame.args) | ||
local width = 100/int | local width = 100/int | ||
return | 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 |
Revision as of 21:44, 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 int = GetTableLng(frame.args)
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