local getArgs = require('Module:Arguments').getArgs
local p = {}
function p.main(frame)
local args = getArgs(frame)
local content = args[1] or ' '
local defaultStyle = args[2] == 'off' and '-off' or ''
local id = args['id'] or 'styleToggle'
local tag = args['tag'] or 'div'
local class = args['class'] or ''
local css = args['css'] or ''
local toggleClasses, stylePairs = {}, {}
for k, v in pairs(args) do
if k ~= 1 and k ~= 2 and k ~= 'id' and k ~= 'tag' and k ~= 'class' and k ~= 'css' then
table.insert(toggleClasses, 'styleToggle-' .. k)
table.insert(stylePairs, k .. ':' .. v .. ';')
end
end
return '<' .. tag .. ' class="textToggleDisplay" data-id="' .. id .. defaultStyle .. '"></' .. tag .. '>'
.. '<' .. tag .. ' class="' .. table.concat(toggleClasses, ' ') .. ' ' .. class .. '" style="' .. table.concat(stylePairs) .. css .. '">' .. content .. '</' .. tag .. '>'
end
return p