Diferencia entre revisiones de «Módulo:Páginas»
wikitves>Agabi10 m (Añadido alias página) |
m (1 revisión importada) |
(No se muestran 2 ediciones intermedias de 2 usuarios) | |
(Sin diferencias)
|
Revisión actual - 22:03 10 mar 2023
La documentación para este módulo puede ser creada en Módulo:Páginas/doc
local paginas = {} -- Módulos y funciones externos local obtenerArgumentos = require('Módulo:Argumentos').obtenerArgumentos local enTabla = require('Módulo:Tablas').en -- Constantes -- Ver Módulo:Citas/Configuración citation_config.uncategorized_namespaces. -- Espacios de nombres para los cuales no se categorizan automáticamente sus artículos paginas.espaciosNoCategorizables = { 'Usuario', 'Usuaria', 'Discusión', 'Usuario_discusión', 'Usuario_Discusión','Usuaria_Discusión', 'Usuaria_discusión', 'Wikipedia_discusión', 'Archivo_discusión', 'Plantilla_discusión', 'Ayuda_discusión', 'Categoría_discusión', 'Portal_Discusión', 'Book_talk', 'Draft', 'Draft_talk', 'Education_Program_talk', 'Módulo_discusión', 'MediaWiki_discusión', 'Wikipedia', 'Wikiproyecto', 'Wikiproyecto_discusión' } function paginas.existe(frame) local articulo if not frame then return end if type(frame) == 'string' then articulo= frame else articulo= obtenerArgumentos(frame)[1] end if not articulo then return end local a= mw.title.new(articulo) if a and a.exists then return a.fullText end end function paginas.existeCategoria(frame) local categoria if not frame then return end if type(frame) == 'string' then categoria = frame else categoria = obtenerArgumentos(frame)[1] end if not categoria then return end local a= mw.title.makeTitle(14, categoria) if a and a.exists then return a.fullText end end function paginas.nombrePagina(opciones) nombrePagina = mw.title.getCurrentTitle().text -- Eliminar el texto entre paréntesis if opciones and opciones.desambiguar == 'sí' then nombrePagina = mw.ustring.gsub(nombrePagina,'%s%(.*%)','') end return nombrePagina end function paginas.sePuedeCategorizar() if enTabla(paginas.espaciosNoCategorizables, mw.title.getCurrentTitle().nsText) then return false else return true end end function paginas.obtenerSubpaginas(frame) local argumentos = obtenerArgumentos(frame) local nombrePagina = argumentos['página'] or argumentos['pagina'] or mw.title.getCurrentTitle().text local truncar = not (argumentos['truncar'] and argumentos['truncar'] == 'no') local parametroTruncar = (truncar and '|stripprefix=1') or '' local lista = frame:preprocess('{{Special:PrefixIndex/' .. nombrePagina .. parametroTruncar .. '}}') return lista end return paginas