Modul:Chyba

Z Wikizpráv

Dokumentaci tohoto modulu lze vytvořit na stránce Nápověda:Modul:Chyba

-- @brief
--  Backend for {{Chyba}}.
-- 
-- @details
--  Handles the error message and categorizes pages with errors.
-- 
-- @author
--  [[meta:User:Danny B.]]
local _module = {}
----------------------------------------


local Error = require( "Module:Error" )


-- @brief
--  Write the error message and error category.
-- 
-- @param
--  frame The current frame object
-- 
-- @return
--  Preprocessed wikitext
function _module.print( frame )
	
	local output = ""
	local parentFrame = frame:getParent()
	local templateArgs = parentFrame.args
	
	local errorData = {}
	
	
	for key, value in pairs( frame.args ) do
		errorData[key] = value
	end
	
	if not next( errorData ) then
		errorData = {
			template = templateArgs["šablona"],
			text = templateArgs["text"],
			category = templateArgs["kategorie"]
		}
	end
	
	output = output .. Error.getText( errorData )
	
	output = frame:preprocess( output )
	
	return output
	
end


----------------------------------------
return _module