Modul „Slovíčko“ slouží pro vytváření odkazu na Wikislovník. Používá se v šabloně {{Slovíčko}}.


-- @brief
--  Backend for {{Slovíčko}}.
-- 
-- @author
--  [[meta:User:Danny B.]]
local _module = {}
----------------------------------------


local Language = require( "Module:Language" )


function _module.print( frame )
	
	local output = ""
	local parentFrame = frame:getParent()
	local templateArgs = parentFrame.args

	local lang = mw.text.trim( templateArgs["1"] or "" )
	local dir = lang == "" or Language:getDirection( lang )

	output = mw.text.trim( templateArgs["2"] or "" )
	if output ~= "" then
		output = mw.text.trim( templateArgs["4"] or output ) .. "|" .. output
		output = "\">[[wikt:" .. mw.text.trim( templateArgs["3"] or "" ) .. ":" .. output  .. "]]</span>"
		output = dir == "rtl" and "\" dir=\"rtl" .. output or output
		output = lang ~= "" and " cizojazycne\" lang=\"" .. lang .. output or output
		output = "<span class=\"slovicko " .. output
	end

	output = frame:preprocess( output )
	
	return output
	
end


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