Module:ShipInfobox: Difference between revisions

Content deleted Content added
m Added size 6
Merge from Module:ShipInfobox?new
Line 4:
local lang = mw.language.new('en')
 
-- if a variable is required, this logic hides them if variable is empty
-- This avoids using the {{#if:{{{factionreq|}}}||}} ParserFunction.
function Infobox.FactionreqRequired( field, vars )
-- Rather than ParserFunctions, try passing your variables this way.
local output = mw.html.create('span')▼
local text = 'Requires [['.. field.Requirement ..']] rank of '.. field.Rank ..' or higher'
if not HF.isempty(field.Requirement) then
output = field.Value
-- Use mw.html for the best HTML output.
▲ local output = mw.html.create('span')
:addClass('factionreq'):wikitext(text)
return tostring(output)
end
return output
end
 
function Infobox.Factionreq( field, vars )
local output = ''
if not HF.isempty(field.Value) then
output = '[[' .. field.Value .. ']]'
return output
end
end
 
-- replaces {{#if:{{{topspeed|}}}|{{{topspeed|?}}} m/s|---}} logic