Module:MaterialInfobox: Difference between revisions

Content deleted Content added
That last edit worked, so let's rename that helper function and do it for values as well.
Corrected Rare and Very Rare icons
 
(26 intermediate revisions by 3 users not shown)
Line 23:
if not HF.isempty(field.Grade) then
if field.Grade == 'Rare' or field.Grade == 'rare' then
output = '[[File:placeholderRare_material.pngsvg|35px|link=]] ' .. output
elseif field.Grade == 'Very common' or field.Grade == 'Very Common' or field.Grade == 'very common' then
output = '[[File:placeholderVery common material.pngsvg|35px|link=]] ' .. output
elseif field.Grade == 'Very rare' or field.Grade == 'Very Rare' or field.Grade == 'very rare' then
output = '[[File:Very_Rare_material.svg|35px|link=]] ' .. output
elseif field.Grade == 'Common' or field.Grade == 'common' then
output = '[[File:placeholderCommon material.pngsvg|35px|link=]] ' .. output
elseif field.Grade == 'Standard' or field.Grade == 'standard' then
output = '[[File:Standard_material.svg|35px|link=]] ' .. output
else
output = output
Line 35 ⟶ 39:
end
 
function SplitRunFunctionInfobox.TableSplitRows(func_name field, valuevars )
local output = ''
if type( func_name ) == "string" then
if not HF.isempty( func_name field.Value) then
local ships = HF.explode(';', field.Value)
if type( Infobox[func_name] ) == "function" then
table.sort(ships)
return Infobox[func_name]( value )
end
output = '<tr class="eInfobox-infobox-custom custom-listitem"><td colspan="2">' ..
end
table.concat(ships, '</td></tr><tr class="eInfobox-infobox-custom custom-listitem"><td colspan="2">') ..
'</td></tr>'
return valueoutput▼
end
▲ return value
end
 
function Infobox.SplitLabelMethod( field, vars )
return {
SplitRunFunction( field.LabelLeftMethod, field.LabelLeft ),
SplitRunFunction( field.LabelRightMethod, field.LabelRight )
}
end
function Infobox.SplitValueMethod( field, vars )
return {
SplitRunFunction( field.ValueLeftMethod, field.ValueLeft ),
SplitRunFunction( field.ValueRightMethod, field.ValueRight )
}
end
 
return Infobox