Module:Infobox: Difference between revisions
From Guinea Isles Wiki
No edit summary |
No edit summary |
||
| Line 8: | Line 8: | ||
-- Helper functions | -- Helper functions | ||
function boolToYesNo(val) | function boolToYesNo(val) | ||
local accepted_yes = {1, "True", "true", "yes", "Yes"} | local accepted_yes = {1, "1", "True", "true", "yes", "Yes"} | ||
for _, v in pairs(accepted_yes) do | for _, v in pairs(accepted_yes) do | ||
if val == v then | if val == v then | ||
Revision as of 08:15, 19 September 2025
Documentation for this module may be created at Module:Infobox/doc
--------------------------
-- Module for generic Infobox parent
------------------------
local capiunto = require 'capiunto'
local p = {}
-- Helper functions
function boolToYesNo(val)
local accepted_yes = {1, "1", "True", "true", "yes", "Yes"}
for _, v in pairs(accepted_yes) do
if val == v then
return "Yes"
end
end
return "No"
end
-- Infobox class
function p.main(frame)
local args = frame:getParent().args
local headerStyle
if args.headerstyle and args.headerstyle ~= '' then
headerStyle = string.format('background-color:%s;', args.headerstyle)
else
headerStyle = 'background-color:grey;'
end
local retval = capiunto.create( {
title = args.title,
headerStyle = headerStyle,
} )
return retval
end
return p