Jump to content

Module:Transclusion count/sandbox

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Ahecht (talk | contribs) at 04:42, 10 August 2019 (data from query uses underscores). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
local p = {}

function p.main(frame)
	local template = frame.args[2] or mw.title.getCurrentTitle().text
	local index = mw.ustring.upper(mw.ustring.sub(template,1,1))
	local data = mw.loadData('Module:Transclusion_count/data/' .. (mw.ustring.find(index, "%a") and index or "other"))
	return data[mw.ustring.gsub(template, " ", "_")] or frame.args[1] or nil
end

return p