Module documentation

Usage

edit
{{#invoke:count|targets|Global message delivery/Targets/Wikidata}}

This will output:

386

local p = {}

--[[Just count the number of occurences of '{{target' found
    in the wikitext content of page specified in parameter 1.
  ]]
function p.targets( frame )
    title = mw.title.new(frame.args[1])
    page_text = title:getContent()
    -- result of substitution is discarded, just keep the number of matches
    local _, occurences = string.gsub(page_text, '{{target', '')
    return occurences
end

return p