Módulo:Ficha de selecciones deportivas

Esta es una versión antigua de esta página, editada a las 19:32 13 sep 2021 por Leoncastro (discusión · contribs.). La dirección URL es un enlace permanente a esta versión, que puede ser diferente de la versión actual.
Este módulo no tiene página de documentación[crear]
local p = {}
local ModuloFicha    = require('Módulo:Ficha')
local ModuloWikidata = require('Módulo:Wikidata')
local ModuloFormato  = require('Módulo:Formato texto')
local ModuloPaginas  = require('Módulo:Páginas')
local ModuloArgs     = require('Módulo:Argumentos')
local argumento      = ModuloArgs.obtenerValorDeArgumentos

local estilotit = 'background-color:"FFFFFF"'
local estilosecc = 'background-color:"FFFFFF"'

local function safeText(text)
	return text or ''
end

local function helperBandera(pais, param, frame)
	if (pais == nil or pais == '') then
		pais = argumento{'país','Nombre'} or ''
	end
	if (pais ~= nil) and (pais ~= '') then
		if (param ~= nil) and (param ~= '') then
			return frame:preprocess('{{Bandera2|'..pais..'|'..param..'}}')
		else
			return frame:preprocess('{{Bandera2|'..pais..'}}')
		end
	else
		return ''
	end
end

function obtenerPRI(frame)
	if frame:getParent():getTitle():find('Plantilla:Ficha de selección de polo') or 
		frame:getParent():getTitle('Plantilla:Ficha de equipo de tenis') then
		return nil
	end
	if argumento{'Peor resultado'} ~= nil then
		return argumento{'Peor resultado'}
	end
	local contador = 1
	local cadenaret = ''
	if	argumento{'PRI'} == nil and
		(	argumento{'PRI país1'} == nil or
			argumento{'PRI país1'} == ''	) and
		(	argumento{'PRI país2'} == nil or
			argumento{'PRI país2'} == ''	) then
		return 'Aún no disputado'
	end
	local continuar = true
	local evento = ''
	while (continuar == true) do
		i = contador
		if i == 1 then
			i = ''
		end
		if	(argumento{'PRI'..(contador + 1)} == nil) and
			(argumento{'PRI'..(contador + 1).. ' país1'} == nil) and
			(argumento{'PRI'..(contador + 1).. ' país2'} == nil) then
			continuar = false
		end
		if argumento{'PRI'..i} ~= nil then
			continuar = false
			return '[[' .. safeText(argumento{'país','Nombre'}) .. ']]' ..
				' ' .. safeText(argumento{'PRI'..i..' Marcador'}) ..
				' ' .. safeText(argumento{'PRI'..i}) ..
				'<br>' .. safeText(argumento{'PRI'..i..' Lugar'}) ..
				' — ' .. safeText(argumento{'PRI'..i..' Fecha'})
		end
		cadenaret = cadenaret ..
			( cadenaret == '' and '' or '<br>' ) ..
			helperBandera( argumento{'PRI'..i..' país1'}, argumento{'PRI'..i..' bandera1'}, frame ) .. ' ' ..
			"'''" .. safeText( argumento{'PRI'..i..' marcador'} ) .. "'''" ..
			' ' .. helperBandera( argumento{'PRI'..i..' país2'}, argumento{'PRI'..i..' bandera2'}, frame ) .. ' ' ..
			'<br><small>' .. safeText( argumento{'PRI'..i..' lugar'} ) ..
			' — ' .. safeText( argumento{'PRI'..i..' fecha'} ) .. '</small>' ..
			'<br><small>' .. safeText(argumento{'PRI'..i..' evento'}) .. '</small>'
		contador = contador + 1
	end
	return cadenaret
end

function obtenerMRI(frame)
	if frame:getParent():getTitle():find('Plantilla:Ficha de selección de polo') then
		return nil
	end
	if frame:getParent():getTitle():find('Plantilla:Ficha de selección de polo') or 
		frame:getParent():getTitle('Plantilla:Ficha de equipo de tenis') then
		return nil
	end
	if argumento{'Mejor resultado'} ~= nil then
		return argumento{'Mejor resultado'}
	end
	if	argumento{'MRI'} == nil and
		(	argumento{'MRI país1'} == nil or
			argumento{'MRI país1'} == ''	) and
		(	argumento{'MRI país2'} == nil or
			argumento{'MRI país2'} == ''	) then
		return 'Aún no conseguido'
	end
	if argumento{'MRI'} ~= nil then
		return '[[' .. safeText( argumento{'país','Nombre'} ) .. ']]' ..
			' ' .. safeText( argumento{'MRI Marcador'} ) ..
			' ' .. safeText( argumento{'MRI'} ) ..
			'<br>' .. safeText( argumento{'MRI Lugar'} ) ..
			' — ' .. safeText( argumento{'MRI Fecha'} )
	end
	return helperBandera( argumento{'MRI país1'}, argumento{'MRI bandera1'}, frame ) .. ' ' ..
		"'''" .. safeText( argumento{'MRI marcador'} ) .. "'''" ..
		' ' .. helperBandera( argumento{'MRI país2'}, argumento{'MRI bandera2'}, frame ) .. ' ' ..
		'<br><small>' .. safeText( argumento{'MRI lugar'} ) ..
		' — ' .. safeText( argumento{'MRI fecha'} ) .. '</small>' ..
		'<br><small>' .. safeText( argumento{'MRI evento'} ) .. '</small>'
