Wowpedia

We have moved to Warcraft Wiki. Click here for information and the new URL.

READ MORE

Wowpedia
Advertisement

Documentation for this module may be created at Module:API info/group/doc

local flavor_module = require("Module:API_info/flavor")
local elink_module = require("Module:API_info/elink")
local patch_module = require("Module:API_info/patch")
local m = {}

local function GetFlavorText(name, args)
	local data = flavor_module:GetFlavors(name, args.t)
	if data then
		local t = {}
		for _, info in pairs(data) do
			table.insert(t, info.icon)
		end
		return table.concat(t)
	end
end

local function GetElinkText(name, args)
	local data = elink_module:GetElinks(name, args.t)
	if data then
		local t = {}
		for _, info in pairs(data) do
			table.insert(t, info.icon)
		end
		return table.concat(t, "  ")
	end
end

local function GetMultiList(args)
	local s = '{| class="darktable" cellpadding=5' 
	for _, name in ipairs(args) do
		local elinks = GetElinkText(name, args) or ""
		local flavors = GetFlavorText(name, args) or ""
		s = s..string.format("\n|-\n| %s || <code>%s</code> || %s", elinks, name, flavors)
		local added, removed = patch_module:GetPatches(name, args.t)
		if #added > 0 then
			s = s.." || + "..added
			if #removed > 0 then
				s = s.." || - "..removed
			end
		end
	end
	s = s.."\n|}"
	return s
end

function m.main(f)
	f:callParserFunction("#vardefine", "hasMultiApi", "some test value")
	return GetMultiList(f.args)
end

return m
Advertisement