Diferencia entre revisiones de «Módulo:Ficha de selecciones deportivas»

De Wikipedia, la enciclopedia libre
Contenido eliminado Contenido añadido
probando
Sin resumen de edición
Línea 13: Línea 13:
end
end


local function helperBandera(frame, pais, param, lado, enlace)
local function helperEnlace(frame, pais)
local enlace = nil
local plantilla = frame:getParent():getTitle()
if safeText( pais ) == '' then
return ''
elseif plantilla == 'Plantilla:Ficha de selección de fútbol' then
enlace = 'Selección de fútbol de ' .. pais
elseif plantilla == 'Plantilla:Ficha de selección de baloncesto' then
if argumento{'fem'} == 'fem' or argumento{'femenino'} == 'si' or argumento{'fem'} == 'sí' then
enlace = 'Selección femenina de baloncesto de ' .. pais
else
enlace = 'Selección de baloncesto de ' .. pais
end
elseif plantilla == 'Plantilla:Ficha de selección de rugby' then
if argumento{'fem'} == 'fem' or argumento{'femenino'} == 'si' or argumento{'fem'} == 'sí' then
enlace = 'Selección femenina de rugby de ' .. pais
else
enlace = 'Selección de rugby de ' .. pais
end
if argumento{'especial'} == '7' then
enlace = enlace:gsub('rugby', 'rugby 7')
end
end
if enlace then
return '[[' .. enlace .. '|' .. pais .. ']]'
else
return '[[' .. pais .. ']]'
end
end

local function helperBandera(frame, pais, param, lado)
if (pais == nil or pais == '') then
if (pais == nil or pais == '') then
pais = argumento{'país','Nombre'} or ''
pais = argumento{'país','Nombre'} or ''
Línea 26: Línea 56:
cadena = cadena .. '}} '
cadena = cadena .. '}} '
end
end
if enlace == nil then
local enlace = helperEnlace(frame, pais)
if frame:getParent():getTitle():find('Plantilla:Ficha de selección de fútbol') then
enlace = 'Selección de fútbol de ' .. pais
end
end
if enlace then
if enlace then
cadena = cadena .. '[[' .. enlace .. '|' .. pais .. ']]'
cadena = cadena .. enlace
else
cadena = cadena .. '[[' .. pais .. ']]'
end
end
if lado == 1 then
if lado == 1 then
Línea 112: Línea 136:
return nil
return nil
end
end
return helperBandera( frame, argumento{'Nombre'}, nil, 1 ) ..
local mvaux = ''
local plantilla = frame:getParent():getTitle()
if plantilla == 'Plantilla:Ficha de selección de baloncesto' then
mvaux = helperBandera( frame, argumento{MVPD}, nil, 2, 'Selección de baloncesto de '..argumento{MVPD} )
if argumento{'fem'} == 'fem' or argumento{'femenino'} == 'si' or argumento{'fem'} == 'sí' then
mvaux = helperBandera( frame, argumento{MVPD}, nil, 2, 'Selección femenina de baloncesto de '..argumento{MVPD} )
end
elseif plantilla == 'Plantilla:Ficha de selección de rugby' then
mvaux = helperBandera( frame, argumento{MVPD}, nil, 2, 'Selección de rugby de '..argumento{MVPD} )
if argumento{'fem'} == 'fem' or argumento{'femenino'} == 'si' or argumento{'fem'} == 'sí' then
mvaux = helperBandera( frame, argumento{MVPD}, nil, 2, 'Selección femenina de rugby de '..argumento{MVPD} )
end
if argumento{'especial'} == '7' then
mvaux = helperBandera( frame, argumento{MVPD}, nil, 2, 'Selección de rugby 7 de '..argumento{MVPD} )
end
end
return helperBandera( frame, argumento{'Nombre'}, nil, 1) ..
" '''" .. safeText(argumento{MVPD..' Marcador'}) .. "''' " ..
" '''" .. safeText(argumento{MVPD..' Marcador'}) .. "''' " ..
helperBandera( frame, argumento{MVPD}, nil, 2 ) ..
mvaux ..
'<br>' .. argumento{MVPD..' Lugar'} ..
'<br>' .. argumento{MVPD..' Lugar'} ..
'<br>' .. argumento{MVPD..' Fecha'}
'<br>' .. argumento{MVPD..' Fecha'}
Línea 156: Línea 164:
end
end
else
else
local enlace = nil
if plantilla:find('Plantilla:Ficha de selección de baloncesto') then
enlace = 'Selección de baloncesto de ' .. argumento{XPI}
elseif plantilla:find('Plantilla:Ficha de selección de rugby') then
enlace = '[[Selección de rugby de ' .. argumento{XPI}..']]'
if argumento{'especial'} == '7' then
enlace = enlace:gsub('rugby', 'rugby 7')
end
end
if argumento{XPI} ~= nil then
if argumento{XPI} ~= nil then
return safeText( argumento{'país','Nombre'} ) ..
return helperEnlace( frame, argumento{'país', 'Nombre'} ) ..
' ' .. safeText( argumento{XPI..' Marcador'} ) ..
' ' .. safeText( argumento{XPI..' Marcador'} ) ..
' ' .. safeText( argumento{XPI} ) ..
' ' .. helperEnlace( frame, argumento{XPI} ) ..
'<br>' .. safeText( argumento{XPI..' Lugar'} ) ..
'<br>' .. safeText( argumento{XPI..' Lugar'} ) ..
' — ' .. safeText( argumento{XPI..' Fecha'} )
' — ' .. safeText( argumento{XPI..' Fecha'} )
end
end
return helperBandera( frame, argumento{XPI..' país1'}, argumento{XPI..' bandera1'}, 1 ) .. ' ' ..
return helperBandera( frame, argumento{XPI..' país1'}, argumento{XPI..' bandera1'}, 1 ) ..
' ' .. safeText( argumento{XPI..' marcador'} ) .. ' ' ..
' ' .. safeText( argumento{XPI..' marcador'} ) ..
' ' .. helperBandera( frame, argumento{XPI..' país2'}, argumento{XPI..' bandera2'}, 2, enlace ) .. ' ' ..
' ' .. helperBandera( frame, argumento{XPI..' país2'}, argumento{XPI..' bandera2'}, 2 ) ..
'<br><small>' .. safeText( argumento{XPI..' lugar'} ) ..
'<br><small>' .. safeText( argumento{XPI..' lugar'} ) ..
' — ' .. safeText( argumento{XPI..' fecha'} ) .. '</small>' ..
' — ' .. safeText( argumento{XPI..' fecha'} ) .. '</small>' ..