end

function obtenerMV(frame)
	if argumento{'MV'} == nil or argumento{'MV'} == '' then
		return nil
	end
	local mvaux = '[[Selección de baloncesto de '..argumento{'MV'}..'|'..argumento{'MV'}..']]'
	if argumento{'femenino'} == 'si' then
		mvaux = '[[Selección femenina de baloncesto de '..argumento{'MV'}..'|'..argumento{'MV'}..']]'
	end
	return safeText(argumento{'Nombre'}).." '''"..safeText(argumento{'MV Marcador'}).."''' "..mvaux..
		'<br>'..argumento{'MV Lugar'}..'<br>'..argumento{'MV Fecha'}
end

function obtenerPD(frame)
	if argumento{'PD'} == nil or argumento{'PD'} == '' then
		return nil
	end
	local mvaux = '[[Selección de baloncesto de '..argumento{'PD'}..'|'..argumento{'PD'}..']]'
	if argumento{'femenino'} == 'si' then
		mvaux = '[[Selección femenina de baloncesto de '..argumento{'PD'}..'|'..argumento{'PD'}..']]'
	end
	return safeText(argumento{'Nombre'}).." '''"..safeText(argumento{'PD Marcador'}).."''' "..mvaux..
		'<br>'..argumento{'PD Lugar'}..'<br>'..argumento{'PD Fecha'}
end

function obtenerUPI(frame)
	if frame:getParent():getTitle():find('Plantilla:Ficha de selección de polo') or 
	 frame:getParent():getTitle('Plantilla:Ficha de equipo de tenis') then
		return nil
		end
	if argumento{'UPI'} == nil and
		(	argumento{'UPI país1'} == nil or
			argumento{'UPI país1'} == ''	) and
		(	argumento{'UPI país2'} == nil or
			argumento{'UPI país2'} == ''	) then
		return 'Aún no disputado'
	end
	if argumento{'UPI'} ~= nil then
		return '[[' .. safeText( argumento{'país','Nombre'} ) .. ']]' .. 
			' ' .. safeText( argumento{'UPI Marcador'} ) ..
			' ' .. safeText( argumento{'UPI'} ) ..
			'<br>' .. safeText( argumento{'UPI Lugar'} ) ..
			' — ' .. safeText( argumento{'UPI Fecha'} )
	end
	return helperBandera( argumento{'UPI país1'}, argumento{'UPI bandera1'}, frame ) .. ' ' ..
		"'''" .. safeText( argumento{'UPI marcador'} ) .. "'''" ..
		' ' .. helperBandera( argumento{'UPI país2'}, argumento{'UPI bandera2'}, frame ) .. ' ' ..
		'<br><small>' .. safeText( argumento{'UPI lugar'} ) ..
		' — ' .. safeText( argumento{'UPI fecha'} ) .. '</small>' ..
		'<br><small>' .. safeText( argumento{'UPI evento'} ) .. '</small>'
end

