Diferencia entre revisiones de «Módulo:Wikidata»
Propiedada para coordenadas lunares |
Opción para utilizar shortname en lugar de label |
||
| Línea 768: | Línea 768: | ||
primera = false | primera = false | ||
end | end | ||
opcionesEntidad.enlace | opcionesEntidad.enlace = opciones.enlace | ||
opcionesEntidad.etiqueta = opciones.etiqueta | opcionesEntidad.etiqueta = opciones.etiqueta | ||
opcionesEntidad['debeExistir'] = opciones['debeExistir'] | opcionesEntidad['debeExistir'] = opciones['debeExistir'] | ||
opcionesEntidad.iniciales = opciones.iniciales | |||
if mw.ustring.find(opciones['formatoTexto'],'cursivas', plain ) then | if mw.ustring.find(opciones['formatoTexto'],'cursivas', plain ) then | ||
| Línea 835: | Línea 836: | ||
function p.formatoIdEntidad(idEntidad, opciones) | function p.formatoIdEntidad(idEntidad, opciones) | ||
local enlace = mw.wikibase.sitelink(idEntidad) | local enlace = mw.wikibase.sitelink(idEntidad) | ||
local etiqueta = mw.wikibase. | local label = mw.wikibase.label(idEntidad) | ||
local etiqueta | |||
if opciones.iniciales == 'sí' then | |||
local prop1813 = mw.wikibase.getAllStatements(idEntidad, "P1813") | |||
if prop1813[1] then | |||
local shortname | |||
for k, v in pairs(prop1813) do | |||
if v.mainsnak.datavalue.value.language == 'es' then | |||
local name = v.mainsnak.datavalue.value.text | |||
if (not shortname) or (#name < #shortname) then | |||
shortname = name | |||
end | |||
end | |||
end | |||
etiqueta = shortname | |||
end | |||
else | |||
etiqueta = label | |||
end | |||
return require('Módulo:Wikidata/Formatos').enlazar(enlace, etiqueta, idEntidad, opciones) | return require('Módulo:Wikidata/Formatos').enlazar(enlace, etiqueta, idEntidad, opciones) | ||
end | end | ||