La documentación para este módulo puede ser creada en Módulo:Pachinas/doc

local pachinas = {}


-- Módulos y funciones externos
local obtenerArgumentos = require('Módulo:Argumentos').obtenerArgumentos
local enTabla           = require('Módulo:Tablas').en

-- Constants
-- Veyer Módulo:Citas/Configuración		citation_config.uncategorized_namespaces.
-- Espacios de nombres pa os que no se categorizan automaticament os suyos articlos
pachinas.espaciosNoCategorizables = { 'Usuario', 'Usuaria', 'Discusión', 'Descusión usuario', 'Descusión usuaria', 'Descusión Wikipedia', 'Descusión archivo', 
	'Descusión plantilla', 'Descusión aduya', 'Descusión categoría', 'Descusión portal', 'Book_talk', 'Draft', 'Draft_talk', 'Education_Program_talk', 
	'Descusión módulo', 'Descusión MediaWiki', 'Biquipedia', 'Biquiprochecto', 'Descusión Wikipedia:Biquiprochecto' }

function pachinas.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 pachinas.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 pachinas.nombrePachina(opcions)
	nombrePachina = mw.title.getCurrentTitle().text 
	
	-- Eliminar o texto entre parentesi
	if opcions and opcions.desambigar == 'sí' then
		nombrePachina = mw.ustring.gsub(nombrePachina,'%s%(.*%)','')
	end
      
	return nombrePachina
end

function pachinas.sePuetCategorizar()
	if enTabla(pachinas.espaciosNoCategorizables, mw.title.getCurrentTitle().nsText) then
		return false
	else
		return true
	end
end

function pachinas.obtenerSubpachinas(frame)
	local argumentos = obtenerArgumentos(frame)
	local nombrePachina = argumentos['pachina'] or argumentos['pachina'] 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/' .. nombrePachina .. parametroTruncar .. '}}')
	
	return lista
end

return pachinas