Módulo:Ver também se existe

Fonte: Enciclopédia de conhecimento da Igreja de Deus
Revisão em 01h36min de 14 de maio de 2024 por Jaewoo (discussão | contribs) (Criou a página com "--v1.0 local p = {} function doesPageExist(thisPage) local thisPage = mw.title.new( thisPage ) if thisPage == nil then return false end if thisPage.exists then return true end return false end function p.main(frame) local rawpages = {} local nvalid = 0 for i, v in ipairs(mw.getCurrentFrame():getParent().args) do if (v ~= nil) then local thisArg = mw.text.trim(v) if (thisArg ~= "") then if ( doesPageExist(thisArg)) then table.insert(r...")
(dif) ← Revisão anterior | Revisão atual (dif) | Revisão seguinte → (dif)
Saltar para a navegação Saltar para a pesquisa

A documentação para este módulo pode ser criada na página Módulo:Ver também se existe/doc

--[[ v1.0
]]
local p = {}
function doesPageExist(thisPage)
	local thisPage = mw.title.new( thisPage )
	if thisPage == nil then
		return false
	end
	if thisPage.exists then
		return true
	end
	return false
end
function p.main(frame)
	local rawpages = {}
	local nvalid = 0
	for i, v in ipairs(mw.getCurrentFrame():getParent().args) do
		if (v ~= nil) then
			local thisArg = mw.text.trim(v)
			if (thisArg ~= "") then
				if ( doesPageExist(thisArg)) then
					table.insert(rawpages, thisArg)
					nvalid = nvalid + 1
				end
			end
		end
	end
	if (nvalid == 0) then
		return ""
	end
	local mLabelledList = require('Módulo:Labelled list hatnote')
	local pages = mLabelledList._labelledList(rawpages, "Ver também", "")
	return pages
end
return p