Module:InfoboxProto: Difference between revisions
From Elwiki
No edit summary |
No edit summary Tag: Reverted |
||
Line 1: | Line 1: | ||
require('Module:CommonFunctions') | require('Module:CommonFunctions') | ||
require('Module:InfoboxProto'); | |||
local getArgs = require('Module:Arguments').getArgs | local getArgs = require('Module:Arguments').getArgs | ||
local p = {} | local p = {} | ||
-- Main process | -- Main process | ||
function p.main(frame | function p.main(frame) | ||
local args = getArgs(frame); | local args = getArgs(frame); | ||
local infobox = require('Module:InfoboxProto').main(frame, args.class); | |||
infobox:addClass('infobox-character'); | |||
if args. | if (args.name1 == nil and args.name2 == nil) then | ||
addField('name', args.l_name); | |||
end | end | ||
local fields = { | |||
{ | |||
id = 'name', | |||
localize = args.l_name, | |||
dual = true | |||
}, | |||
{ | |||
id = 'class', | |||
localize = args.l_class | |||
}, | |||
{ | |||
id = 'classes', | |||
localize = args.l_classes, | |||
dual = true, | |||
special = true | |||
}, | |||
{ | |||
id = 'weapon', | |||
localize = args.l_weapon, | |||
dual = true | |||
}, | |||
{ | |||
id = 'age', | |||
localize = args.l_age, | |||
dual = true | |||
}, | |||
{ | |||
id = 'race', | |||
localize = args.l_race, | |||
dual = true | |||
}, | |||
{ | |||
id = 'Birth', | |||
localize = args.l_birth, | |||
dual = true | |||
}, | |||
{ | |||
id = 'Height', | |||
localize = args.l_height, | |||
dual = true | |||
}, | |||
{ | |||
id = 'Weight', | |||
localize = args.l_weight, | |||
dual = true | |||
}, | |||
{ | |||
id = 'Blood', | |||
localize = args.l_blood, | |||
dual = true | |||
}, | |||
{ | |||
id = 'ESP', | |||
localize = args.l_esp | |||
}, | |||
{ | |||
id = 'tree', | |||
localize = args.l_tree | |||
}, | |||
{ | |||
id = 'VA', | |||
localize = args.l_va, | |||
dual = true, | |||
collapsed = true | |||
}, | |||
{ | |||
id = 'RD', | |||
localize = args.l_rd, | |||
collapsed = true | |||
}, | |||
{ | |||
id = 'TRD', | |||
localize = args.l_trd, | |||
collapsed = true | |||
}, | |||
{ | |||
id = 'MRD', | |||
localize = args.l_mrd, | |||
collapsed = true | |||
}, | |||
{ | |||
id = 'theme', | |||
localize = args.l_theme, | |||
collapsed = true | |||
}, | |||
{ | |||
id = 'video', | |||
localize = args.l_video | |||
}, | |||
{ | |||
id = 'stat', | |||
localize = args.l_stat | |||
} | |||
} | |||
for k, v in ipairs(fields) do | |||
if v.special then | |||
addField2(v.id, v.localize) | |||
else | |||
addField(v.id, v.localize, v.dual or false, v.collapsed) | |||
end | end | ||
end | end | ||
return infobox; | return tostring(infobox); | ||
end | end | ||
return p | return p |
Revision as of 12:34, 8 September 2023
Documentation for this module may be created at Module:InfoboxProto/doc
require('Module:CommonFunctions')
require('Module:InfoboxProto');
local getArgs = require('Module:Arguments').getArgs
local p = {}
-- Main process
function p.main(frame)
local args = getArgs(frame);
local infobox = require('Module:InfoboxProto').main(frame, args.class);
infobox:addClass('infobox-character');
if (args.name1 == nil and args.name2 == nil) then
addField('name', args.l_name);
end
local fields = {
{
id = 'name',
localize = args.l_name,
dual = true
},
{
id = 'class',
localize = args.l_class
},
{
id = 'classes',
localize = args.l_classes,
dual = true,
special = true
},
{
id = 'weapon',
localize = args.l_weapon,
dual = true
},
{
id = 'age',
localize = args.l_age,
dual = true
},
{
id = 'race',
localize = args.l_race,
dual = true
},
{
id = 'Birth',
localize = args.l_birth,
dual = true
},
{
id = 'Height',
localize = args.l_height,
dual = true
},
{
id = 'Weight',
localize = args.l_weight,
dual = true
},
{
id = 'Blood',
localize = args.l_blood,
dual = true
},
{
id = 'ESP',
localize = args.l_esp
},
{
id = 'tree',
localize = args.l_tree
},
{
id = 'VA',
localize = args.l_va,
dual = true,
collapsed = true
},
{
id = 'RD',
localize = args.l_rd,
collapsed = true
},
{
id = 'TRD',
localize = args.l_trd,
collapsed = true
},
{
id = 'MRD',
localize = args.l_mrd,
collapsed = true
},
{
id = 'theme',
localize = args.l_theme,
collapsed = true
},
{
id = 'video',
localize = args.l_video
},
{
id = 'stat',
localize = args.l_stat
}
}
for k, v in ipairs(fields) do
if v.special then
addField2(v.id, v.localize)
else
addField(v.id, v.localize, v.dual or false, v.collapsed)
end
end
return tostring(infobox);
end
return p