Module:Infobox Political post
From Paracosm
More actions
Documentation for this module may be created at Module:Infobox Political post/doc
require( 'strict' )
local infobox = require( 'Module:InfoboxLua' )
local common = require( 'Module:Common' )
local inlineIf = common.inlineIf
local p = {}
function p.main(frame)
local args = require('Module:Arguments').getArgs(frame)
--Overview
local title = mw.title.getCurrentTitle().subpageText
if args.post and args.body then
title = args.post .. ' of ' .. args.body
elseif args.post then
title = args.post
end
local items = {
{ label = 'Style', content = args.style },
{ label = 'Type', content = args.type },
{ label = 'Status', content = args.status },
{ label = 'Abbreviation', content = args.abbreviation },
{ label = 'Member of', content = args.member_of },
{ label = 'Reports to', content = args.reports_to },
{ label = 'Residence', content = args.residence },
{ label = 'Seat', content = args.seat },
{ label = 'Nominator', content = args.nominator },
{ label = 'Appointer', content = args.appointer },
{ label = 'Term length', content = args.termlength },
{ label = 'Constituting instrument', content = args.constituting_instrument },
{ label = 'Precursor', content = args.precursor },
{ label = 'Inaugural holder', content = args.inaugural },
{ label = 'Formation', content = args.formation },
{ label = 'First holder', content = args.first },
{ label = 'Final holder', content = args.last },
{ label = 'Abolished', content = args.abolished },
{ label = 'Superseded by', content = args.superseded_by },
{ label = 'Succession', content = args.succession },
{ label = 'Unofficial names', content = args.unofficial_names },
{ label = 'Deputy', content = args.deputy },
}
if args.incumbent or args.acting then
local incumbentsince = args.incumbentsince and ('<br>Since ' .. args.incumbentsince) or ''
local incumbent = inlineIf(args.acting, args.acting, args.incumbent)
table.insert(items, 1, {
label = inlineIf(args.acting, 'Acting', 'Incumbent'),
content = incumbent .. incumbentsince
})
end
--
return infobox.render({
title = title,
subtitle = args.native_name,
image = args.image,
sections = {
{
items = items
}
}
})
end
return p