function obtenerPPI(frame)
	if frame:getParent():getTitle():find('Plantilla:Ficha de selección de polo') or 
		frame:getParent():getTitle('Plantilla:Ficha de equipo de tenis') then
		return nil
	end
	if frame:getParent():getTitle():find('Plantilla:Ficha de selección de baloncesto') then
		seleccion1 = '[[Selección de baloncesto de '..safeText(argumento{'PPI'})..'|'..safeText(argumento{'PPI'})..']]'
		return safeText(argumento{'Nombre'}).." '''"..safeText(argumento{'PPI Marcador'}).."''' "..seleccion1..
			'<br>'..safeText(argumento{'MV Lugar'})..'<br>'..safeText(argumento{'MV Fecha'})
	end
	if argumento{'PPI'} == nil and
		(	argumento{'PPI país1'} == nil or
			argumento{'PPI país1'} == ''	) and
		(	argumento{'PPI país2'} == nil or
			argumento{'PPI país2'} == ''	) then
		return 'Aún no disputado'
	end
	if argumento{'PPI'} ~= nil then
		return '[[' .. safeText( argumento{'país','Nombre'} ) .. ']]' ..
			' ' .. safeText( argumento{'PPI Marcador'} ) ..
			' ' .. safeText( argumento{'PPI'} ) ..
			'<br>' .. safeText( argumento{'PPI Lugar'} ) ..
			' — ' .. safeText( argumento{'PPI Fecha'} )
	end
	return helperBandera( argumento{'PPI país1'}, argumento{'PPI bandera1'}, frame ) ..
		' ' .. "'''" .. safeText( argumento{'PPI marcador'} ) .. "'''" ..
		' ' .. helperBandera( argumento{'PPI país2'}, argumento{'PPI bandera2'}, frame ) .. ' ' ..
		'<br><small>' .. safeText( argumento{'PPI lugar'} ) ..
		' — ' .. safeText( argumento{'PPI fecha'} ) .. '</small>' ..
		'<br><small>' .. safeText( argumento{{'PPI evento'}} ) .. '</small>'
end


local function helperParticipaciones(first, second)
	if first == nil or first == '' then
		return nil
	else
		return safeText(first) ..
			' <small>(por primera vez en ' .. safeText(second) .. ')</small>'
	end
end

function obtenerparticipaciones(arg, frame)
	if arg == 'participación mundial' then
		return helperParticipaciones( argumento{'participación mundial','Participaciones','Participaciones Copa Mundial','Participación Campeonato Mundial'}, argumento{'primer mundial','Primer Mundial'} )
	elseif arg == 'liga mundial' then
		return helperParticipaciones( argumento{'Participación Liga Mundial'}, argumento{'Primera liga'} )
	elseif arg == 'participación regional' then
		return helperParticipaciones( argumento{'participación regional','Participaciones regional'}, argumento{'primer regional','Primer regional'} )
	elseif arg == 'participación regional2' then
		return helperParticipaciones( argumento{'participación regional2'}, argumento{'primer regional2'} )
	elseif arg == 'participación regional3' then
		return helperParticipaciones( argumento{'participación regional3'}, argumento{'primer regional3'} )
	elseif arg == 'participación confederaciones' then
		return helperParticipaciones( argumento{'participación confederaciones'}, argumento{'primer confederaciones'} )
	elseif arg == 'participación olímpico' or arg == 'torneo olímpico' then
		return helperParticipaciones( argumento{'participación olímpico','Participación olímpica','participación olímpica'}, argumento{'primer olímpico','Primer Olímpico'} )
	end
end

