Diferencia entre revisiones de «Módulo:Wikidata»

función para adquirir la leyenda de una imagen con parámetros de idioma y de ranking
c.m.
Línea 391: Línea 391:


p.getLeyendaImagen = function(frame)
p.getLeyendaImagen = function(frame)
-- look for named parameter id; if it's blank make it nil
-- busca un un elemento concreto en Wikidata (QID), en caso contrario que sea nil
local id = frame.args.id
local id = frame.args.id
if id and (#id == 0) then
if id and (#id == 0) then
Línea 406: Línea 406:
-- el primer parámetro sin nombrar es el parámetro local, si se declara
-- el primer parámetro sin nombrar es el parámetro local, si se declara
local input_parm = mw.text.trim(frame.args[1] or "")
local input_parm = mw.text.trim(frame.args[1] or "")
if input_parm == "FETCH_WIKIDATA" then
if input_parm == "FETCH_WIKIDATA" or input_parm == "" or input_parm == nil then
local ent = mw.wikibase.getEntityObject(id)
local ent = mw.wikibase.getEntityObject(id)
local imgs
local imgs