Revisión del 18:19 22 feb 2022

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:#DCDCDC'
local estilosec = 'background-color:#DCDCDC; width: 150%'

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

local function helperEnlace(frame, pais)
	local enlace = nil
	local plantilla = frame:getParent():getTitle()
	if safeText( pais ) == '' then
		return ''
	elseif plantilla == 'Plantilla:Ficha de selección de fútbol' then
		enlace = 'Selección de fútbol de ' .. pais
	elseif plantilla == 'Plantilla:Ficha de selección de baloncesto' then
		if argumento{'fem'} == 'fem' or  argumento{'femenino'} == 'si' or argumento{'fem'} == 'sí' then
			enlace = 'Selección femenina de baloncesto de ' .. pais
		else
			enlace = 'Selección de baloncesto de ' .. pais
		end
	elseif plantilla == 'Plantilla:Ficha de selección de rugby' then
		if argumento{'fem'} == 'fem' or  argumento{'femenino'} == 'si' or argumento{'fem'} == 'sí'  then
			enlace = 'Selección femenina de rugby de ' .. pais
		else
			enlace = 'Selección de rugby de ' .. pais
		end
		if argumento{'especial'} == '7'  then
			enlace = enlace:gsub('rugby', 'rugby 7')
		end
	end
	if enlace then
		return '[[' .. enlace .. '|' .. pais .. ']]'
	else
		return '[[' .. pais .. ']]'
	end
end

local function helperBandera(frame, pais, param, lado)
	if (pais == nil or pais == '') then
		pais = argumento{'país','Nombre'} or ''
	end
	if (pais ~= nil) and (pais ~= '') then
		local cadena = ''
		if lado == 2 then
			cadena = cadena .. '{{Bandera|' .. pais
			if (param ~= nil) and (param ~= '') then
				cadena = cadena .. '|'..param
			end
			cadena = cadena .. '}} '
		end
		local enlace = helperEnlace(frame, pais)
		if enlace then
			cadena = cadena .. enlace
		end
		if lado == 1 then
			cadena = cadena .. ' {{Bandera|' .. pais
			if (param ~= nil) and (param ~= '') then
				cadena = cadena .. '|'..param
			end
			cadena = cadena .. '}}'
		end
		return frame:preprocess(cadena)
	else
		return ''
	end
end

