Diferencia entre revisiones de «Módulo:Biocitas»

Contenido eliminado Contenido añadido
Sin resumen de edición
rediseño
Línea 3:
local Entidad = mw.wikibase.getEntityObject() or '' -- Tabla con los datos en Wikidata de la persona.
--parámetros reconocidos. 1 = vigente, 0 = obsoleto
local params ={['texto']=1,['obras']=1,['documentos']=1,['foto']=1,['wikipedia']=0,['wikiquote']=0,['wikinoticias']=0,['commons']=0,['wikispecies']=0,['wikidata']=0,['añomuerte']=1,['siglomuerte']=1,['añonacimiento']=1,['siglonacimiento']=1,['ordenar']=1,['inicial']=1,['añosmuerte']=0,['vivo']=1,['país']=1}
local categorias = ''
 
Línea 94:
 
function crearelemento(frame,argus,lista,nombre,imagen,texto1,texto2) --funcion que agrega enlaces de acuerdo a si existen, o están declarados
local sep = "<span style='display:inline-block; width:2em.5em;'>&nbsp;</span>" --separador de la imagen y el texto
local sitios ={ --esta variable contiene los sitios reconocidos con posibles enlaces, y su nombre técnico
['wikipedia']= 'eswiki',
Línea 100:
['wikinoticias']='eswikinews',
['commons']='commonswiki',
['wikispecies']='specieswiki',
['wikidata']='wikidata'
}
 
Línea 112 ⟶ 113:
if argus[nombre] ~= '' and argus[nombre] ~= nil then
elemento
:wikitext('[[Archivo:'..imagen..'|28px14px|'..nombre..' logo]]'..sep..texto1..argus[nombre]..texto2)
creado = true
elseif sitio~='' and Entidad ~= '' then
if Entidad:getSitelink(sitio) ~= nil and Entidad:getSitelink(sitio) ~= 'wikidata' then
elemento
:wikitext('[[Archivo:'..imagen..'|28px14px|'..nombre..' logo]]'..sep..texto1..Entidad:getSitelink(sitio).id..texto2)
creado = true
elseif Entidad:getSitelink(sitio) ~= nil and Entidad:getSitelink(sitio) ~= '' then
elemento
:wikitext('[[Archivo:'..imagen..'|14px|'..nombre..' logo]]'..sep..texto1..Entidad:getSitelink(sitio)..texto2)
creado = true
elseif sitio =='commonswiki' and propiedad('p373') ~= '' then --categoría en commons
elemento
:wikitext('[[Archivo:'..imagen..'|28px14px|'..nombre..' logo]]'..sep..texto1..'category:'..propiedad('p373')..texto2)
creado = true
end
Línea 257 ⟶ 262:
end
end
 
local html = mw.html.create() -- cuerpo principal de la plantilla
 
local divgrandetabla = html:tag('divtable'):addClass('divgrande') -- div principal que contiene al resto
local divgrande = tabla:tag('tr')--:addClass('divgrande') -- div principal que contiene al resto
-- esqueleto y CSS de los divs internos
local divtitulofoto = divgrande:tag('divtd'):addClass('bc-titulofoto')
local fotomedio = divgrande:tag('divtd'):addClass('bc-fotomedio')
--local mediodivtitulo = divgrandemedio:tag('div'):addClass('bc-mediotitulo')
local enlaces = divgrande:tag('divtd'):addClass('bc-enlaces')
local derechos = divgrandehtml:tag('div'):addClass('bc-derechos')
--variables locales
local sep = "<span style='display:inline-block; width:2em.5em;'>&nbsp;</span>"
local nombre = frame:preprocess("{{PAGENAME}}")
 
--Contenido de los divs secundarios
--divtitulo:wikitext("Ficha de ".. nombre:gsub(' %(.*%)','')) --en el título nombres sin paréntesis
 
-- Foto --
if argus['foto'] ~= '' and argus['foto'] ~= nil then
foto:wikitext("[[File:"..argus['foto'].."|frameless|upright]]")
elseif propiedad('p18') ~= '' then
foto:wikitext("[[File:"..propiedad('p18',{['uno']='sí'}).."|frameless|upright|"..propiedad('p18',{['calificador']='P2096',['idioma']='es'}).."]]")
else
foto:wikitext("[[File:Falta foto.jpg|frameless|upright]]")
end
-- Texto de al medio
if argus['texto'] ~= '' and argus['texto'] ~= nil then
medio:wikitext(argus['texto'])
else
medio:wikitext("Con el parámetro '''''Texto=''''' Puedes incluir la linea de información relativa a sus fechas de nacimiento y defunción así como su lugar. También puedes incluir algún breve apunte.")
end
-- Firma
if propiedad ('p109') ~= '' then
medio:wikitext("<br><br> [[File:"..propiedad('p109',{['uno']='sí'}).."|frameless|upright]]")
end
-- Lista de enlaces
if argus['wikidata'] == '' and Entidad~=nil then
veasetambien = enlaces:tag('div')
argus['wikidata']=Entidad.id --enlazar a elemento wikidata
veasetambien
end
:addClass('bc-titulo2')
 