function obtenercamisetafutbol(frame)
	local color_cuerpo1 = argumento{'color_cuerpo1'} or 'FFFFFF'
	local color_izq1 = argumento{'color_izq1','izquierdo1'} or 'FFFFFF'
	local color_der1 = argumento{'color_der1','derecho1'} or ''
	local color_pantalon1 = argumento{'color_pantalón1','shorts1'} or 'FFFFFF'
	local color_medias1 = argumento{'color_medias1','medias1'} or 'FFFFFF'
	local trama_izq1 = argumento{'trama_izq1','patrón_izq1'} or ''
	local trama_cuerpo1 = argumento{'trama_cuerpo1','patrón_cuerpo1'} or ''
	local trama_der1 = argumento{'trama_der1','patrón_der1'} or ''
	local trama_pantalon1 = argumento{'trama_pantalón1','patrón_pant1'} or ''
	local trama_medias1 = argumento{'trama_medias1','patrón_med1'} or ''
	local tipo_izq1 = argumento{'tipo_izq1'} or 'png' 
	local tipo_der1 = argumento{'tipo_der1'} or 'png'
	local tipo_pantalon1 = argumento{'tipo_pantalón1'} or 'png'
	local tipo_cuerpo1 = argumento{'tipo_cuerpo1'} or 'png'

	local tipo_medias1 = argumento{'tipo_medias1'} or 'png'
	local color_cuerpo2 = argumento{'color_cuerpo2'} or 'FFFFFF'
	local color_izq2 = argumento{'color_izq2','izquierdo2'} or 'FFFFFF'
	local color_der2 = argumento{'color_der2','derecho2'} or 'FFFFFF'
	local color_pantalon2 = argumento{'color_pantalón2','shorts2'} or 'FFFFFF'
	local color_medias2 = argumento{'color_medias2','medias2'} or 'FFFFFF'
	local trama_izq2 = argumento{'trama_izq2','patrón_izq2'} or ''
	local trama_cuerpo2 = argumento{'trama_cuerpo2','patrón_cuerpo2'} or ''
	local trama_der2 = argumento{'trama_der2','patrón_der2'} or ''
	local trama_pantalon2 = argumento{'trama_pantalón2','patrón_pant2'} or ''
	local trama_medias2 = argumento{'trama_medias2','patrón_med2'} or''
	local tipo_izq2 = argumento{'tipo_izq2'} or 'png'
	local tipo_der2 = argumento{'tipo_der2'} or 'png'
	local tipo_pantalon2 = argumento{'tipo_pantalón2'} or 'png'
	local tipo_medias2 = argumento{'tipo_medias2'} or 'png'
	local tipo_cuerpo2 = argumento{'tipo_cuerpo2'} or 'png'

	local color_cuerpo3 = argumento{'color_cuerpo3'} or 'FFFFFF'
	local color_izq3 = argumento{'color_izq3'} or 'FFFFFF'
	local color_der3 = argumento{'color_der3'} or 'FFFFFF'
	local color_pantalon3 = argumento{'color_pantalón3'} or 'FFFFFF'
	local color_medias3 = argumento{'color_medias3'} or ''
	local trama_izq3 = argumento{'trama_izq3'} or ''
	local trama_cuerpo3 = argumento{'trama_cuerpo3'} or ''
	local trama_der3 = argumento{'trama_der3'} or ''
	local trama_pantalon3 = argumento{'tipo_pantalón3'} or ''
	local trama_medias3 = argumento{'trama_medias3'} or ''
	local tipo_izq3 = argumento{'tipo_izq3'} or 'png'
	local tipo_der3 = argumento{'tipo_der3'} or 'png'
	local tipo_pantalon3 = argumento{'trama_pantalón3'} or ''
	local tipo_medias3 = argumento{'tipo_medias3'} or 'png'
	local tipo_cuerpo3 = argumento{'tipo_cuerpo3'} or 'png'

	local tipo_local = argumento{'tipo_local'} or 'png'

	local cadenaaux = '{{Uniforme' ..
		'|color brazo izquierdo = ' .. color_izq1 ..
		'|color cuerpo          = ' .. color_cuerpo1 ..
		'|color brazo derecho   = ' .. color_der1 ..
		'|color pantalón        = ' .. color_pantalon1 ..
		'|color medias          = ' .. color_medias1 ..
		'|trama brazo izquierdo = ' .. trama_izq1 ..
		'|trama cuerpo          = ' .. trama_cuerpo1 ..
		'|trama brazo derecho   = ' .. trama_der1 ..
		'|trama pantalón        = ' .. trama_pantalon1 ..
		'|trama medias          = ' .. trama_medias1 ..
		'|tipo_izq              = ' .. tipo_izq1 ..
		'|tipo_cuerpo           = ' .. tipo_cuerpo1 ..
		'|tipo_der              = ' .. tipo_der1 ..
		'|tipo_pan              = ' .. tipo_pantalon1 ..
		'|tipo_med              = ' .. tipo_medias1 ..
		'|título                = [[Equipamiento de los futbolistas|Titular]]' ..
		'}}'

	local cadenaaux1 = '{{Uniforme' ..
		'|color brazo izquierdo = ' .. color_izq2 ..
		'|color cuerpo          = ' .. color_cuerpo2 ..
		'|color brazo derecho   = ' .. color_der2 ..
		'|color pantalón        = ' .. color_pantalon2 ..
		'|color medias          = ' .. color_medias2 ..
		'|trama brazo izquierdo = ' .. trama_izq2 ..
		'|trama cuerpo          = ' .. trama_cuerpo2 ..
		'|trama brazo derecho   = ' .. trama_der2 ..
		'|trama pantalón        = ' .. trama_pantalon2 ..
		'|trama medias          = ' .. trama_medias2 ..
		'|tipo_izq              = ' .. tipo_izq2 ..
		'|tipo_cuerpo           = ' .. tipo_cuerpo2 ..
		'|tipo_der              = ' .. tipo_der2 ..
		'|tipo_pan              = ' .. tipo_pantalon2 ..
		'|tipo_med              = ' .. tipo_medias2 ..
		'|título                = [[Equipamiento de los futbolistas|Alternativo]]' ..
		'}}'

	local cadenaret = '<table style="margin: 0 auto;"><tr style="vertical-align: top;">' ..
		'<td style="width: 50%;">' .. frame:preprocess(cadenaaux) .. '</td>' ..
		'<td style="width: 50%;">' .. frame:preprocess(cadenaaux1) .. '</td>'

	if (color_izq3 == nil) and (color_der3 == nil) then -- No hay una tercera camiseta ..
		cadenaret = cadenaret .. '</tr></table>'
	else
		cadenaaux2 = '{{Uniforme' ..
			'|color brazo izquierdo = ' .. safeText(color_izq3) ..
			'|color cuerpo          = ' .. color_cuerpo3 ..
			'|color brazo derecho   = ' .. safeText(color_der3) ..
			'|color pantalón        = ' .. color_pantalon3 ..
			'|color medias          = ' .. color_medias3 ..
			'|trama brazo izquierdo = ' .. trama_izq3 ..
			'|trama cuerpo          = ' .. trama_cuerpo3 ..
			'|trama brazo derecho   = ' .. trama_der3 ..
			'|trama pantalón        = ' .. trama_pantalon3 ..
			'|trama medias          = ' .. trama_medias3 ..
			'|tipo_izq              = ' .. tipo_izq3 ..
			'|tipo_cuerpo           = ' .. tipo_cuerpo3 ..
			'|tipo_der              = ' .. tipo_der3 ..
			'|tipo_pan              = ' .. tipo_pantalon3 ..
			'|tipo_med              = ' .. tipo_medias3 ..
			'|título                = [[Equipamiento de los futbolistas|Tercero]]' ..
			'}}'
		cadenaret = cadenaret .. '<td style="width: 50%;">' .. frame:preprocess(cadenaaux2) .. '</td>' ..
			'</tr></table>'
	end
	cadenaret = cadenaret .. '<tr style="vertical-align: top;">'
	cadenaret = cadenaret .. '<td style="width: 50%;">'
	return frame:preprocess(cadenaret)
