Edición de «Módulo:Wikidata»
Puedes deshacer la edición. Antes de deshacer la edición, comprueba la siguiente comparación para verificar que realmente es lo que quieres hacer, y entonces publica los cambios para así efectuar la reversión.
Revisión actual | Tu texto | ||
Línea 204: | Línea 204: | ||
function p.getPropiedad(opciones, declaracion) | function p.getPropiedad(opciones, declaracion) | ||
local propiedad = {} | local propiedad = {} | ||
local tablaOrdenada = {} | |||
-- Resolver alias de propiedad | -- Resolver alias de propiedad | ||
Línea 221: | Línea 222: | ||
return formatoError( 'property-param-not-provided' ) | return formatoError( 'property-param-not-provided' ) | ||
end | end | ||
if declaracion then | if declaracion then | ||
tablaOrdenada = declaracion | tablaOrdenada = declaracion | ||
elseif | elseif not p.getDeclaraciones(opciones.entityId) then | ||
return formatoError( 'other entity' ) | |||
elseif p.getDeclaraciones(opciones.entityId)[mw.ustring.upper(propiedad)] then | |||
tablaOrdenada = p.getDeclaraciones(opciones.entityId)[mw.ustring.upper(propiedad)] | |||
else | else | ||
return '' | return '' | ||
Línea 242: | Línea 244: | ||
end | end | ||
end | end | ||
-- Aplicar filtro de calificador | -- Aplicar filtro de calificador | ||
Línea 616: | Línea 616: | ||
end | end | ||
return f | return f | ||
end | end | ||
Línea 937: | Línea 904: | ||
local valorWikidata; | local valorWikidata; | ||
if (args.prioridad ~= 'sí' or (args.importar and args.importar == 'no')) and args.valor and args.valor ~= '' then | if (args.prioridad ~= 'sí' or (args.importar and args.importar == 'no')) and args.valor and args.valor ~= '' then | ||
valorWikidata = | valorWikidata = ''; | ||
else | else | ||
local ent = SelecionEntidadPorId(argumentos.entityId) | |||
argumentos.entityId = ent and ent.id or nil | |||
valorWikidata = p.getPropiedad(argumentos, nil); | valorWikidata = p.getPropiedad(argumentos, nil); | ||
end | end | ||
Línea 954: | Línea 920: | ||
and string.upper(args.propiedad) ~= 'P109' -- P109: firma de persona | and string.upper(args.propiedad) ~= 'P109' -- P109: firma de persona | ||
and string.upper(args.propiedad) ~= 'P154') then -- P154: logotipo | and string.upper(args.propiedad) ~= 'P154') then -- P154: logotipo | ||
if | if valorWikidata ~= '' and args.valor and args.valor ~= '' then | ||
categorias = '[[Categoría:Wikipedia:Artículos con datos locales]]' | categorias = '[[Categoría:Wikipedia:Artículos con datos locales]]' | ||
elseif valorWikidata and valorWikidata == '' and args.valor and args.valor ~= '' and | elseif valorWikidata and valorWikidata == '' and args.valor and args.valor ~= '' and | ||
(not args.calificador or args.calificador == '') and | (not args.calificador or args.calificador == '') and | ||
(not args.dato or args.dato == '' or args.dato ~= 'fuente') then | (not args.dato or args.dato == '' or args.dato ~= 'fuente')then | ||
categorias = '[[Categoría:Wikipedia:Artículos con datos por trasladar a Wikidata]]' | categorias = '[[Categoría:Wikipedia:Artículos con datos por trasladar a Wikidata]]' | ||
end | end | ||
end | end | ||
if args.prioridad == 'sí' and valorWikidata | if args.prioridad == 'sí' and valorWikidata ~= '' then -- Si se da el valor sí a prioridad tendrá preferencia el valor de Wikidata | ||
if args.importar and args.importar == 'no' and args.valor and args.valor ~= '' then | if args.importar and args.importar == 'no' and args.valor and args.valor ~= '' then | ||
return args.valor .. categorias | return args.valor .. categorias |