:wikitext("Véase también...")
---- Enlaces uno por uno ---
if argus['obras'] ~= 'none' then --Obras (aparece siempre por defecto a menos que se defina como none)
Línea 309 ⟶ 295:
if argus['obras'] ~= '' and argus['obras'] ~= nil then
obrasWS
:wikitext("[[Archivo:Wikisource-logo.svg|28px14px|Wikisource logo]]"..sep.."[[:Categoría:Obras literarias de "..argus['obras'].."|Sus obras literariasObras]]")
else
obrasWS
:wikitext("[[Archivo:Wikisource-logo.svg|28px14px|Wikisource logo]]"..sep.."[[:Categoría:Obras literarias de ".. nombre .."|Sus obras literariasObras]]")
end
agregarelemento(enlaces,obrasWS)
Línea 318 ⟶ 304:
-- crea elementos para el resto de los enlaces
crearelemento(frame,argus,enlaces,'documentos','Wikisource-logo.svg','[[:Categoría:Documentos de ','|Sus documentosDocumentos]]')
crearelemento(frame,argus,enlaces,'wikipedia','Wikipedia-logo.svg','[[w:es:','|Biografía]]')
crearelemento(frame,argus,enlaces,'wikiquote','Wikiquote-logo.svg','[[q:es:','|Citas]]')
Línea 324 ⟶ 310:
crearelemento(frame,argus,enlaces,'commons','Commons-logo.svg','[[commons:','|Multimedia]]')
crearelemento(frame,argus,enlaces,'wikispecies','Wikispecies-logo.svg','[[wikispecies:','|Especies descritas]]')
crearelemento(frame,argus,enlaces,'wikidata','Wikidata-logo.svg','[[d:','|Metadatos]]')
if argus['ordenar'] ~= nil then
if argus['inicial'] == nil then
argus['inicial'] = string.upper(string.sub(argus['ordenar'], 1, 1)) --Si no está especificada la inicial, la saca de la primera letra de la llave de ordenado.
end
veasetambien = enlaces:tag('div')
veasetambien
:addClass('bc-titulo2enlace')
:wikitext("◄"..sep.."[[:Categoría:Autores-"..argus['inicial'].."|Autores-"..argus['inicial'].."]]") --enlace a Autores-X
end
--- Índice de autores ---
--indice = enlaces:tag('div')
--indice
-- :addClass('bc-titulo2enlace')
-- :wikitext("[[:Categoría:Autores|<span style='color:#FAFAFA;'>Índice de autores</span>]]")
 
 
 
-- Texto de al medio
if argus['texto'] ~= '' and argus['texto'] ~= nil then
medio:wikitext(argus['texto'])
else
medio:wikitext("Con el parámetro '''''Texto=''''' Puedes incluir la linea de información relativa a sus fechas de nacimiento y defunción así como su lugar. También puedes incluir algún breve apunte.")
end
-- Firma ( aun no se puede conectar con otras Q de wikidata :( )
--if argus['wikidata']== '' then
if propiedad ('p109') ~= '' then
medio:wikitext("<br><br> [[File:"..propiedad('p109',{['uno']='sí'}).."|frameless|uprightcenter|Firma]]")
end
--else
-- if propiedad ('p109',{['entidad']=argus['wikidata']}) ~= '' then
-- medio:wikitext("<br><br> [[File:"..propiedad('p109',{['uno']='sí',['entidad']=argus['wikidata']}).."|frameless|center|Firma]]")
-- end
-- end
 
-- Foto --
if argus['foto'] ~= '' and argus['foto'] ~= nil then
foto:wikitext("[[File:"..argus['foto'].."|frameless|upright99999x150px|center]]")
elseif propiedad('p18') ~= '' then
foto:wikitext("[[File:"..propiedad('p18',{['uno']='sí'}).."|frameless|upright99999x150px|"..propiedad('p18',{['calificador']='P2096',['idioma']='es'}).."|center]]")
else
foto:wikitext("[[File:Falta foto.jpg|frameless|upright99999x150px|center]]")
end
 
-- WIKIDATA! --