Module:Used by

Module documentation

Powers Template:Used by using the data from Module:Used by/data.json.

If you add a new extension or skins not included in this module for any of the packages and/or wiki farms, add Template:Used by to its documentation page.


require('strict')
local getArgs = require("Module:Arguments").getArgs;
local yesno = require("Module:Yesno");

local data = mw.loadJsonData('Module:Used by/data.json')

local p = {}

function p.flatlist(frame)
	local args = getArgs(frame);
	local title
	if args.title then
		title = mw.title.new(args.title)
	else
		title = mw.title.getCurrentTitle()
	end
	local key
	if title.namespace == 102 then
		key = "extensions"
	else
		key = "skins"
	end
	local ret = ""
	for i, info in ipairs(data) do
		if info[key][title.rootText] ~= nil then
			ret = ret .. "* " .. info.name
			if not yesno(args.nocat) and info[key .. "_cat"] ~= nil then
				ret = ret .. "[[Category:" .. info[key .. "_cat"] .. "{{#translation:}}]]"
			end
			ret = ret .. "\n"
		end
	end
	if #ret == 0 then
		ret = "[[Category:Used by nobody]]"
	end
	return frame:preprocess(mw.text.trim(ret))
end

return p