end

function obtenercamisetabaloncesto(frame)
	local colorcuerpo = argumento{'color_cuerpo1'} or 'ffffff'
	local colorpantalon = argumento{'color_pantalón1'} or 'ffffff'
	local tramacuerpo = argumento{'trama_cuerpo1'} or ''
	local tramapantalon = argumento{'trama_pantalón1'} or ''
	local cadenaaux = '{{Uniforme de baloncesto' ..
		'|color_cuerpo = ' .. colorcuerpo ..
		'|color_pantalón = ' .. colorpantalon ..
		'|trama_cuerpo = ' .. tramapantalon ..
		'|título = Local' ..
		'}}'
	local colorcuerpo2 = argumento{'color_cuerpo2'} or 'ffffff'
	local colorpantalon2 = argumento{'color_pantalón2'} or 'ffffff'
	local tramacuerpo2 = argumento{'trama_cuerpo2'} or ''
	local tramapantalon2 = argumento{'trama_pantalón2'} or ''
	local cadenaaux1 = '{{Uniforme de baloncesto' ..
		'|color_cuerpo = ' .. colorcuerpo2 ..
		'|color_pantalón = ' .. colorpantalon2 ..
		'|trama_cuerpo = ' .. tramapantalon2 ..
		'|título = Visitante' ..
		'}}'
	local cadenaret = '<table style="margin: 0 auto;">' ..
		'<tr style="vertical-align: top;">' ..
		'<td style="width: 50%;">' ..
		frame:preprocess(cadenaaux) ..
		'</td>' ..
		'<td style="width: 50%;">' ..
		frame:preprocess(cadenaaux1) ..
		'</td>' ..
		'</tr>' ..
		'</table>'
	return cadenaret
end

