From Wikipedia, the free encyclopedia
This is the current revision of this page, as edited by imported>Aram at 23:14, 3 May 2024 . The present address (URL) is a permanent link to this version.Revision as of 23:14, 3 May 2024 by imported>Aram (diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation
Jump to search
%5B%5BWikipedia%3ATemplates+for+discussion%2FLog%2F2025+December+18%23Module%3AInternalLinkCounter%5D%5D
-- This Lua module provides a function to count the number of internal links in a given wikitext.
-- This is used by [[Template:InternalLinkCounter]].
local p = {}
-- Function to count the number of internal links in the provided wikitext.
function p.main(frame)
local text = frame.args[1] or ""
local count = 0
-- Iterating through the wikitext to find internal link patterns.
for link in mw.ustring.gmatch(text, "%[%[([^%]]+)%]%]") do
count = count + 1
end
-- Returning the total count of internal links.
return count
end
-- Returning the module table.
return p