La documentación para este módulo puede ser creada en Módulo:Wikidata/Formato imagen/doc
local p = {} function p.formatoImagen( valor, opciones, frame, calificativos ) local formato, alineacion, tamanno, descripcion, alternativo, enlace -- Los nombres de los parámetros son los mismos que en Ayuda:Imágenes añadiendo "imagen" if opciones then formato = opciones['formato imagen'] alineacion = opciones['alineación imagen'] tamanno = opciones['tamaño imagen'] descripcion = opciones['descripción imagen'] alternativo = opciones['texto alternativo imagen'] enlace = opciones['enlace imagen'] end if calificativos and not descripcion then local piesDeImagen = calificativos.P2096 local k,pieDeImagen -- Encontrar el pie en español (aquel con datavalue.value.language = "es") if piesDeImagen then for k,pieDeImagen in pairs(piesDeImagen) do if pieDeImagen.datavalue.value.language=='es' then descripcion = pieDeImagen.datavalue.value.text end end end end local resultado = '[[File:' .. valor if formato and formato ~='' then resultado = resultado .. '|' .. formato end if alineacion and alineacion ~='' then resultado = resultado .. '|' .. alineacion end if tamanno and tamanno ~='' then resultado = resultado .. '|' .. tamanno end if alternativo and alternativo ~='' then resultado = resultado .. '|alt=' .. alternativo end if enlace and enlace ~='' then resultado = resultado .. '|link=' .. enlace end if not descripcion or descripcion =='' then return resultado .. ']]' elseif formato == 'thumb' then return resultado .. '|' .. descripcion .. ']]' else return resultado .. ']]' .. '<br /><span>' .. descripcion .. '</span>' end end --***************************************************************************** -- Alias de formatos para utilizar en la plantilla propiedad --***************************************************************************** p['imagen'] = p['formatoImagen'] return p