Module:Categorizer export

From Soyjak Wiki, the free ensoyclopedia
Jump to navigationJump to search
Do NOT ever invoke this module anywhere!

Returns a categorizer's resolved state for a set of arguments as JSON. It is ONLY intended for bots that can use a simple API trick to retrieve the JSON without the result ever being saved to a page.

This module by design is never transcluded, so it will always show no uses.

Usage

Do not use this module anywhere on your own. To try it by hand, paste an invocation into Special:ExpandTemplates.

Output

A single JSON object, whatever the module's _state returns.

The module emits no categories, and it does not apply the categorizer's namespace or nocat checks.


local p = {}
local core = require('Module:Infobox categorizer')

function p.state(frame)
	local args = frame.args
	local name = 'Module:' .. core.trim(args._module)
	local subject = require(name)
	if type(subject._state) ~= 'function' then core.devError('export: ' .. name .. ' has no _state') end

	return mw.text.jsonEncode(subject._state(args))
end

return p