Diferencia entre revisiones de «Módulo:Wikidata»
Corregir comportamiento de |calificador= vs |calificativo= |
Comentarios |
||
| Línea 233: | Línea 233: | ||
local tablaOrdenada = {} | local tablaOrdenada = {} | ||
if opciones.propiedad == 'precisión' or opciones.propiedad == 'latitud' or opciones.propiedad == 'longitud' then | -- Resolver alias de propiedad | ||
propiedad = 'P625' | if opciones.propiedad == 'precisión' or opciones.propiedad == 'latitud' or opciones.propiedad == 'longitud' then --latitud, longitud o precisión | ||
-- Tierra | |||
propiedad = 'P625' | |||
-- | -- Luna | ||
if mw.wikibase.getEntityObject() and mw.wikibase.getEntityObject():formatPropertyValues("p376")["value"] == 'Luna' then | |||
propiedad = 'P8981' | |||
end | |||
else | else | ||
propiedad = opciones.propiedad -- En el resto de casos se lee lo dado | propiedad = opciones.propiedad -- En el resto de casos se lee lo dado | ||
| Línea 260: | Línea 260: | ||
end | end | ||
-- Función que separa la cadena de texto 'inputstr' utilizando un separador 'sep' | |||
function split(inputstr, sep) | function split(inputstr, sep) | ||
sep=sep or '%s' | sep=sep or '%s' | ||
| Línea 271: | Línea 272: | ||
end | end | ||
-- Aplicar filtro de calificador | |||
if (opciones.filtroCalificador ~= nil and opciones.filtroCalificador ~= '') then | if (opciones.filtroCalificador ~= nil and opciones.filtroCalificador ~= '') then | ||
local opts = split(opciones.filtroCalificador, ';') | local opts = split(opciones.filtroCalificador, ';') | ||
| Línea 285: | Línea 287: | ||
end | end | ||
-- Aplicar filtro de valor | |||
if (opciones.filtroValor ~= nil and opciones.filtroValor ~= '') then | if (opciones.filtroValor ~= nil and opciones.filtroValor ~= '') then | ||
local opts = split(opciones.filtroValor, ';') | local opts = split(opciones.filtroValor, ';') | ||
| Línea 299: | Línea 302: | ||
end | end | ||
-- Aplicar función de formato | |||
local modulo, funcion | local modulo, funcion | ||
funcion = opciones['valor-función'] or opciones['value-function'] or opciones['funcion'] | funcion = opciones['valor-función'] or opciones['value-function'] or opciones['funcion'] | ||
if funcion then | if funcion then | ||
modulo = modulosTiposComplejos[funcion] | modulo = modulosTiposComplejos[funcion] | ||
| Línea 316: | Línea 318: | ||
end | end | ||
-- | -- Aplicar filtro de mayor rango | ||
if (opciones.rangoMayor == 'sí') then | if (opciones.rangoMayor == 'sí') then | ||
tablaOrdenada = p.filtrarDeclaracionPorRango(tablaOrdenada) | tablaOrdenada = p.filtrarDeclaracionPorRango(tablaOrdenada) | ||
end | end | ||
-- | -- Ordenarsegún el calificador "orden dentro de la serie" | ||
if opciones.ordenar == 'sí' then | if opciones.ordenar == 'sí' then | ||
require('Módulo:Tablas').ordenar(tablaOrdenada, | require('Módulo:Tablas').ordenar(tablaOrdenada, | ||
| Línea 333: | Línea 335: | ||
end | end | ||
--Ordenar | --Ordenar según la fecha. [Véase la función chronosort de :fr:Module:Wikidata/Récup] | ||
if opciones.ordenar == 'por fecha' then | if opciones.ordenar == 'por fecha' then | ||
require('Módulo:Tablas').ordenar(tablaOrdenada, | require('Módulo:Tablas').ordenar(tablaOrdenada, | ||
| Línea 345: | Línea 347: | ||
end | end | ||
-- Si después de todo no queda nada en la tabla retornar | |||
if not tablaOrdenada[1] then | if not tablaOrdenada[1] then | ||
return | return | ||