No edit summary |
No edit summary |
||
| Line 9: | Line 9: | ||
local args = frame:getParent().args | local args = frame:getParent().args | ||
local result = "" | local result = "" | ||
local checked = false | |||
for key, value in pairs(args) do | for key, value in pairs(args) do | ||
result = result .. '<htmltag tagname="input" type="radio" class="dTabsRadio" name="Areas" id="' .. key .. '" checked></htmltag><htmltag tagname="label" for="' .. key .. '" class="dTabsLabel"> | result = result .. '<htmltag tagname="input" type="radio" class="dTabsRadio" name="Areas" id="' .. key .. '"' | ||
if not checked then | |||
result = result .. ' checked' | |||
end | |||
result = result .. '></htmltag><htmltag tagname="label" for="' .. key .. '" class="dTabsLabel">' .. key .. '</htmltag><div class="dTabsContent">' .. value .. '</div>' | |||
checked = true | |||
end | end | ||
return p.pp('<div class="dTabs">' .. result .. '</div>') | return p.pp('<div class="dTabs">' .. result .. '</div>') | ||
Revision as of 11:48, 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 result = ""
local checked = false
for key, value in pairs(args) do
result = result .. '<htmltag tagname="input" type="radio" class="dTabsRadio" name="Areas" id="' .. key .. '"'
if not checked then
result = result .. ' checked'
end
result = result .. '></htmltag><htmltag tagname="label" for="' .. key .. '" class="dTabsLabel">' .. key .. '</htmltag><div class="dTabsContent">' .. value .. '</div>'
checked = true
end
return p.pp('<div class="dTabs">' .. result .. '</div>')
end
return p