function obtenercabecera(frame, tipo)
	local deporte = nil
	if frame:getParent():getTitle():find('Plantilla:Ficha de selección de fútbol') then
		deporte = 'fútbol' -- mismo tipo que nombre
	elseif frame:getParent():getTitle():find('Plantilla:Selección nacional de fútbol playa') then
		if tipo == 'tipo' then
			deporte = 'fútbol' -- no existe tipo 'fútbol-playa'
		else
			deporte = 'fútbol Playa de FIFA'
		end
	elseif frame:getParent():getTitle():find('Plantilla:Selección nacional de fútbol sala') then
		if tipo == 'tipo' then
			deporte = 'fútbol' -- no existe tipo 'fútbol-sala'
		else
			deporte = 'fútbol sala'
		end
	elseif frame:getParent():getTitle():find('Plantilla:Ficha de selección de baloncesto') then
		deporte = 'baloncesto' -- mismo tipo que nombre
	elseif frame:getParent():getTitle():find('Plantilla:Ficha de selección de balonmano') then
		deporte = 'balonmano' -- mismo tipo que nombre
	elseif frame:getParent():getTitle():find('Plantilla:Ficha de selección de polo') then
		deporte = 'polo' -- no existe tipo 'polo'
	elseif frame:getParent():getTitle():find('Plantilla:Ficha de selección de voleibol femenino') then
		if tipo == 'tipo' then
			deporte = 'voleibol' -- no existe tipo 'voleibol-femenino'
		else
			deporte = 'voleibol femenino'
		end
	elseif frame:getParent():getTitle():find('Plantilla:Ficha de selección de voleibol') then
		deporte = 'voleibol' -- mismo tipo que nombre
	elseif frame:getParent():getTitle():find('Plantilla:Ficha de selección de rugby') then
		if argumento{'especial'} == 7 and tipo ~= 'tipo' then
			deporte = 'rugby 7' -- no existe tipo 'rugby-7'
		else
			deporte = 'rugby' -- mismo tipo que nombre
		end
	elseif frame:getParent():getTitle():find('Plantilla:Ficha de equipo de tenis') then
		deporte = 'tenis' -- mismo tipo que nombre
		estilotit = 'background-color:#cccc88'
		estilosec = 'background-color:#cccc88'
	elseif frame:getParent():getTitle():find('Plantilla:Ficha de selección de hockey sobre césped') or
		frame:getParent():getTitle():find('Plantilla:Ficha de selección de hockey sobre patines') then
		if tipo == 'tipo' then
			deporte = 'hockey' -- no existe tipo 'hockey-césped'
		else
			deporte = 'hockey sobre césped'
		end
	elseif frame:getParent():getTitle():find('Plantilla:Ficha de selección de hockey sobre hielo') then
		if tipo == 'tipo' then
			deporte = 'hockey'
		else
			deporte = 'hockey sobre hielo'
		end
	end
	return deporte
end

function obtenercamiseta(frame)
	if	((frame:getParent()):getTitle()):find('Plantilla:Ficha de selección de fútbol') or 
		(frame:getParent():getTitle():find('Plantilla:Ficha de selección de balonmano')) or 
		(frame:getParent():getTitle():find('Plantilla:Selección nacional de fútbol sala')) or
		(frame:getParent():getTitle():find('Plantilla:Ficha de selección de rugby')) or
		(frame:getParent():getTitle():find('Plantilla:Ficha de selección de hockey'))
	then
		return obtenercamisetafutbol(frame)
	elseif (frame:getParent():getTitle():find('Plantilla:Ficha de selección de baloncesto')) then
		return obtenercamisetabaloncesto(frame)
	end
end

