Module:MaterialInfobox: Difference between revisions
Appearance
Content deleted Content added
m Do the last edit correctly... |
That didn't work, so let's return dummy values |
||
| Line 36: | Line 36: | ||
function Infobox.SplitLabelMethod( field, vars ) |
function Infobox.SplitLabelMethod( field, vars ) |
||
return { |
return { "TestLabel1", "TestLabel2" } --[[ { |
||
Infobox[ field.LeftLabelMethod ]( field.LeftLabel ), |
Infobox[ field.LeftLabelMethod ]( field.LeftLabel ), |
||
Infobox[ field.RightLabelMethod ]( field.RightLabel ) |
Infobox[ field.RightLabelMethod ]( field.RightLabel ) |
||
} |
} --]] |
||
end |
end |
||
function Infobox.SplitValueMethod( field, vars ) |
function Infobox.SplitValueMethod( field, vars ) |
||
return { |
return { "TestValue1", "TestValue2" } --[[ { |
||
Infobox[ field.LeftValueMethod ]( field.LeftValue ), |
Infobox[ field.LeftValueMethod ]( field.LeftValue ), |
||
Infobox[ field.RightValueMethod ]( field.RightValue ) |
Infobox[ field.RightValueMethod ]( field.RightValue ) |
||
} |
} --]] |
||
end |
end |
||
Revision as of 02:37, 11 December 2015
Documentation for this module may be created at Module:MaterialInfobox/doc
local Infobox = {}
local HF = require('Module:HF')
function Infobox.Newline( field, vars )
local output = ''
if not HF.isempty(field.Value) then
local ships = HF.explode(';', field.Value)
table.sort(ships)
for i, ship in ipairs(ships) do
output = output .. HF.trim(ship) .. '<br />'
end
if string.sub(output, -6) == '<br />' then
output = string.sub( output, 1, -7 )
end
return output
end
end
function Infobox.PreTitleIcon( field, vars )
output = field.Value
if not HF.isempty(field.Grade) then
if field.Grade == 'Rare' or field.Grade == 'rare' then
output = '[[File:placeholder.png|35px|link=]] ' .. output
elseif field.Grade == 'Very common' or field.Grade == 'Very Common' or field.Grade == 'very common' then
output = '[[File:placeholder.png|35px|link=]] ' .. output
elseif field.Grade == 'Common' or field.Grade == 'common' then
output = '[[File:placeholder.png|35px|link=]] ' .. output
else
output = output
end
end
return output
end
function Infobox.SplitLabelMethod( field, vars )
return { "TestLabel1", "TestLabel2" } --[[ {
Infobox[ field.LeftLabelMethod ]( field.LeftLabel ),
Infobox[ field.RightLabelMethod ]( field.RightLabel )
} --]]
end
function Infobox.SplitValueMethod( field, vars )
return { "TestValue1", "TestValue2" } --[[ {
Infobox[ field.LeftValueMethod ]( field.LeftValue ),
Infobox[ field.RightValueMethod ]( field.RightValue )
} --]]
end
return Infobox