For faster navigation, this Iframe is preloading the Wikiwand page for Modul:CheckParameters.

Modul:CheckParameters

local p = {}

local function inSequence(param, sequence)
	for _, value in pairs(sequence) do
		if param == value then
			return true
		end
	end
	return false
end

local function parseTemplateData(content)
	return mw.ustring.match(content, '<templatedata>')
		and mw.text.trim(mw.ustring.match(content, '<templatedata>(.-)</templatedata>'))
end

function p.checkParameters(frame)
	local parent = frame:getParent()
	local template = mw.title.new(parent:getTitle())
	local TemplateDataJSON = parseTemplateData(template:getContent())
	if not TemplateDataJSON then
		local doc = mw.title.new(template.fullText .. '/doc')
		TemplateDataJSON = doc.exists and parseTemplateData(doc:getContent())
	end
	if not TemplateDataJSON then
		mw.log(mw.ustring.format("TemplateData šablony %s nenalezena", template.text))
		return nil
	end

	local TemplateData = mw.text.jsonDecode(TemplateDataJSON)
	local used_params = parent.args or {}
	local all_params = {}
	if TemplateData.params then
		for param, data in pairs(TemplateData.params) do
			table.insert(all_params, param)
			if data.aliases then
				for _, alias in pairs(data.aliases) do
					table.insert(all_params, alias)
				end
			end
		end
	end
	for param in pairs(used_params) do
		if not inSequence(param, all_params) then
			mw.log(mw.ustring.format('Parametr %s nenalezen v TemplateData šablony %s', param, template.text))
			local relevant_title = 'šabloně ' .. template.text
			if mw.ustring.sub(template.text, 1, 10) == 'Infobox - ' then
				relevant_title = 'infoboxu ' .. mw.ustring.sub(template.text, 11)
			end
			return mw.ustring.format('[[Kategorie:Údržba:Neznámý parametr v %s|%s]]',
				relevant_title, mw.title.getCurrentTitle().text)
		end
	end
	return nil
end

return p
{{bottomLinkPreText}} {{bottomLinkText}}
Modul:CheckParameters
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.

X

Get ready for Wikiwand 2.0 🎉! the new version arrives on September 1st! Don't want to wait?