Module:Infobox race

From Ways of Darkness
Jump to navigation Jump to search

Documentation for this module may be created at Module:Infobox race/doc

require "Module:Mine Race"
local p = {}
function p.main(frame)
	temp_args = {}
	-- If called via #invoke, use the args passed into the invoking template.
    -- Otherwise, for testing purposes, assume args are being passed directly in.
    if frame == mw.getCurrentFrame() then
        arguments = frame:getParent().args
    else
        arguments = frame
    end
    if arguments['genname'] ~= nil then
	new_args = generate_infobox_markup(arguments['genname'],1)
    elseif arguments['name'] ~= nil then
	new_args = generate_infobox_markup(arguments['name'],1)
	elseif arguments['title'] ~= nil then
	new_args = generate_infobox_markup(arguments['title'],1)
else 
	new_args = generate_infobox_markup("Humans",1)
	end
	for k in pairs(arguments) do
		temp_args[k] = arguments[k]
	end
	for k in pairs(new_args) do
		temp_args[k] = frame:preprocess(new_args[k])
	end
	local s = frame:expandTemplate{ title = 'Infobox race', args = temp_args}
	return s
end


function p.hun(frame)
	temp_args = {}
	-- If called via #invoke, use the args passed into the invoking template.
    -- Otherwise, for testing purposes, assume args are being passed directly in.
    if frame == mw.getCurrentFrame() then
        arguments = frame:getParent().args
    else
        arguments = frame
    end
    if arguments['name_eng'] ~= nil then
	new_args = generate_infobox_markup_hu(arguments['name_eng'],1)
elseif arguments['title_eng'] ~= nil then
	new_args = generate_infobox_markup_hu(arguments['title_eng'],1)
else 
	new_args = generate_infobox_markup_hu("Humans",1)
	end
	for k in pairs(arguments) do
		temp_args[k] = arguments[k]
	end
	for k in pairs(new_args) do
		temp_args[k] = frame:preprocess(new_args[k])
	end
	local s = frame:expandTemplate{ title = 'Infobox race/hu', args = temp_args}
	return s
end
return p