function obtenerXRI(frame, XRI)
	local plantilla = frame:getParent():getTitle()
	if	plantilla:find('Plantilla:Ficha de selección de polo') or 
		plantilla:find('Plantilla:Ficha de equipo de tenis') then
		return nil
	end
	if (XRI == 'PRI' and argumento{'Peor resultado'} ~= nil) then
		return argumento{'Peor resultado'}
	elseif (XRI == 'MRI' and argumento{'Mejor resultado'} ~= nil) then
		return argumento{'Mejor resultado'}
	end
	local cuenta = 1
	local cadena = ''
	if	argumento{XRI} == nil and
		(	argumento{XRI..' país1'} == nil or
			argumento{XRI..' país1'} == ''	) and
		(	argumento{XRI..' país2'} == nil or
			argumento{XRI..' país2'} == ''	) then
		return 'Sin datos'
	end
	local seguir = true
	local evento = ''
	while (seguir == true) do
		i = cuenta
		if i == 1 then
			i = ''
		end
		if	(argumento{XRI..(cuenta + 1)} == nil) and
			(argumento{XRI..(cuenta + 1).. ' país1'} == nil) and
			(argumento{XRI..(cuenta + 1).. ' país2'} == nil) then
			seguir = false
		end
		if argumento{XRI..i} ~= nil then
			seguir = false
			return '[[' .. safeText(argumento{'país','Nombre'}) .. ']]' ..
				' ' .. safeText(argumento{XRI..i..' Marcador'}) ..
				' ' .. safeText(argumento{XRI..i}) ..
				'<br>' .. safeText(argumento{XRI..i..' Lugar'}) ..
				' — ' .. safeText(argumento{XRI..i..' Fecha'})
		end
		cadena = cadena ..
			( cadena == '' and '' or '<br>' ) ..
			helperBandera( frame, argumento{XRI..i..' país1'}, argumento{XRI..i..' bandera1'}, 1 ) .. ' ' ..
			' '.. safeText( argumento{XRI..i..' marcador'} ) .. ' ' ..
			' ' .. helperBandera( frame, argumento{XRI..i..' país2'}, argumento{XRI..i..' bandera2'}, 2 ) .. ' ' ..
			'<br><small>' .. safeText( argumento{XRI..i..' lugar'} ) ..
			' — ' .. safeText( argumento{XRI..i..' fecha'} ) .. '</small>' ..
			'<br><small>' .. safeText(argumento{XRI..i..' evento'}) .. '</small>'
		cuenta = cuenta + 1
	end
	return cadena
end
function obtenerMRI(frame)
	return obtenerXRI(frame, 'MRI')
end
function obtenerPRI(frame)
	return obtenerXRI(frame, 'PRI')
end

function obtenerXP(frame, MVPD)
	if argumento{MVPD} == nil or argumento{MVPD} == '' then
		return nil
	end
	return helperBandera( frame, argumento{'Nombre'}, nil, 1 ) ..
		" '''" .. safeText(argumento{MVPD..' Marcador'}) .. "''' " ..
		helperBandera( frame, argumento{MVPD}, nil, 2 ) ..
		'<br>' .. argumento{MVPD..' Lugar'} ..
		'<br>' .. argumento{MVPD..' Fecha'}
end
function obtenerMV(frame)
	return obtenerXP(frame, 'MV')
end
function obtenerPD(frame)
	return obtenerXP(frame, 'PD')
end

function obtenerXPI(frame, XPI)
	local cadena = nil
	local plantilla = frame:getParent():getTitle()
	if argumento{XPI} == nil and
	(	argumento{XPI..' país1'} == nil or
		argumento{XPI..' país1'} == ''	) and
	(	argumento{XPI..' país2'} == nil or
		argumento{XPI..' país2'} == ''	) then
		if	plantilla:find('Plantilla:Ficha de selección de polo') or 
			plantilla:find('Plantilla:Ficha de equipo de tenis') then
			return nil
		else
			cadena = 'Sin datos'
		end
	else
		if argumento{XPI} ~= nil then
			return helperEnlace( frame, argumento{'país', 'Nombre'} ) .. 
				' ' .. safeText( argumento{XPI..' Marcador'} ) ..
				' ' .. helperEnlace( frame, argumento{XPI} ) ..
				'<br>' .. safeText( argumento{XPI..' Lugar'} ) ..
				' — ' .. safeText( argumento{XPI..' Fecha'} )
		end
		return helperBandera( frame, argumento{XPI..' país1'}, argumento{XPI..' bandera1'}, 1 ) ..
			' ' .. safeText( argumento{XPI..' marcador'} ) ..
			' ' .. helperBandera( frame, argumento{XPI..' país2'}, argumento{XPI..' bandera2'}, 2 ) ..
			'<br><small>' .. safeText( argumento{XPI..' lugar'} ) ..
			' — ' .. safeText( argumento{XPI..' fecha'} ) .. '</small>' ..
			'<br><small>' .. safeText( argumento{XPI..' evento'} ) .. '</small>'
	end
