Module:Sandbox/Rchard2scout/wpbsh

Revision as of 13:50, 8 January 2021 by imported>Rchard2scout (create proof of concept)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:Sandbox/Rchard2scout/wpbsh/doc

local p = {} --p stands for package

function p.test( frame )
	count = countBanners( frame )
	if count >= 6 then
		doCollapse = "yes"
	else
		doCollapse = "no"
	end
	return frame:expandTemplate{ title='WikiProject banner shell', args = { collapsed = doCollapse, frame.args[1] } }
end

function countBanners( frame )
	_, count = string.gsub(frame.args[1], "wpb%-header", "")
	return count
end

return p