Documentation for this module may be created at Module:TestModule/doc
local p = {}
p.properties = {
battery_drain = {
icon = 'Battery Drain.png',
name = 'Battery Drain',
color = '#dce2a0',
},
battery_gain = {
icon = 'Battery Gain.png',
name = 'Battery Gain',
color = '#dce2a0',
},
}
function p.main(frame)
local res = ''
for pair_raw in mw.text.gsplit(frame.args.stats, ',', true) do
local pair = mw.text.split(pair_raw, '=', true)
local key = pair[1]
local value = pair[2]
local property = p.properties[key]
if not property then
return string.format("Property %s not found.", key)
end
res = string.format('%s<div style="color: #eaecc3; display: flex; align-items: center; max-width: 24em; padding: 0; margin: 0; border: solid; border-color: %s; border-width: 2px;"><span style="margin: 0; padding-left: 8px; padding-right: 8px;">[[File:%s|26px|alt=Icon for the %s property]]</span><span style="width: 14em; border-left: solid; border-color: %s; border-width: 2px; font-size: 24px; padding: 2px 8px 2px 8px; margin: 0;flex: 1 1 auto;">[[%s]]</span><span style="padding-right: 8px; font-size: 24px;flex:0 0 auto;">%s</span></div>',
res, property.color, property.icon, property.name, property.color, property.name, value)
end
return res
end
return p