Modul:Počet odkazů
Dokumentaci tohoto modulu lze vytvořit na stránce Modul:Počet odkazů/Dokumentace
p = {}
function p.print (frame)
local title
if frame:getParent().args[1] and frame:getParent().args[1] ~= "" then
title = mw.title.new( frame:getParent().args[1])
else
title = mw.title.getCurrentTitle()
end
if title.exists then
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
else
return "CHYBA: Stránka \"" .. frame:getParent().args[1] .. "\" neexistuje"
end
end
return p