Module:GasIcon: Difference between revisions
From Stationeers Community Wiki
More actions
mNo edit summary |
replace old template invoke function |
||
| Line 2: | Line 2: | ||
local Gas = require("Module:Gas") | local Gas = require("Module:Gas") | ||
local p = {} | local p = {} | ||
local function CreateStyle(args) | local function CreateStyle(args) | ||
| Line 21: | Line 13: | ||
end | end | ||
function p. | function p.GetIcon(frame) | ||
local args = frame:getParent().args | local args = frame:getParent().args | ||
local gas = Gas.GetGas(args[1]) | local gas = Gas.GetGas(args[1]) | ||
| Line 31: | Line 23: | ||
return html | return html | ||
end | end | ||
p.GetIcon2 = p.GetIcon --still kept for sandbox template | |||
return p | return p | ||
Latest revision as of 06:51, 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 = {}
local function CreateStyle(args)
local css={}
css.display = "inline-block"
css.height = args.Size or "32px"
css.width = css.height
css["vertical-align"] = "baseline"
return css
end
function p.GetIcon(frame)
local args = frame:getParent().args
local gas = Gas.GetGas(args[1])
mw.logObject(args)
local html = mw.html.create("span")
:css(CreateStyle(args))
:wikitext("[["..gas.Image.."|link="..gas.HumanReadableName.."]]")
:done()
return html
end
p.GetIcon2 = p.GetIcon --still kept for sandbox template
return p