Module:GasIcon: Difference between revisions
From Stationeers Community Wiki
More actions
Move Gas name parsing to the more robust Module:Gas |
experimental attempt to allow css size arguments |
||
| Line 8: | Line 8: | ||
local size = args.Size or "32px" | local size = args.Size or "32px" | ||
return "[["..gas.Image.."|"..size.."|link="..gas.HumanReadableName.."]]" | return "[["..gas.Image.."|"..size.."|link="..gas.HumanReadableName.."]]" | ||
end | |||
local function CreateStyle(args) | |||
local size = args.Size or "32px" | |||
return [["height: ]]..size.."; width: auto; vertical-align: middle;"..[["]] | |||
end | |||
function p.GetIcon2(frame) | |||
local args = frame:getParent().args | |||
local gas = Gas.GetGas(args[1]) | |||
mw.logObject(args) | |||
return [[<a href="]]..gas.HumanReadableName..[[">]] | |||
..[[<img src="]]..gas.Image..[[" style="]]..CreateStyle(args)..[["/>]] | |||
..[[</a>]] | |||
end | end | ||
return p | return p | ||
Revision as of 04:33, 6 September 2026
Documentation for this module may be created at Module:GasIcon/doc
local GasData = mw.loadData("Module:Gas/data")
local Gas = require("Module:Gas")
local p = {}
function p.GetIcon(frame)
local args = frame:getParent().args
local gas = Gas.GetGas(args[1])
mw.logObject(args)
local size = args.Size or "32px"
return "[["..gas.Image.."|"..size.."|link="..gas.HumanReadableName.."]]"
end
local function CreateStyle(args)
local size = args.Size or "32px"
return [["height: ]]..size.."; width: auto; vertical-align: middle;"..[["]]
end
function p.GetIcon2(frame)
local args = frame:getParent().args
local gas = Gas.GetGas(args[1])
mw.logObject(args)
return [[<a href="]]..gas.HumanReadableName..[[">]]
..[[<img src="]]..gas.Image..[[" style="]]..CreateStyle(args)..[["/>]]
..[[</a>]]
end
return p