mNo edit summary |
mNo edit summary |
||
| Line 16: | Line 16: | ||
tabCount = math.floor(tabCount / 2) | tabCount = math.floor(tabCount / 2) | ||
for i = | for i = 1, tabCount do | ||
result = result .. '<htmltag tagname="input" type="radio" class="dTabsRadio" name="Areas" id="' .. args['name' .. i] .. '"' | result = result .. '<htmltag tagname="input" type="radio" class="dTabsRadio" name="Areas" id="' .. args['name' .. i] .. '"' | ||
if not checked then | if not checked then | ||
Revision as of 12:43, 18 September 2024
Documentation for this module may be created at Module:Tabs/doc
inspect = require("Module:InspectLua")
local p = {}
function p.pp(text)
return mw.getCurrentFrame():preprocess(text)
end
function p.tabs (frame)
local args = frame:getParent().args
local tabCount = 0
local result = ""
local checked = false
for _ in pairs(args) do tabCount = tabCount + 1 end
tabCount = math.floor(tabCount / 2)
for i = 1, tabCount do
result = result .. '<htmltag tagname="input" type="radio" class="dTabsRadio" name="Areas" id="' .. args['name' .. i] .. '"'
if not checked then
result = result .. ' checked'
end
result = result .. '></htmltag><htmltag tagname="label" for="' .. args['name' .. i] .. '" class="dTabsLabel">' .. args['name' .. i] .. '</htmltag><div class="dTabsContent">' .. args['tab' .. i] .. '</div>'
checked = true
end
return p.pp('<div class="dTabs">' .. result .. '</div>')
end
return p