Dokumentaci tohoto modulu lze vytvořit na stránce Nápověda:Modul:Počet slov

p = {}
function p.print (frame)

	local title
	local parent = frame:getParent()

	if parent and parent.args and parent.args[1] and parent.args[1] ~= "" then
		title = mw.title.new(parent.args[1])
		if not title.exists then
			return "CHYBA: Stránka \"" .. parent.args[1] .. "\" neexistuje"
		end
	else
		title = mw.title.getCurrentTitle()
	end

	local content = title:getContent()
	local data = mw.ustring.match (content, "<!%-%- začátek -%-%->.*<!%-%- konec -%-%->")

	local pocet = 0	
	if data then
		for a, _ in string.gmatch (data, "[[][[][^]]*[]][]]") do
			pocet = pocet + 1
		end
	end
	return pocet
end

return p