Module:SRVInfobox
Appearance
Documentation for this module may be created at Module:SRVInfobox/doc
local Infobox = {}
local HF = require('Module:HF')
local FormatNum = require('Module:FormatNum')
local lang = mw.language.new('en')
-- replaces {{#if:{{{topspeed|}}}|{{{topspeed|?}}} m/s|---}} logic
function Infobox.Quantify( field, vars )
local unit = field.Unit or ''
local value = field.Value or field.Default or '?'
if HF.isempty(value) then
return '---'
else
return value .. ' ' .. unit
end
end
-- fixes numbers with commas, e.g: 4,323
function Infobox.FormatCost( field, vars )
if HF.isempty(field.Value) then
return '---'
else
field.Value = FormatNum.commavalue(field.Value:gsub(',',''))
return Infobox.Quantify(field, vars)
end
end
return Infobox