Módulo:Ficha de personaje
Este es un módulo que pretende reemplazar a la actual plantilla Plantilla:Tl, con el propósito de hacer labores más complejas, como la integración con Wikidata, además de fusionar Plantilla:Tl aquí, e interoperabilidad con Módulo:Ficha animanga/Ficha. Este módulo es usado por Plantilla:Tl.
Uso
<syntaxhighlight lang=moin>Error de Lua en package.lua en la línea 80: module 'Módulo:Ficha de personaje/Pokémon' not found.</syntaxhighlight>
Transclusión con diferentes ejemplos
La plantilla Plantilla:Tl es usada en los siguientes artículos:
Además, se proveen los siguientes ejemplos:
(Q9351)
Al ser un Pokémon ( (P31) → (Q25930719) → (P279) → (Q3966183)), el módulo toma valores específicos y los formatea de manera específica, para imitar el comportamiento de la plantilla Plantilla:Tl, solo que los datos de la Pokédex se muestran debajo, y el color de la ficha se basa en el (Q25931659) (en base a (P31) → Pokémon de cierto tipo → (P279) → (Q3966183)), definido en Módulo:Ficha de personaje/Pokémon. En otros casos específicos, el color de la ficha se basa en el (P1884) (véase el ejemplo sobre Vocaloid).
La clase CSS para esto es Plantilla:Code. Plantilla:Ficha de personaje/casos de prueba/Pikachu
(Q12342580)
Plantilla:Ficha de personaje/casos de prueba/Mew
(Q5480)
Plantilla:Ficha de personaje/casos de prueba/Bart Simpson
(Q2142)
Este ejemplo ilustra la fusión de Plantilla:Tl.
- Estándar: Uso de Plantilla:Tl, Plantilla:Tl, Plantilla:Tl e Plantilla:Tl
- Propuesta: Plantilla:Tl con el parámetro Plantilla:Param para llamar a Módulo:Ficha animanga en lugar de Módulo:Ficha. El resto de las plantillas subsiguientes se usan como de costumbre (aunque tarde o temprano se integrarán en el módulo.
Plantilla:Ficha de personaje/casos de prueba/Goku
(Q552682)
Este ejemplo ilustra la fusión de Plantilla:Tl, junto con establecer el color de la ficha en base al (P1884) del personaje, siempre que sea animanga.
- Estándar: Plantilla:Tl (la mayoría de los artículos sobre personajes de Vocaloid)
- Propuesta: Plantilla:Tl fue fusionada en este módulo, integrando tanto los datos del personaje como los del software de banco de voz. Usada solo por dos páginas.
El color de la ficha se determina por el (P1884) del personaje, listado en Módulo:Ficha_de_personaje/Colores, siempre que se establezca el parámetro Plantilla:Param, de lo contrario, se mostrará el color estándar.
La clase CSS para esto es Plantilla:Code. Plantilla:Ficha de personaje/casos de prueba/Hatsune Miku
local p = {}
local ModuloWikidata = require('Módulo:Wikidata')
local ModuloFormatos = require('Módulo:Wikidata/Formatos')
local ModuloPaginas = require('Módulo:Páginas')
local ModuloArgs = require('Módulo:Argumentos')
local elementoTabla = require('Módulo:Tablas').elemento
local formatoNumero = ModuloFormatos.formatoNumero2
local numeroUnidad = ModuloFormatos.formatoUnidad2
local obtenerEtiquetaWikidata = ModuloWikidata.obtenerEtiquetaWikidata
local argumentos = ModuloArgs.obtenerValorDeArgumentos
local ModuloFicha -- El módulo se define más abajo
local Entidad
local InstanciaDeID
-- :: Estilos por defecto
local EstiloTabla = 'border-spacing:2px;padding:2px;'
local EstiloEtiqueta = 'width:30%;'
local EstiloDatos = 'width:70%;'
local anchoImagen = '245px'
local ColorTituloFondo = '#69A0F3'
local ColorTituloTexto = '#ffffff'
local ColorEtiqueta = '#e7f0fd'
local EstiloTitulo = 'font-weight:bold;'
-- :: Tablas
local DatosPokemon = mw.loadData('Módulo:Ficha de personaje/Pokémon')
local ColoresCabello = mw.loadData('Módulo:Ficha de personaje/Colores')
-- La función Ficha()
function p.Ficha(frame)
-- :: Inicializardor
ModuloWikidata:setFrame(frame)
ModuloArgs.obtenerTablaDeArgumentos(frame)
Entidad = mw.wikibase.getEntityObject(argumentos{'id'}) or mw.wikibase.getEntityObject(argumentos{'entidad'}) or {}
local InstanciaDe = elementoTabla(Entidad, 'claims', 'P31', 1)
if InstanciaDe then InstanciaDeID = elementoTabla(InstanciaDe, 'mainsnak', 'datavalue', 'value', 'id') end
-- Para incluir a Módulo:Ficha o Módulo:Ficha animanga según corresponda
local Integrada = argumentos{'uni', 'child', 'integrada'}
local Animanga = argumentos{'animanga'}
if Integrada or Animanga then
ModuloFicha = require('Módulo:Ficha animanga')
TipoFicha = 'cabecera'
Integrada = 'sí'
ClaseTitulo = 'animanga'
else
ModuloFicha = require('Módulo:Ficha/pruebas')
end
-- :: Cabecera ficha
local Titulo = argumentos{'nombre', 'nombre_personaje'} or obtenerEtiquetaWikidata(Entidad) or ModuloPaginas.nombrePagina({desambiguar='sí'})
local Subtitulo
-- :: Datos personales
local NombreOrig = argumentos{'nombre_original', 'nombre original', 'real', 'nombrejapon', 'japanname', 'namejapon', 'nombre_ja', 'nombre_co'}
local NombreTransliterado = argumentos{'nombre_ja_trad', 'ja_romaji'}
if not NombreOrig then
local NO = elementoTabla(Entidad, 'claims', 'P1559', 1) or elementoTabla(Entidad, 'claims', 'P1705', 1)
if NO then
NombreOrig = elementoTabla(NO, 'mainsnak', 'datavalue', 'value', 'text') or NombreOrig
NombreTransliterado = elementoTabla(NO, 'qualifiers', 'P2440', 1, 'datavalue', 'value') or NombreTransliterado
end
end
if NombreOrig then
--if Animanga then Titulo = Titulo .. '<br><span style="font-size:70%">' .. NombreOrig .. '</span>' end
if NombreTransliterado then NombreOrig = NombreOrig .. ' (' .. NombreTransliterado .. ')' end
end
local Alias = argumentos{'sobrenombre', 'alias', {propiedad, 'P1449'}}
local OtrosNombres = argumentos{'otrosnombres', {propiedad, 'P4970'}}
-- :: Datos generales
local FechaNac = argumentos{'nacido', {propiedad, 'P569', {['uno'] = 'sí'}}}
local FechaFall = argumentos{'fallecido', {propiedad, 'P570', {['uno'] = 'sí'}}}
local Raza = argumentos{'raza', {propiedad, 'P4743', {['uno'] = 'sí'}}}
local Genero = argumentos{'sexo', 'género', {propiedad, 'P21', {['uno'] = 'sí'}}}
local Edad = argumentos{'edad', {propiedad, 'P6249', {['formato'] = 'unidad'}}}
local Estatura = argumentos{'altura', 'metricheight'}
if Estatura then
Estatura = Estatura .. ' [[Metro|m]]'
else
Estatura = argumentos{{propiedad, 'P2048', {['formato'] = 'unidad'}}}
end
local Peso = argumentos{'peso', 'metricweight'}
if Peso then
Peso = Peso .. ' [[kg]]'
else
Peso = argumentos{{propiedad, 'P2067', {['formato'] = 'unidad'}}}
end
local Cabello = argumentos{'pelo', 'cabello', {propiedad, 'P1884', {['uno'] = 'sí'}}}
local Ojos = argumentos{'ojos', {propiedad, 'P1340', {['uno'] = 'sí'}}}
-- :: Datos familiares, gremio y actividades
local Ocupacion = argumentos{'ocupación', {propiedad, 'P106'}}
local TituloCortes = argumentos{'título', {propiedad, 'P1035'}}
local Equipamiento = argumentos{'equipamiento', {propiedad, 'P2283'}, {propiedad, 'P2283'}, {propiedad, 'P520'}}
local Miembros = argumentos{'miembros', {propiedad, 'P463'}}
local ExMiembros = argumentos{'exmiembros'}
local Aliados = argumentos{'aliados', {propiedad, 'P399'}, {propiedad, 'P2546'}}
local Enemigos = argumentos{'enemigos', {propiedad, 'P7047'}}
local Afiliaciones = argumentos{'afiliaciones', {propiedad, 'P1416'}}
local AfilAnt = argumentos{'afiliaciones_anteriores'}
local Familia = argumentos{'familia', {propiedad, 'P53'}}
local Conexiones = argumentos{'conexiones'}
local Conyuge = argumentos{'cónyuge', {propiedad, 'P26'}}
local Pareja = argumentos{'pareja', {propiedad, 'P451'}}
local Padres = argumentos{'padres'}
local Padre
local Madre
if not Padres then
Padres = {}
Padre = argumentos{'padre', {propiedad, 'P22'}}
Madre = argumentos{'madre', {propiedad, 'P25'}}
if Padre then table.insert(Padres, Padre) end
if Madre then table.insert(Padres, Madre) end
Padres = table.concat(Padres, '<br>')
end
local Hijos = argumentos{'hijos', {propiedad, 'P40'}}
local Familiares = argumentos{'familiares', 'parientes', {propiedad, 'P1038'}}
local Residencia = argumentos{'residencia', {propiedad, 'P551'}}
local Religion = argumentos{'religión', 'credo', {propiedad, 'P140'}}
local Nacionalidad = argumentos{'nacionalidad', {propiedad, 'P27'}}
local EstadoActual = argumentos{'estatus', 'status', 'estado'}
-- Poderes y habilidades
local PoderesTitulo = 'Poderes'
local Poderes = argumentos{'especialidad', 'poderes'} or ''
if string.len(Poderes) > 342 then
Poderes = Poderes:gsub('<div [%w%"%%:;=%s]*>\n<div [%w%"%%:;=%s]*>[%w%s]*</div>',''):gsub('</div>\n</div>','</div>')
Poderes = seccionDesplegable(frame, PoderesTitulo, Poderes)
else
PoderesEtiqueta = PoderesTitulo
end
local HabilidadesTitulo = 'Habilidades'
local Habilidades = argumentos{'habilidad', 'ability'} or ''
if string.len(Habilidades) > 342 then
Habilidades = Habilidades:gsub('<div [%w%"%%:;=%s]*>\n<div [%w%"%%:;=%s]*>[%w%s]*</div>',''):gsub('</div>\n</div>','</div>')
Habilidades = seccionDesplegable(frame, HabilidadesTitulo, Habilidades)
else
HabilidadesEtiqueta = HabilidadesTitulo
end
-- :: Autoría, sindicación y doblaje
local Autor = argumentos{'creador', 'autor', {propiedad, 'P170'}}
local Interprete = argumentos{'actor', {propiedad, 'P175', {['lista'] = 'nobullet'}}}
local Voz = argumentos{'voz', 'doblador', 'seiyu', {propiedad, 'P725'}}
local VozPersonaje, VozVocaloid, InterpretePersonaje, InterpreteVocaloid
local VozLatam = argumentos{'doblador_hispanoamérica', 'doblador hispanoamérica'} or ''
local VozEsp = argumentos{'doblador_españa', 'doblador españa'} or ''
local Doblaje = {}
if string.len(VozLatam) > 0 then
if string.len(VozLatam) > 300 then
VozLatam = seccionDesplegable(frame, '[[Hispanoamérica]]', VozLatam, true)
else
VozLatam = '<div style="font-weight:bold;background-color:' .. ColorEtiqueta .. '">[[Hispanoamérica]]</div>\n' .. VozLatam
end
table.insert(Doblaje, VozLatam)
end
if string.len(VozEsp) > 0 then
if string.len(VozEsp) > 300 then
VozEsp = seccionDesplegable(frame, '[[España]]', VozEsp, true)
else
VozEsp = '<div style="font-weight:bold;background-color:' .. ColorEtiqueta .. '">[[España]]</div>\n' .. VozEsp
end
table.insert(Doblaje, VozEsp)
end
Doblaje = table.concat(Doblaje, '<br>\n')
local Editorial = argumentos{'editorial', {propiedad, 'P123'}}
-- :: Fechas
local Debut = argumentos{'primera aparición', 'primera', 'debut', 'fecha salida', 'lanzamiento', {propiedad, 'P4584'}, {propiedad, 'P580'}, {propiedad, 'P577'}, {propiedad, 'P5204'}}
local Retiro = argumentos{'última aparición', 'ultima', 'última', {propiedad, 'P582'}}
local MotivoRetiro = argumentos{'última aparición causa', 'causa'}
if MotivoRetiro then Retiro = Retiro .. '<small>(' .. MotivoRetiro .. ')</small>' end
local WebLanzamineto= argumentos{'web_lanzamiento'}
-- :: Datos externos
local imdbId, filmaffinityId, seccionEnlacesExternos
if argumentos{'test'} == 'sí' then
seccionEnlacesExternos = frame:preprocess('<small>{{#Invoke:listas|listahtml|clase=hlist'..
'|'..((propiedad('P3593', {['uno'] = 'sí'}) and '[http://www.afi.com/members/catalog/DetailView.aspx?s=&Movie='..propiedad('P3593', {['uno'] = 'sí'})..' AFI]') or '')..
'|'..((propiedad('P1562', {['uno'] = 'sí'}) and '[http://www.allmovie.com/movie/'..propiedad('P1562', {['uno'] = 'sí'})..' AllMovie]') or '')..
'|'..((propiedad('P1237', {['uno'] = 'sí'}) and '[http://www.boxofficemojo.com/movies/?id='..propiedad('P1237', {['uno'] = 'sí'})..' Box Office Mojo]') or '')..
'|'..((propiedad('P480', {['uno'] = 'sí'}) and '[https://www.filmaffinity.com/es/film'..propiedad('P480', {['uno'] = 'sí'})..'.html FilmAffinity]') or '')..
'|'..((propiedad('P345', {['uno'] = 'sí'}) and '[https://www.imdb.com/title/'..propiedad('P345', {['uno'] = 'sí'})..'/ IMDb]') or '')..
'|'..((propiedad('P1712', {['uno'] = 'sí'}) and '[http://www.metacritic.com/'..propiedad('P1712', {['uno'] = 'sí'})..' Metacritic]') or '')..
'|'..((propiedad('P3302', {['uno'] = 'sí'}) and '[https://www.omdb.org/movie/'..propiedad('P3302', {['uno'] = 'sí'})..' omdb]') or '')..
'|'..((propiedad('P1258', {['uno'] = 'sí'}) and '[https://www.rottentomatoes.com/'..propiedad('P1258', {['uno'] = 'sí'})..' Rotten Tomatoes]') or '')..
'|'..((propiedad('P1265', {['uno'] = 'sí'}) and '[http://www.sensacine.com/film/fichefilm_gen_cfilm='..propiedad('P1265', {['uno'] = 'sí'})..'.html SensaCine]') or '')..
'|'..((propiedad('P2631', {['uno'] = 'sí'}) and '[http://tcmdb.com/title/title.jsp?stid='..propiedad('P2631', {['uno'] = 'sí'})..' TCM]') or '')..
'|'..((propiedad('P2638', {['uno'] = 'sí'}) and '[http://www.tv.com/'..propiedad('P2638', {['uno'] = 'sí'})..' TV.com]') or '')..'}}</small>')
else
imdbId = argumentos{'imdbid', 'imdbId', {propiedad, 'P345', {['uno'] = 'sí'}}}
filmaffinityId = argumentos{'filmaffinityid', 'filmaffinityId', {propiedad, 'P480', {['uno'] = 'sí'}}}
end
local enlaceImdb = imdbId and '[https://www.imdb.com/title/'..imdbId..'/ Ficha] en [[Internet Movie Database|IMDb]]'
local enlaceFilmaffinity = filmaffinityId and '[https://www.filmaffinity.com/es/film'..filmaffinityId..'.html Ficha] en [[FilmAffinity]]'
local identificadoresExternos
if imdbId and filmaffinityId then
identificadoresExternos = enlaceImdb..'<br />'..enlaceFilmaffinity
elseif imdbId or filmaffinityId then
identificadoresExternos = enlaceImdb or enlaceFilmaffinity
end
-- :: Específicos de Pokémon
local Pokedex = obtenerPokedex(frame)
local PokemonTipo = Pokedex['tipo']
local PokemonEspecie = Pokedex['especie']
local PokemonEtapa = Pokedex['etapa']
local DifrenciaGenero = Pokedex['dif_genero'] or ''
local Generacion = Pokedex['generacion'] or argumentos{'generación', 'generation'}
if not Debut == '' and Generacion then
Debut = Debut .. '<br>(' .. Generacion .. ' generación)'
elseif not Debut and Generacion then
Debut = Generacion .. 'generación'
end
local Preevolucion = Pokedex['preevolución']
if Preevolucion then Preevolucion = enlazar(frame, Preevolucion) end
local Evolucion = Pokedex['evolución']
if Evolucion then Evolucion = enlazar(frame, Evolucion) end
-- Nacional / Kanto
local PokedexNacNum = Pokedex['pokedex_nac']
local PokedexNacAnt = Pokedex['anterior_nac'] or ''
local PokedexNacSig = Pokedex['siguiente_nac'] or ''
local KantoTitulo = '[[Pokédex#Pokédex_Nacional|Pokédex nacional]] / [[Anexo:Lugares_de_Pokémon#Kanto|Kanto]]'
if PokedexNacNum then KantoTitulo = KantoTitulo .. ' (#' .. formatoNumero(PokedexNacNum) .. ')' end
-- Johto
local PokedexJotNum = Pokedex['pokedex_jot']
local PokedexJotAnt = Pokedex['anterior_jot'] or ''
local PokedexJotSig = Pokedex['siguiente_jot'] or ''
local JohtoTitulo = '[[Pokédex]] de [[Anexo:Lugares_de_Pokémon#Johto|Johto]]'
if PokedexJotNum then JohtoTitulo = JohtoTitulo .. ' (#' .. formatoNumero(PokedexJotNum) .. ')' end
-- Hoenn
local PokedexHoeNum = Pokedex['pokedex_hoe']
local PokedexHoeAnt = Pokedex['anterior_hoe'] or ''
local PokedexHoeSig = Pokedex['siguiente_hoe'] or ''
local HoennTitulo = '[[Pokédex]] de [[Anexo:Lugares_de_Pokémon#Hoenn|Hoenn]]'
if PokedexHoeNum then HoennTitulo = HoennTitulo .. ' (#' .. formatoNumero(PokedexHoeNum) .. ')' end
-- Sinnoh
local PokedexSinNum = Pokedex['pokedex_sin']
local PokedexSinAnt = Pokedex['anterior_sin'] or ''
local PokedexSinSig = Pokedex['siguiente_sin'] or ''
local SinnohTitulo = '[[Pokédex]] de [[Anexo:Lugares_de_Pokémon#Sinnoh|Sinnoh]]'
if PokedexSinNum then SinnohTitulo = SinnohTitulo .. ' (#' .. formatoNumero(PokedexSinNum) .. ')' end
-- Teselia
local PokedexTesNum = Pokedex['pokedex_tes']
local PokedexTesAnt = Pokedex['anterior_tes'] or ''
local PokedexTesSig = Pokedex['siguiente_tes'] or ''
local TeseliaTitulo = '[[Pokédex]] de [[Anexo:Lugares_de_Pokémon#Teselia|Teselia]]'
if PokedexTesNum then TeseliaTitulo = TeseliaTitulo .. ' (#' .. formatoNumero(PokedexTesNum) .. ')' end
local PokedexTes2Num = Pokedex['pokedex_te2']
local PokedexTes2Ant = Pokedex['anterior_te2'] or ''
local PokedexTes2Sig = Pokedex['siguiente_te2'] or ''
local Teselia2Titulo = '[[Pokédex]] de [[Anexo:Lugares_de_Pokémon#Teselia|Teselia]] ([[Pokémon negro 2 y Pokémon blanco 2|NB2]])'
if PokedexTes2Num then Teselia2Titulo = Teselia2Titulo .. ' (#' .. formatoNumero(PokedexTes2Num) .. ')' end
-- Kalos
local PokedexKalMonNum = Pokedex['pokedex_kal_mon']
local PokedexKalMonAnt = Pokedex['anterior_kal_mon'] or ''
local PokedexKalMonSig = Pokedex['siguiente_kal_mon'] or ''
local KalosMonTitulo = '[[Pokédex]] de [[Anexo:Lugares_de_Pokémon#Kalos|Kalos Montaña]]'
if PokedexKalMonNum then KalosMonTitulo = KalosMonTitulo .. ' (#' .. formatoNumero(PokedexKalMonNum) .. ')' end
local PokedexKalCenNum = Pokedex['pokedex_kal_cen']
local PokedexKalCenAnt = Pokedex['anterior_kal_cen'] or ''
local PokedexKalCenSig = Pokedex['siguiente_kal_cen'] or ''
local KalosCenTitulo = '[[Pokédex]] de [[Anexo:Lugares_de_Pokémon#Kalos|Kalos Centro]]'
if PokedexKalCenNum then KalosCenTitulo = KalosCenTitulo .. ' (#' .. formatoNumero(PokedexKalCenNum) .. ')' end
local PokedexKalCosNum = Pokedex['pokedex_kal_cos']
local PokedexKalCosAnt = Pokedex['anterior_kal_cos'] or ''
local PokedexKalCosSig = Pokedex['siguiente_kal_cos'] or ''
local KalosCosTitulo = '[[Pokédex]] de [[Anexo:Lugares_de_Pokémon#Kalos|Kalos Costa]]'
if PokedexKalCosNum then KalosCosTitulo = KalosCosTitulo .. ' (#' .. formatoNumero(PokedexKalCosNum) .. ')' end
-- Alola
local PokedexAloNum = Pokedex['pokedex_alo']
local PokedexAloAnt = Pokedex['anterior_alo'] or ''
local PokedexAloSig = Pokedex['siguiente_alo'] or ''
local AlolaTitulo = '[[Pokédex]] de [[Anexo:Lugares_de_Pokémon#Alola|Alola]]'
if PokedexAloNum then AlolaTitulo = AlolaTitulo .. ' (#' .. formatoNumero(PokedexAloNum) .. ')' end
-- Galar
local PokedexGalNum = Pokedex['pokedex_gal']
local PokedexGalAnt = Pokedex['anterior_gal'] or ''
local PokedexGalSig = Pokedex['siguiente_gal'] or ''
local GalarTitulo = '[[Pokédex]] de [[Anexo:Lugares_de_Pokémon#Galar|Galar]]'
if PokedexGalNum then GalarTitulo = GalarTitulo .. ' (#' .. formatoNumero(PokedexGalNum) .. ')' end
local TituloPersonaje
if next(Pokedex) then
TituloPersonaje = "Datos del Pokémon"
else
TituloPersonaje = "Información"
end
local TituloEtapa = "Linea evolutiva"
if PokemonEtapa then TituloEtapa = TituloEtapa .. ' (' .. PokemonEtapa .. ')' end
-- :: Software (Vocaloid y otros)
local Motor = argumentos{'motor', {propiedad, 'P408'}}
local GeneroMusical = argumentos{'género', 'genero', {propiedad, 'P136'}}
local Tempo = argumentos{'tempo', {propiedad, 'P1725'}}
local RangoDinamico = argumentos{'rango'}
local Desarrollador = argumentos{'desarrollador', {propiedad, 'P178'}}
local ModeloDesarrollo = argumentos{'modelo_desarrollo'}
local Plataforma = argumentos{'plataforma', {propiedad, 'P400'}}
local licencia = argumentos{'licencia', {propiedad, 'P275'}}
local EstadoSoftware = argumentos{'estado'}
local Idioma = argumentos{'idioma', 'idiomas', {propiedad, 'P407'}}
local Franquicia = argumentos{'obra', {propiedad, 'P8345', {['uno'] = 'sí', ['link'] = 'sí'}}, {propiedad, 'P1441', {['uno'] = 'sí', ['link'] = 'sí'}}}
if InstanciaDeID == 'Q550596' then
Subtitulo = 'Banco de voz de [[Vocaloid]]'
VozVocaloid = Voz or Interprete
ClaseTitulo = 'animanga'
elseif next(Pokedex) then
Subtitulo = '[[Pokémon]]'
VozPersonaje = Voz
InterpretePersonaje = Interprete
ClaseTitulo = 'animanga'
elseif Franquicia then
Subtitulo = 'Personaje de ' .. Franquicia
VozPersonaje = Voz
InterpretePersonaje = Interprete
end
-- :: Datos extra
local DatosExtra = {tipo="sección",titulo = "Datos extra"}
for i=21,25 do
if not argumentos{'etiqueta'..i, 'lbl'..i} and not argumentos{'datos'..i, 'data'..i} then break end
table.insert(DatosExtra, {argumentos{'etiqueta'..i, 'lbl'..i}, argumentos{'datos'..i, 'data'..i}})
end
for i=21,25 do
if not argumentos{'etiqueta'..i, 'lbl'..i} and not argumentos{'datos'..i, 'data'..i} then break end
table.insert(DatosExtra, {argumentos{'etiqueta'..i, 'lbl'..i}, argumentos{'datos'..i, 'data'..i}})
end
local Imagen = argumentos{'imagen', 'image', 'logo'}
local TamanoImagen = argumentos{'image_width', 'tamaño imagen', 'tamaño_imagen'} or '250px'
local Pie
if Imagen then
Pie = argumentos{'pie', 'image_caption'}
else
Imagen, Pie = ModuloWikidata.obtenerImagenWikidata(Entidad, 'P18') or ModuloWikidata.obtenerImagenWikidata(Entidad, 'P154')
end
-- Colores de la ficha en base al color de cabello del personaje
local ColorAuto = argumentos{'color auto', 'color_auto'}
local ColorCabello = elementoTabla(Entidad, 'claims', 'P1884', 1, 'mainsnak', 'datavalue', 'value', 'id')
if ColoresCabello[ColorCabello] and ColorAuto then
ColorTituloFondo= ColoresCabello[ColorCabello][1]
ColorTituloTexto= ColoresCabello[ColorCabello][3]
ColorEtiqueta = ColoresCabello[ColorCabello][2]
end
-- :: Estilos
ColorTituloFondo = argumentos{'piel', 'colorfondo'} or Pokedex['colortitulo'] or ColorTituloFondo
ColorTituloTexto = argumentos{'colortexto'} or Pokedex['colortexto'] or ColorTituloTexto
ColorEtiqueta = argumentos{'coloretiqueta'} or Pokedex['coloretiqueta'] or ColorEtiqueta
EstiloTitulo = 'background-color:' .. ColorTituloFondo .. ';color:' .. ColorTituloTexto
EstiloEtiqueta = argumentos{'estiloetiqueta'} or EstiloEtiqueta .. ';background-color:' .. ColorEtiqueta
local TablaFicha = {
uni = Integrada,
tipo = TipoFicha,
titulo = Titulo,
subtitulo = Subtitulo,
estilo = EstiloTabla,
clasetitulo = ClaseTitulo,
estilotitulo = EstiloTitulo,
estiloseccion = EstiloTitulo,
estiloetiqueta = EstiloEtiqueta,
imagen = Imagen,
["tamañoimagen"] = TamanoImagen,
pie = Pie,
estilopie = "font-size:88%",
-- :: General
{tipo="sección",
{'Creador(es)', Autor},
{'Interpretado por', InterpretePersonaje},
{'Voz original', VozPersonaje},
{'Doblaje', Doblaje},
--{'Doblador en [[Hispanoamérica]]', VozLatam},
--{'Doblador en [[España]]', VozEsp},
{'Primera aparición', Debut},
{'Última aparición', Retiro},
{'Motivo de retiro', MotivoRetiro},
{'Editorial', Editorial},
},
{tipo="sección",
titulo = TituloPersonaje,
{'Nombre original', NombreOrig},
{'Otros Nombres', OtrosNombres},
{'Alias', Alias},
{'Nacionalidad', Nacionalidad},
{'Residencia', Residencia},
{'Religión', Religion},
{'Estado actual', EstadoActual},
{'Fecha de nacimiento', FechaNac},
{'Fecha de fallecimiento', FechaFall},
{'Raza', Raza}, -- Para Pokémon, véase PokemonEspecie
{'Género', Genero},
{'Diferencia de género', DifrenciaGenero},
{'Edad', Edad},
{'Estatura', Estatura},
{'Peso', Peso},
{'Cabello', Cabello},
{'Ojos', Ojos},
{PoderesEtiqueta, Poderes}, -- Para Pokémon, véase Habilidades
{'Ocupacion', Ocupacion},
{'Título', TituloCortes},
{'Equipamiento', Equipamiento},
},
{tipo="sección",
--titulo = "Información familiar",
{'Familia', Familia},
{'Conexiones', Conexiones},
{'Conyuge', Conyuge},
{'Pareja', Pareja},
{'Padres', Padres},
{'Hijos', Hijos},
{'Familiares', Familiares},
},
{tipo="sección",
--titulo = "Afiliaciones",
{'Miembros', Miembros},
{'Ex miembros', ExMiembros},
{'Aliados', Aliados},
{'Enemigos', Enemigos},
{'Afiliaciones', Afiliaciones},
{'Afiliaciones anteriores', AfilAnt},
},
-- :: Específicos de Pokémon
{tipo="sección",
{'Especie', PokemonEspecie},
{'Tipo', PokemonTipo},
{HabilidadesEtiqueta, Habilidades},
},
{tipo="sección",
titulo = TituloEtapa,
estilotitulo = EstiloTabla,
estiloseccion = EstiloTitulo,
['ocultar_vacíos'] = 'sí',
{
color = ColorEtiqueta,
['tipo'] = 'sucesión',
['anterior'] = Preevolucion,
['siguiente'] = Evolucion,
},
},
{tipo="sección",
titulo = KantoTitulo,
estilotitulo = EstiloTabla,
['ocultar_vacíos'] = 'sí',
{
color = ColorEtiqueta,
['tipo'] = 'sucesión',
['anterior'] = PokedexNacAnt,
['siguiente'] = PokedexNacSig,
},
},
{tipo="sección",
titulo = JohtoTitulo,
estilotitulo = EstiloTabla,
['ocultar_vacíos'] = 'sí',
{
color = ColorEtiqueta,
['tipo'] = 'sucesión',
['anterior'] = PokedexJotAnt,
['siguiente'] = PokedexJotSig,
},
},
{tipo="sección",
titulo = HoennTitulo,
estilotitulo = EstiloTabla,
['ocultar_vacíos'] = 'sí',
{
color = ColorEtiqueta,
['tipo'] = 'sucesión',
['anterior'] = PokedexHoeAnt,
['siguiente'] = PokedexHoeSig,
},
},
{tipo="sección",
titulo = SinnohTitulo,
estilotitulo = EstiloTabla,
['ocultar_vacíos'] = 'sí',
{
color = ColorEtiqueta,
['tipo'] = 'sucesión',
['anterior'] = PokedexSinAnt,
['siguiente'] = PokedexSinSig,
},
},
{tipo="sección",
titulo = TeseliaTitulo,
estilotitulo = EstiloTabla,
['ocultar_vacíos'] = 'sí',
{
color = ColorEtiqueta,
['tipo'] = 'sucesión',
['anterior'] = PokedexTesAnt,
['siguiente'] = PokedexTesSig,
},
},
{tipo="sección",
titulo = Teselia2Titulo,
estilotitulo = EstiloTabla,
['ocultar_vacíos'] = 'sí',
{
color = ColorEtiqueta,
['tipo'] = 'sucesión',
['anterior'] = PokedexTes2Ant,
['siguiente'] = PokedexTes2Sig,
},
},
{tipo="sección",
titulo = KalosMonTitulo,
estilotitulo = EstiloTabla,
['ocultar_vacíos'] = 'sí',
{
color = ColorEtiqueta,
['tipo'] = 'sucesión',
['anterior'] = PokedexKalMonAnt,
['siguiente'] = PokedexKalMonSig,
},
},
{tipo="sección",
titulo = KalosCenTitulo,
estilotitulo = EstiloTabla,
['ocultar_vacíos'] = 'sí',
{
color = ColorEtiqueta,
['tipo'] = 'sucesión',
['anterior'] = PokedexKalCenAnt,
['siguiente'] = PokedexKalCenSig,
},
},
{tipo="sección",
titulo = KalosCosTitulo,
estilotitulo = EstiloTabla,
['ocultar_vacíos'] = 'sí',
{'Número', PokedexKalCosNum},
{
color = ColorEtiqueta,
['tipo'] = 'sucesión',
['anterior'] = PokedexKalCosAnt,
['siguiente'] = PokedexKalCosSig,
},
},
{tipo="sección",
titulo = AlolaTitulo,
estilotitulo = EstiloTabla,
['ocultar_vacíos'] = 'sí',
{
color = ColorEtiqueta,
['tipo'] = 'sucesión',
['anterior'] = PokedexAloAnt,
['siguiente'] = PokedexAloSig,
},
},
{tipo="sección",
titulo = GalarTitulo,
estilotitulo = EstiloTabla,
['ocultar_vacíos'] = 'sí',
{
color = ColorEtiqueta,
['tipo'] = 'sucesión',
['anterior'] = PokedexGalAnt,
['siguiente'] = PokedexGalSig,
},
},
{tipo="sección",
titulo = 'Datos del banco de voz',
['ocultar_vacíos'] = 'sí',
{'[[Género musical|Género]]', GeneroMusical},
{'[[Tempo|Tempo Óptimo]]', Tempo},
{'[[Rango dinámico|Rango]]', RangoDinamico},
{'Intérprete de voz', VozVocaloid},
{'Desarrollador', Desarrollador},
{'Plataforma', Plataforma},
{'Motor', Motor},
{'licencia', licencia},
{'Estado', EstadoSoftware},
{'Idiomas', Idioma},
},
DatosExtra,
piedetabla = identificadoresExternos,
estilopiedetabla= 'padding-top:10px'
}
return ModuloFicha.infobox(TablaFicha)
end
-- Función para obtener datos de Pokémon desde Wikidata
function obtenerPokedex(frame)
local Pokedex = {} -- Valores a devolver a la ficha
local PokedexDatos = {} -- Datos de la Pokédex por catálogo
-- Etapas evolutivas
local Preevolucion
local Evolucion
local Etapa
-- Nacional / Kanto
local PokedexNacNum
local PokedexNacAnt
local PokedexNacSig
-- Johto
local PokedexJotNum
local PokedexJotAnt
local PokedexJotSig
-- Hoenn
local PokedexHoeNum
local PokedexHoeAnt
local PokedexHoeSig
-- Sinnoh
local PokedexSinNum
local PokedexSinAnt
local PokedexSinSig
-- Teselia
local PokedexTesNum
local PokedexTesAnt
local PokedexTesSig
local PokedexTes2Num
local PokedexTes2Ant
local PokedexTes2Sig
-- Kalos
local PokedexKalMonNum
local PokedexKalMonAnt
local PokedexKalMonSig
local PokedexKalCenNum
local PokedexKalCenAnt
local PokedexKalCenSig
local PokedexKalCosNum
local PokedexKalCosAnt
local PokedexKalCosSig
-- Alola
local PokedexAloNum
local PokedexAloAnt
local PokedexAloSig
-- Galar
local PokedexGalNum
local PokedexGalAnt
local PokedexGalSig
-- Obtener el número en la Pokédex según el catálogo
local PN = elementoTabla(Entidad, 'claims', 'P1685')
if PN then
for i,v in pairs(PN) do
Numero = elementoTabla(v, 'mainsnak', 'datavalue', 'value')
Catalogo = elementoTabla(v, 'qualifiers','P972', 1, 'datavalue', 'value', 'id')
Anterior = obtenerEtiquetaWikidata(mw.wikibase.getEntity(elementoTabla(v, 'qualifiers','P155', 1, 'datavalue', 'value', 'id')))
if Anterior then
Anterior = enlazar(frame, Anterior)
else
Anterior = '--'
end
Siguiente = obtenerEtiquetaWikidata(mw.wikibase.getEntity(elementoTabla(v, 'qualifiers','P156', 1, 'datavalue', 'value', 'id')))
if Siguiente then
Siguiente = enlazar(frame, Siguiente)
else
Siguiente = '--'
end
PokedexDatos[Catalogo] = {Numero, Anterior, Siguiente}
end
end
-- Pokédex Nacional
if PokedexDatos['Q18086661'] then
PokedexNacNum = PokedexDatos['Q20005020'][1]
PokedexNacAnt = PokedexDatos['Q20005020'][2]
PokedexNacSig = PokedexDatos['Q20005020'][3]
end
-- Pokédex de Kanto
if PokedexDatos['Q20005020'] then
PokedexNacNum = PokedexDatos['Q20005020'][1]
PokedexNacAnt = PokedexDatos['Q20005020'][2]
PokedexNacSig = PokedexDatos['Q20005020'][3]
end
-- Pokédex de Johto
if PokedexDatos['Q11310550'] then
PokedexJotNum = PokedexDatos['Q11310550'][1]
PokedexJotAnt = PokedexDatos['Q11310550'][2]
PokedexJotSig = PokedexDatos['Q11310550'][3]
end
-- Pokédex de Johto revisada
if PokedexDatos['Q18099930'] then
PokedexJotNum = PokedexDatos['Q18099930'][1]
PokedexJotAnt = PokedexDatos['Q18099930'][2]
PokedexJotSig = PokedexDatos['Q18099930'][3]
end
-- Pokédex de Hoenn
if PokedexDatos['Q18086665'] then
PokedexHoeNum = PokedexDatos['Q18086665'][1]
PokedexHoeAnt = PokedexDatos['Q18086665'][2]
PokedexHoeSig = PokedexDatos['Q18086665'][3]
end
-- Pokédex de Hoenn revisada
if PokedexDatos['Q18922463'] then
PokedexHoeNum = PokedexDatos['Q18922463'][1]
PokedexHoeAnt = PokedexDatos['Q18922463'][2]
PokedexHoeSig = PokedexDatos['Q18922463'][3]
end
-- Pokedex de Sinnoh
if PokedexDatos['Q18086666'] then
PokedexSinNum = PokedexDatos['Q18086666'][1]
PokedexSinAnt = PokedexDatos['Q18086666'][2]
PokedexSinSig = PokedexDatos['Q18086666'][3]
end
-- Pokédex de Teselia
if PokedexDatos['Q18086667'] then
PokedexTesNum = PokedexDatos['Q18086667'][1]
PokedexTesAnt = PokedexDatos['Q18086667'][2]
PokedexTesSig = PokedexDatos['Q18086667'][3]
end
-- Pokédex de Teselia revisada
if PokedexDatos['Q18100125'] then
PokedexTesNum = PokedexDatos['Q18100125'][1]
PokedexTesAnt = PokedexDatos['Q18100125'][2]
PokedexTesSig = PokedexDatos['Q18100125'][3]
end
-- Kalos Montaña
if PokedexDatos['Q18089575'] then
PokedexKalMonNum= PokedexDatos['Q18089575'][1]
PokedexKalMonAnt= PokedexDatos['Q18089575'][2]
PokedexKalMonSig= PokedexDatos['Q18089575'][3]
end
-- Kalos Centro
if PokedexDatos['Q18086671'] then
PokedexKalCenNum= PokedexDatos['Q18086671'][1]
PokedexKalCenAnt= PokedexDatos['Q18086671'][2]
PokedexKalCenSig= PokedexDatos['Q18086671'][3]
end
-- Kalos Costa
if PokedexDatos['Q18089574'] then
PokedexKalCosNum= PokedexDatos['Q18089574'][1]
PokedexKalCosAnt= PokedexDatos['Q18089574'][2]
PokedexKalCosSig= PokedexDatos['Q18089574'][3]
end
-- Alola
if PokedexDatos['Q25336664'] then
PokedexAloNum = PokedexDatos['Q25336664'][1]
PokedexAloAnt = PokedexDatos['Q25336664'][2]
PokedexAloSig = PokedexDatos['Q25336664'][3]
end
-- Galar
if PokedexDatos['Q75387698'] then
PokedexGalNum = PokedexDatos['Q75387698'][1]
PokedexGalAnt = PokedexDatos['Q75387698'][2]
PokedexGalSig = PokedexDatos['Q75387698'][3]
end
-- Obtener las etapas evolutivas
local FPD = elementoTabla(Entidad, 'claims', 'P361') or {}
for i,v in ipairs(FPD) do
FormaParteDe = mw.wikibase.getEntity(elementoTabla(v, 'mainsnak', 'datavalue', 'value', 'id'))
if FormaParteDe then
if elementoTabla(FormaParteDe, 'claims', 'P31', 1, 'mainsnak', 'datavalue', 'value', 'id') == 'Q15795637' then
Preevolucion = obtenerEtiquetaWikidata(mw.wikibase.getEntity(elementoTabla(v, 'qualifiers','P155', 1, 'datavalue', 'value', 'id')))
Evolucion = obtenerEtiquetaWikidata(mw.wikibase.getEntity(elementoTabla(v, 'qualifiers','P156', 1, 'datavalue', 'value', 'id')))
Etapa = elementoTabla(v, 'qualifiers','P1545', 1, 'datavalue', 'value') or argumentos{'etapa', 'stage'}
if DatosPokemon['etapas'][Etapa] then Etapa = DatosPokemon['etapas'][Etapa] end
break
end
end
end
-- Obtener el tipo de Pokémon
local PokemonTipo = {}
local TipoPrimario = argumentos{'tipo', 'type'}
local TipoSecundario = argumentos{'tipo2', 'type2'}
local TipoTerciario = argumentos{'tipo3', 'type3'}
local ColorFondoPrimario
local ColorTextoPrimario
local ColorEtiquetaPrimario
local ColorFondoSecundario
local ColorTextoSecundario
local ColorEtiquetaSecundario
local ColorFondoTerciario
local ColorTextoTerciario
local ColorEtiquetaTerciario
if not TipoPrimario then
local PT = elementoTabla(Entidad, 'claims', 'P31')
if PT then
for i,v in ipairs(PT) do
Tipo = elementoTabla(v, 'mainsnak', 'datavalue', 'value', 'id')
if elementoTabla(v, 'qualifiers','P518', 1, 'datavalue', 'value', 'id') == 'Q25931659' then
TipoPrimario = Tipo
end
if elementoTabla(v, 'qualifiers','P518', 1, 'datavalue', 'value', 'id') == 'Q25931668' then
TipoSecundario = Tipo
end
end
end
end
if DatosPokemon['tipos'][TipoPrimario] then
TipoPrimario = DatosPokemon['tipos'][TipoPrimario][1]
ColorFondoPrimario = DatosPokemon['tipos'][TipoPrimario][2]
ColorTextoPrimario = DatosPokemon['tipos'][TipoPrimario][3]
ColorEtiquetaPrimario = DatosPokemon['tipos'][TipoPrimario][4]
table.insert(PokemonTipo,'<span style="border-radius:8px;padding:4px;background-color:' .. ColorFondoPrimario .. ';color:' .. ColorTextoPrimario .. ';" title="Pokémon tipo ' .. TipoPrimario .. '">' .. TipoPrimario)
end
if DatosPokemon['tipos'][TipoSecundario] then
TipoSecundario = DatosPokemon['tipos'][TipoSecundario][1]
ColorFondoSecundario = DatosPokemon['tipos'][TipoSecundario][2]
ColorTextoSecundario = DatosPokemon['tipos'][TipoSecundario][3]
ColorEtiquetaSecundario = DatosPokemon['tipos'][TipoSecundario][4]
table.insert(PokemonTipo,'<span style="border-radius:8px;padding:5px;background-color:' .. ColorFondoSecundario .. ';color:' .. ColorTextoSecundario .. ';" title="Pokémon tipo ' .. TipoSecundario .. '">' .. TipoSecundario)
end
if DatosPokemon['tipos'][TipoTerciario] then
TipoTerciario = DatosPokemon['tipos'][TipoTerciario][1]
ColorFondoTerciario = DatosPokemon['tipos'][TipoTerciario][2]
ColorTextoTerciario = DatosPokemon['tipos'][TipoTerciario][3]
ColorEtiquetaTerciario = DatosPokemon['tipos'][TipoTerciario][4]
table.insert(PokemonTipo,'<span style="border-radius:8px;padding:5px;background-color:' .. ColorFondoTerciario .. ';color:' .. ColorTextoTerciario .. ';" title="Pokémon tipo ' .. TipoTerciario .. '">' .. TipoTerciario)
end
if next(PokemonTipo) then Pokedex['tipo'] = table.concat(PokemonTipo, ' ') end
-- :: General
Pokedex['generacion'] = argumentos{'generación', 'generation'}
Pokedex['especie'] = argumentos{'especie', 'species'}
Pokedex['preevolución'] = argumentos{'preevolución', 'evolvesfrom'} or Preevolucion
Pokedex['evolución'] = argumentos{'evolución', 'evolvesto'} or Evolucion
Pokedex['etapa'] = Etapa
Pokedex['dif_genero'] = argumentos{'diferencia'}
-- :: Colores
Pokedex['colortitulo'] = ColorFondoPrimario
Pokedex['colortexto'] = ColorTextoPrimario
Pokedex['coloretiqueta'] = ColorEtiquetaPrimario
-- :: Catálogo
Pokedex['pokedex_nac'] = argumentos{'numero', 'número', 'number'} or PokedexNacNum
Pokedex['anterior_nac'] = argumentos{'anterior', 'preceding'} or PokedexNacAnt
Pokedex['siguiente_nac'] = argumentos{'siguiente', 'following'} or PokedexNacSig
Pokedex['pokedex_jot'] = argumentos{'johtonumero'} or PokedexJotNum
Pokedex['anterior_jot'] = argumentos{'johtoanterior'} or PokedexJotAnt
Pokedex['siguiente_jot'] = argumentos{'johtosiguiente'} or PokedexJotSig
Pokedex['pokedex_hoe'] = argumentos{'hoennumero'} or PokedexHoeNum
Pokedex['anterior_hoe'] = argumentos{'hoennanterior'} or PokedexHoeAnt
Pokedex['siguiente_hoe'] = argumentos{'hoennsiguiente'} or PokedexHoeSig
Pokedex['pokedex_sin'] = argumentos{'shinounumero'} or PokedexSinNum
Pokedex['anterior_sin'] = argumentos{'shinouanterior'} or PokedexSinAnt
Pokedex['siguiente_sin'] = argumentos{'shinousiguiente'} or PokedexSinSig
Pokedex['pokedex_tes'] = argumentos{'unovanumero', 'teselianumero'} or PokedexTesNum
Pokedex['anterior_tes'] = argumentos{'unovaanterior', 'teseliaanterior'} or PokedexTesAnt
Pokedex['siguiente_tes'] = argumentos{'unovasiguiente', 'teseliasiguiente'} or PokedexTesSig
Pokedex['pokedex_te2'] = argumentos{'unovanumero2', 'teselianumero2'} or PokedexTes2Num
Pokedex['anterior_te2'] = argumentos{'unovaanterior2', 'teseliaanterior2'} or PokedexTes2Ant
Pokedex['siguiente_te2'] = argumentos{'unovasiguiente2', 'teseliasiguiente2'} or PokedexTes2Sig
Pokedex['pokedex_kal_mon'] = argumentos{'kalosmontañanumero'} or PokedexKalMonNum
Pokedex['anterior_kal_mon'] = argumentos{'kalosmontañaanterior'} or PokedexKalMonAnt
Pokedex['siguiente_kal_mon']= argumentos{'kalosmontañasiguiente'} or PokedexKalMonSig
Pokedex['pokedex_kal_cen'] = argumentos{'kaloscentronumero'} or PokedexKalCenNum
Pokedex['anterior_kal_cen'] = argumentos{'kaloscentroanterior'} or PokedexKalCenAnt
Pokedex['siguiente_kal_cen']= argumentos{'kaloscentrosiguiente'} or PokedexKalCenSig
Pokedex['pokedex_kal_cos'] = argumentos{'kaloscostanumero'} or PokedexKalCosNum
Pokedex['anterior_kal_cos'] = argumentos{'kaloscostaanterior'} or PokedexKalCosAnt
Pokedex['siguiente_kal_cos']= argumentos{'kaloscostasiguiente'} or PokedexKalCosSig
Pokedex['pokedex_alo'] = argumentos{'alolanumero'} or PokedexAloNum
Pokedex['anterior_alo'] = argumentos{'alolaanterior'} or PokedexAloAnt
Pokedex['siguiente_alo'] = argumentos{'alolasiguiente'} or PokedexAloSig
Pokedex['pokedex_gal'] = argumentos{'galarnumero'} or PokedexGalNum
Pokedex['anterior_gal'] = argumentos{'galaranterior'} or PokedexGalAnt
Pokedex['siguiente_gal'] = argumentos{'galarsiguiente'} or PokedexGalSig
return Pokedex
end
-- Función, propiedad() personalizada
function propiedad(idPropiedad, opciones, entidad)
if not entidad then entidad = Entidad end
if entidad and entidad.claims and entidad.claims[idPropiedad] then
if not opciones then
opciones = {['linkback']='sí'}
end
opciones['idioma'] = 'es'
local ValorPosicional = 1
if type(opciones['valor_posicional']) == 'number' then ValorPosicional = opciones['valor_posicional'] end
local ValorPosicionalCalif = 1
if type(opciones['valor_posicional_calif']) == 'number' then ValorPosicional = opciones['valor_posicional_calif'] end
local Calificador = opciones['calificador']
local Obj = (function()
local Obj = (function()
local Obj = elementoTabla(entidad, 'claims', idPropiedad)
if type(opciones['valor_posicional']) == 'number' then return elementoTabla(Obj, opciones['valor_posicional']) end
if opciones['valor_posicional'] == 'último' then return elementoTabla(Obj, #Obj) end
end)()
if Calificador then
Obj = (function()
local Obj = elementoTabla(Obj, 'qualifiers', Calificador)
if type(opciones['valor_posicional_calif']) == 'number' then return elementoTabla(Obj, opciones['valor_posicional_calif']) end
if opciones['valor_posicional_calif'] == 'último' then return elementoTabla(Obj, #Obj) end
end)()
end
end)()
Tipo = elementoTabla(Obj, 'datavalue', 'type')
if opciones['formato'] == 'archivo' then
if not opciones['uno'] then opciones['uno'] = 'último' end
opciones['ordenar'] = 'por fecha'
if Calificador then return elementoTabla(Obj, 'datavalue', 'value') end
end
-- Devolver el ID de la entidad, para propiedades de entidad
if opciones['formato'] == 'entidadID' then
return elementoTabla(Obj, 'datavalue', 'value', 'id')
end
if opciones['formato'] == 'cadena' then
opciones['linkback'] = 'no'
if Tipo == 'string' then
return elementoTabla(Obj, 'datavalue', 'value')
end
end
if opciones['formato'] == 'número' then
if Tipo == 'quantity' then
return formatoNumero(elementoTabla(Obj, 'datavalue', 'value', 'amount'))
end
end
-- Valores cuya unidad deba ir a la derecha, separada de un espacio
if opciones['formato'] == 'unidad' then
if elementoTabla(entidad, 'claims', idPropiedad, 2, 'mainsnak', 'datavalue') then
return formatoNumero(elementoTabla(entidad, 'claims', idPropiedad, 1, 'mainsnak', 'datavalue', 'value', 'amount')) .. ' - ' .. numeroUnidad(elementoTabla(entidad, 'claims', idPropiedad, 2, 'mainsnak', 'datavalue'), opciones)
else
return numeroUnidad(elementoTabla(entidad, 'claims', idPropiedad, 1, 'mainsnak', 'datavalue'), opciones)
end
end
-- Invocar a la función fallback si no se cumplen las condiciones anteriores
opciones.entityId = entidad.id
opciones.propiedad = idPropiedad
return ModuloWikidata.getPropiedad(opciones, entidad.claims[idPropiedad])
end
end
function seccionDesplegable(frame, titulo, lista, expandir)
if not lista then
return
end
local expandir = desplegar or ''
if expandir then expandir = 'sí' end
return frame:preprocess('{{Sección desplegable|estilotitulo=text-align:left;background-color:#eeeeff;padding:2px 0 2px 0|estilodatos=text-align:left|título=' .. titulo .. '|datos='.. lista .. '|expandir=' .. expandir .. '}}')
end
-- Quick-and-dirty
function enlazar(frame, enlace)
if frame:preprocess('{{#ifexist:' .. enlace .. '|1}}') == '1' then enlace = '[[' .. enlace .. ']]' end
return enlace
end
return p