Module:Count

From the Wikimedia Foundation Governance Wiki
Jump to navigation Jump to search

Usage

{{#invoke:count|staff}}

This will output:

0


local p = {}

function p.staff( frame )
    title = mw.title.new('Template:Staff and contractors')
    page_text = title:getContent()
    local _, heads = string.gsub(page_text, '| head', '')
    local _, members = string.gsub(page_text, '{{staff member', '')
    local _, mascots = string.gsub(page_text, '| position = .-[Mm]ascot', '')
    return heads + members - mascots
end

return p