function p.Ficha(frame)
	ModuloArgs.obtenerTablaDeArgumentos(frame)
	local nombre = argumento{'nombre','Nombre'} or ModuloPaginas.nombrePagina({desambiguar='sí'})
	local cabecera = obtenercabecera(frame, 'nombre')
	if nombre:find('Copa Davis') == nil and nombre:find('Fed Cup') == nil then
		if nombre:find('Selección') == nil then
			if cabecera then
				nombre = 'Selección de '.. cabecera .. ' de ' .. nombre
			end
		end
	end
	if nombre:find('hockey') and argumento{'fem'} == 'sí' then
		nombre = nombre:gsub('Selección','Selección femenina')
		end
	local goleadorgoles = ''
	if argumento{'mayor goleador goles'} ~= nil then
		goleadorgoles = safeText( argumento('mayor goleador') )..' ('..argumento{'mayor goleador goles'}..')'
	else
		goleadorgoles = safeText( argumento{'mayor goleador'} )
	end
	local mayorparticipacion = ''
	if argumento{'mayor partidos'} ~= nil then
		mayorparticipacion = safeText( argumento('más participaciones') )..' ('..argumento('mayor partidos')..')'
	else
		mayorparticipacion = safeText( argumento{'más participaciones'} )
	end
	local pais = argumento{'país','Nombre'}
	local bandera = ''
	if pais ~= nil then
		if argumento{'Bandera'}~= nil then
			bandera = frame:preprocess('[[Archivo:'..argumento{'Bandera'}..'|200px]]')
		else
			bandera = frame:preprocess('{{Bandera|'..pais..'|tamaño=200px}}')
		end
	end
	if frame:getParent():getTitle():find('hockey sobre patines') then
		bandera = frame:preprocess('{{Bandera|'..argumento{'Nombre'}..'|tamaño=200px}}')
	end
	local titulodt = 'Director técnico'
	local dtband1 = ''
	local dtband2 = ''
	if argumento{'país-dt'} ~= nil then
		dtband1 = frame:preprocess('{{Bandera|'..argumento{'país-dt'}..'|tamaño=20px}}')
	end
	if argumento{'país2-dt'} ~= nil then
		dtband2 = frame:preprocess('{{Bandera|'..argumento('país2-dt')..'|tamaño=20px}}')
	end
	local dt = ''
	if argumento{'director técnico','Entrenador'} == nil then
		dt = 'No tiene'
	else
		if (argumento{'año-dt'} == '') or (argumento{'año-dt'} == nil) then
			dt = dtband1..dtband2..argumento{'director técnico','Entrenador'}
		else
			dt = dtband1..dtband2..argumento{'director técnico','Entrenador'}..' <small>(Desde '..safeText(argumento{'año-dt'})..')</small>'
		end
	end
	local rankingFIBA = nil
	local obtenercod = nil
	local titulocapitan = '[[Capitán (deporte)|Capitán]]'
	local titulocod = nil
	if frame:getParent():getTitle():find('Plantilla:Ficha de selección de fútbol') then
		titulocod = '[[Anexo:Códigos de la FIFA|Código FIFA]]'
		obtenercod = argumento{'cod'}
		titulocapitan = '[[Capitan (fútbol)|Capitán]]'
	elseif frame:getParent():getTitle():find('Plantilla:Ficha de selección de baloncesto') then
		obtenercod = argumento{'cod'}
		if obtenercod then
			rankingFIBA = frame:preprocess('{{#if:{{Selección de baloncesto/clasificación|'..obtenercod..'{{#if:{{{femenino|}}}|_f}}}}|{{Selección de baloncesto/clasificación|{{{cod}}}{{#if:{{{femenino|}}}|_f}}}} después {{Selección de baloncesto/clasificación|torneo{{#if:{{{femenino|}}}|_f}}}}{{Selección de baloncesto/clasificación|{{#if:{{{femenino|}}}|_f}}}}|}}')
		end
		titulodt = 'Seleccionador'
		obtenercod = nil
	elseif frame:getParent():getTitle():find('hockey sobre patines') then
		titulocod = 'Código FIRS'
		obtenercod = argumento{'cod'}
	elseif frame:getParent():getTitle():find('hockey sobre hielo') then
		titulocod = 'Código IIHS'
		obtenercod = argumento{'cod'}
	end
	local rankingFIVB = nil
	if frame:getParent():getTitle():find('Plantilla:Ficha de selección de voleibol' ) then
		obtenercod = argumento{'cod'}
		if obtenercod then
			local fem = ''
			if frame:getParent():getTitle():find('voleibol femenino') then
				fem = 'f'
			end
			rankingFIVB = frame:preprocess('{{Ficha de selección de voleibol/Clasificación|'..obtenercod..'|'..fem..'}}') ..
				' a ' .. frame:preprocess('{{Ficha de selección de voleibol/Clasificación|fecha|{{{femenino|}}}}}')
		end
		titulodt = 'Entrenador'
		obtenercod = nil
	end
	local titulomundial
	if cabecera then
		local lang = mw.language.getContentLanguage()
		titulomundial = '[[Copa Mundial de '.. lang:ucfirst(cabecera) ..']]'
	end
	if	frame:getParent():getTitle() == 'Plantilla:Ficha de selección de balonmano' or
		frame:getParent():getTitle() == 'Plantilla:Ficha de selección de balonmano/pruebas' then
		titulomundial = '[[Campeonato Mundial de Balonmano]]'
	elseif frame:getParent():getTitle():find('Plantilla:Ficha de selección de voleibol') then
		titulomundial = '[[Campeonato Mundial de Voleibol]]'
	elseif frame:getParent():getTitle():find('Plantilla:Selección nacional de fútbol sala') then
			titulomundial = '[[Copa Mundial de fútbol sala de la FIFA]]'
	end
	local PPI = obtenerPPI(frame)
	local UPI = obtenerUPI(frame)
	local MRI = obtenerMRI(frame)
	local PRI = obtenerPRI(frame)
	local MV = obtenerMV(frame)
	local PD = obtenerPD(frame)
	if MV ~= nil then
		MRI = nil
		PRI = nil
	end
	if pais ~= nil then
		if pais:find('Copa Davis') then 
			pais = ''
		end
	end
	local Ficha = {
		tipocabecera = obtenercabecera(frame, 'tipo'),
		['titulo'] = nombre,
		estilotitulo = estilotit,
		estiloseccion = estilosec,
		{'',bandera},
		{tipo = 'sección',
			['titulo'] ='Datos generales',
			{'país', pais},
			{titulocod, obtenercod},
			{'Asociación', argumento{'asociación'}},
			{'Confederación',argumento{'confederación'}},
			{'Federación', argumento{'Federación'}},
			{'Seudónimo',argumento{'seudónimo'}},
			{titulodt, dt},
			{titulocapitan,argumento{'capitán','Capitán'}},
			{'Mayor goleador',goleadorgoles},
			{'Jugador con mayor participación', mayorparticipacion},
			{'Ránking FIFA',argumento{'Ránking FIFA'}},
			{'[[Ranking Mundial FIBA|Ranking FIBA]]', rankingFIBA},
			{'[[Clasificación mundial de la FIVB|Clasif. FIVB]]',rankingFIVB},
			{'[[Anexo:Códigos de la Federación Internacional de Tenis|Código ITF]]',argumento{'Código ITF'}},
			{'Primera participación', argumento{'Primera participación'}},
			{'Ediciones disputadas', argumento{'Ediciones disputadas'}},
			{'Participaciones Grupo Mundial', argumento{'Participaciones Grupo Mundial'}},
			{'Títulos', argumento{'Títulos'}},
			{'Veces finalista', argumento{'Finalista'}},
			{'Mejor puesto', argumento{'Mejor puesto'}},
			{'Colores',argumento{'Colores'}},
			{'Estadio',argumento{'estadio'}},
			{'',obtenercamiseta(frame)}
		},
		{tipo = 'sección',
			['título'] = 'Primer partido internacional',
			{'',PPI}
		},
		{tipo='sección',
			['título'] = 'Último partido internacional',
			{'',UPI}
		},
		{tipo='sección',
			['título'] = 'Mejor resultado internacional',
			{'',MRI}
		},
		{tipo='sección',
			['título'] = 'Mejor resultado',
			{'',MV}
		},
		{tipo = 'sección',
			['título'] = 'Peor resultado internacional',
			{'',PRI}
		},
		{tipo = 'sección',
			['título'] = 'Peor resultado',
			{'',PD}
		},
		{tipo = 'sección',
			['título'] = titulomundial,
			{'Participaciones', obtenerparticipaciones('participación mundial', frame)},
			{'Medallas',argumento{'Medallas Mundial'}},
			{'Mejor resultado', argumento{'mejor mundial','Mejor resultado Copa Mundial','Mejor resultado mundial'},},
		},
		{tipo = 'sección',
			['título']	= '[[Liga Mundial de Voleibol|Liga Mundial]]',
			{'Participación Liga Mundial', obtenerparticipaciones('liga mundial')},
			{'Mejor resultado', argumento{'Mejor resultado liga'}},
		},
		{tipo = 'sección',
			['título'] = '[[Copa Confederaciones]]',
			{'Participaciones', obtenerparticipaciones('participación confederaciones', frame)},
			{'Mejor resultado', argumento{'mejor confederaciones'}},
		},
		{tipo = 'sección',
			['título'] = argumento{'copa regional','Copa regional nombre'},
			{'Participaciones', obtenerparticipaciones('participación regional', frame)},
			{'Mejor resultado', argumento{'mejor regional','Mejor resultado regional'},},
		},
		{tipo = 'sección',
			['título'] = argumento{'copa regional2'},
			{'Participaciones', obtenerparticipaciones('participación regional2', frame)},
			{'Mejor resultado', argumento{'mejor regional2'},},
		},
		{tipo = 'sección',
			['título'] = argumento{'copa regional3'},
			{'Participaciones', obtenerparticipaciones('participación regional3', frame)},
			{'Mejor resultado', argumento{'mejor regional3'}},
		},
		{tipo = 'sección',
			['título'] = argumento{'copa regional4'},
			{'Participaciones', obtenerparticipaciones('participación regional4', frame)},
			{'Mejor resultado', argumento{'mejor regional4'},},
		},
		{tipo= 'sección',
			['título'] = 'Torneos Olímpicos',
			{'Participaciones', obtenerparticipaciones('torneo olímpico', frame)},
			{'Mejor resultado', argumento{'mejor olímpico'},},
			{'Medallas', argumento{'Medallas olímpico'},}
		},
		{tipo = 'sección',
			['título'] = '[[Grand Prix|Grand Prix de Voleibol]]',
			{'Participación Grand Prix', argumento{'Participación Grand Prix'}},
			{'Mejor resultado', argumento{'Mejor resultado Grand Prix'}},
		},
		{tipo = 'sección',
			['título'] = 'Estadística de jugador',
			{'Mas triunfos totales', argumento{'Jugador más ganador'}},
			{'Mas triunfos en individuales', argumento{'Individuales más ganador'}},
			{'Más triunfos en dobles', argumento{'Dobles más ganador'}},
			{'Mejor equipo de dobles', argumento{'Mejor equipo de dobles'}},
			{'Más eliminatorias jugadas', argumento{'Más series disputadas'}},
			{'Más años jugados', argumento{'Más ediciones disputadas'}},
		},
	}
	return ModuloFicha.infobox(Ficha)
end

return p