Jump to content
Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:Infobox Political post

From Paracosm

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
Last modified