end
function obtenerPPI(frame)
	return obtenerXPI(frame, 'PPI')
end
function obtenerUPI(frame)
	return obtenerXPI(frame, 'UPI')
end

local function helperParticipaciones(first, second)
	if first == nil or first == '' then
		return nil
	else
		if second and second ~= '' then
			return safeText(first) ..
				'<small> (primera vez en ' .. safeText(second) .. ')</small>'
		else
			return safeText(first)
		end
	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 regional4' then
		return helperParticipaciones( argumento{'participación regional4'}, argumento{'primer regional4'} )
	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 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                = Primera' ..
		'}}'
	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 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                = Segunda' ..
		'}}'
	local color_cuerpo3 = argumento{'color_cuerpo3'} or 'FFFFFF'
	local color_izq3 = argumento{'color_izq3'}
	local color_der3 = argumento{'color_der3'}
	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'
	if (color_izq3 == nil) and (color_der3 == nil) then -- No hay una tercera camiseta ..
		local cadenaret = '<table class="toccolours" style="padding:0; margin:0; background-color:#fff; width:100%; text-align:center">'..
			'<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
	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                = Tercera' ..
			'}}'
			local cadenaret = '<table class="toccolours" style="padding:0; margin:0; background-color:#fff; width:100%; text-align:center">'..
			'<tr style="vertical-align: top;">' ..
			'<td style="width: 50%;">' ..
			frame:preprocess(cadenaaux) ..
			'</td>' ..
			'<td style="width: 50%;">' ..
			frame:preprocess(cadenaaux1) ..
			'</td>' ..
			'<td style="width: 50%;">' ..
			frame:preprocess(cadenaaux2) ..
			'</td>' ..
			'</tr>' ..
			'</table>'
		return cadenaret
	end
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 class="toccolours" style="padding:0; margin:0; background-color:#fff; width:100%; text-align:center">'..
		'<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
	local plantilla = frame:getParent():getTitle()
	if plantilla:find('Plantilla:Ficha de selección de fútbol') then
		deporte = 'fútbol' -- mismo tipo que nombre
	elseif plantilla: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 plantilla: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 plantilla:find('Plantilla:Ficha de selección de baloncesto') then
		deporte = 'baloncesto' -- mismo tipo que nombre
	elseif plantilla:find('Plantilla:Ficha de selección de balonmano') then
		deporte = 'balonmano' -- mismo tipo que nombre
	elseif plantilla:find('Plantilla:Ficha de selección de polo') then
		deporte = 'polo' -- no existe tipo 'polo'
	elseif plantilla: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 plantilla:find('Plantilla:Ficha de selección de voleibol') then
		deporte = 'voleibol' -- mismo tipo que nombre
	elseif plantilla: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 plantilla:find('Plantilla:Ficha de equipo de tenis') then
		deporte = 'tenis' -- mismo tipo que nombre
		estilotit = 'background-color:#cccc88'
		estilosec = 'background-color:#cccc88'
	elseif plantilla:find('Plantilla:Ficha de selección de hockey sobre césped') or
		plantilla: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 plantilla: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)
	local plantilla = frame:getParent():getTitle()
	if	plantilla:find('Plantilla:Ficha de selección de fútbol') or 
		plantilla:find('Plantilla:Ficha de selección de balonmano') or 
		plantilla:find('Plantilla:Selección nacional de fútbol sala') or
		plantilla:find('Plantilla:Ficha de selección de rugby') or
		plantilla:find('Plantilla:Ficha de selección de hockey')
	then
		return obtenercamisetafutbol(frame)
	elseif plantilla: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')
	local plantilla = frame:getParent():getTitle()
	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
	if nombre:find('rugby') and argumento('especial') == '7' then
		 nombre = nombre:gsub('rugby','rugby 7')
    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 plantilla:find('hockey sobre patines') then
		bandera = frame:preprocess('{{Bandera|'..argumento{'Nombre'}..'|tamaño=200px}}')
	end
	local titulodt = 'Seleccionador'
	local dtband1 = ''
	local dtband2 = ''
	if argumento{'país-dt'} ~= nil then
		dtband1 = frame:preprocess('{{Bandera| '..argumento{'país-dt'}..'|tamaño=20px}}&nbsp;')
	end
	if argumento{'país2-dt'} ~= nil then
		dtband2 = frame:preprocess('{{Bandera| '..argumento('país2-dt')..'|tamaño=20px}}&nbsp;')
	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'
	local titulocod = nil
	if plantilla:find('Plantilla:Ficha de selección de fútbol') then
		titulocod = '[[Anexo:Códigos de la FIFA|Código FIFA]]'
		obtenercod = argumento{'cod'}
		titulocapitan = '[[Capitán (fútbol)|Capitán]]'
	elseif plantilla: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 plantilla:find('hockey sobre patines') then
		titulocod = 'Código FIRS'
		obtenercod = argumento{'cod'}
	elseif plantilla:find('hockey sobre hielo') then
		titulocod = 'Código IIHS'
		obtenercod = argumento{'cod'}
	end
	local rankingFIVB = nil
	if plantilla:find('Plantilla:Ficha de selección de voleibol' ) then
		obtenercod = argumento{'cod'}
		if obtenercod then
			local fem = ''
			if plantilla: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 plantilla:find('Plantilla:Ficha de selección de balonmano') then
		titulomundial = '[[Campeonato Mundial de Balonmano]]'
	elseif plantilla:find('Plantilla:Ficha de selección de voleibol') then
		titulomundial = '[[Campeonato Mundial de Voleibol]]'
	elseif plantilla:find('Plantilla:Ficha de selección de fútbol') then
		titulomundial = '[[Copa Mundial de Fútbol|Mundial]]'
	elseif plantilla:find('Plantilla:Selección nacional de fútbol sala') then
		titulomundial = '[[Copa Mundial de fútbol sala de la FIFA]]'
	end
	local juegosolimpicos
	if cabecera then
		juegosolimpicos = 'Torneos Olímpicos'
	end
	if	plantilla:find('Plantilla:Ficha de selección de fútbol') then
		juegosolimpicos = '[[Fútbol en los Juegos Olímpicos|Juegos Olímpicos]]'
	end
	PPI = obtenerPPI(frame)
	UPI = obtenerUPI(frame)
	MRI = obtenerMRI(frame)
	PRI = obtenerPRI(frame)
	MV = obtenerMV(frame)
	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
	equipaciones = 'Equipaciones'
	if	plantilla:find('Plantilla:Ficha de selección de fútbol') then
		equipaciones = '[[Equipamiento de los futbolistas|Equipaciones]]'
	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},
			{'Federación', argumento{'asociación'}},
			{'Confederación',argumento{'confederación'}},
			{'Federación', argumento{'Federación'}},
			{'Seudónimo(s)',argumento{'seudónimo'}},
			{titulodt, dt},
			{titulocapitan,argumento{'capitán','Capitán'}},
			{'Más goles',goleadorgoles},
			{'Más partidos', mayorparticipacion},
			{'[[Clasificación mundial de la FIFA|Clasificación FIFA]]',argumento{'Ranking 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 ganados', argumento{'Títulos'}},
			{'Finales jugadas', argumento{'Finalista'}},
			{'Mejor puesto', argumento{'Mejor puesto'}},
			{'Colores',argumento{'Colores'}},
			{'Estadio(s)',argumento{'estadio'}},
		},
			{tipo = 'sección',
			['título'] = equipaciones,
			{'',obtenercamiseta(frame)}
		},
		{tipo = 'sección',
			['título'] = 'Primer partido',
			{'',PPI}
		},
		{tipo='sección',
			['título'] = 'Último partido',
			{'',UPI}
		},
		{tipo='sección',
			['título'] = 'Mejor(es) resultado(s)',
			{'',MRI}
		},
		{tipo='sección',
			['título'] = 'Mejor resultado',
			{'',MV}
		},
		{tipo = 'sección',
			['título'] = 'Peor(es) resultado(s)',
			{'',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'] = safeText( 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'] = safeText( argumento{'copa regional2'}),
			{'Participaciones', obtenerparticipaciones('participación regional2', frame)},
			{'Mejor resultado', argumento{'mejor regional2'},},
		},
		{tipo = 'sección',
			['título'] = safeText( argumento{'copa regional3'}),
			{'Participaciones', obtenerparticipaciones('participación regional3', frame)},
			{'Mejor resultado', argumento{'mejor regional3'}},
		},
		{tipo = 'sección',
			['título'] = safeText( argumento{'copa regional4'}),
			{'Participaciones', obtenerparticipaciones('participación regional4', frame)},
			{'Mejor resultado', argumento{'mejor regional4'},},
		},
		{tipo = 'sección',
			['título'] = '[[Copa FIFA Confederaciones|Confederaciones]]',
			{'Participaciones', obtenerparticipaciones('participación confederaciones', frame)},
			{'Mejor resultado', argumento{'mejor confederaciones'}},
		},
		{tipo= 'sección',
			['título'] = juegosolimpicos,
			{'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