Modul:links/templates

Üdvözlöm, Ön a Modul:links/templates szó jelentését keresi. A DICTIOUS-ban nem csak a Modul:links/templates szó összes szótári jelentését megtalálod, hanem megismerheted az etimológiáját, a jellemzőit és azt is, hogyan kell a Modul:links/templates szót egyes és többes számban mondani. Minden, amit a Modul:links/templates szóról tudni kell, itt található. A Modul:links/templates szó meghatározása segít abban, hogy pontosabban és helyesebben fogalmazz, amikor beszélsz vagy írsz. AModul:links/templates és más szavak definíciójának ismerete gazdagítja a szókincsedet, és több és jobb nyelvi forráshoz juttat.

l_term_t

{{#invoke:links/templates|l_term_t}}

This is called by the templates {{l}}, {{m}} and {{term}}. It gathers the template parameters and then calls full_link which does most of the work.


local export = {}

--[=[
	Modules used:
	]
	]
	]
	]
	]
]=]

-- Used in ] and ].
function export.l_term_t(frame)
	local face = frame.args
	local allowSelfLink = frame.args; allowSelfLink = not allowSelfLink or allowSelfLink == ""
	
	local params = {
		 = {required = true},
		 = {},
		 = {},
		 = {alias_of = "gloss"},
		 = {},
		 = {},
		 = {},
		 = {},
		 = {},
		 = {type = "boolean"},
		 = {list = true},
		 = {},
		 = {},
		 = {},
		 = {},
		 = {alias_of = "gloss"},
		 = {},
		 = {},
		 = {},
	}
	
	-- Compatibility mode for {{term}}.
	-- If given a nonempty value, the function uses lang= to specify the
	-- language, and all the positional parameters shift one number lower.
	local compat = (frame.args or "") ~= ""
	
	if compat then
		params = {},
		table.remove(params, 1)
	end
	
	local args = require("Module:parameters").process(frame:getParent().args, params)
	
	local lang = args
	
	-- Tracking for missing language or und
	if not lang then
		require("Module:debug").track("link/no lang")
	elseif lang == "und" then
		require("Module:debug").track("link/und")
	end
	
	lang = lang or "und"
	local sc = args
	
	local term = args
	local alt = args
	
	-- Check parameters
	lang = require("Module:languages").getByCode(lang, 1, "allow etym")
	lang = require("Module:languages").getNonEtymological(lang)
	
	if sc then
		sc = require("Module:scripts").getByCode(sc, "sc")
	end
	
	if not term and not alt and frame.args then
		term = frame.args
	end
	
	-- Forward the information to full_link
	return require("Module:links").full_link( 
		{
			lang = lang, 
			sc = sc, 
			term = term,
			alt = alt, 
			id = args, 
			tr = args,
			ts = args,
			genders = args, 
			gloss = args, 
			pos = args, 
			lit = args,
			accel = args and {
				form = args,
				translit = args,
				lemma = args,
				lemma_translit = args,
				gender = args,
				nostore = args,
			} or nil,
		},
		face,
		allowSelfLink
	)
end

-- Used in ].
function export.ll(frame)
	local params = {
		 = { required = true },
		 = { allow_empty = true },
		 = {},
		 = { type = "boolean", default = false },
		 = {},
	}
	local args = require("Module:parameters").process(frame:getParent().args, params)
	local allowSelfLink = not args
	
	local lang = args
	lang = require("Module:languages").getByCode(lang, 1, "allow etym")
	lang = require("Module:languages").getNonEtymological(lang)

	local text = args
	local alt = args
	if text == "" then
		return alt or ""
	end
	
	local id = args
	
	return require("Module:links").language_link(
		{
			term = text,
			alt = alt,
			lang = lang,
			id = id
		},
		allowSelfLink
	)
end

function export.def_t(frame)
	local params = {
		 = {required = true, default = ""},
	}
	
	local args = require("Module:parameters").process(frame:getParent().args, params)
	
	return require("Module:links").english_links(args)
end


function export.linkify_t(frame)
	local params = {
		 = {required = true, default = ""},
	}
	
	local args = require("Module:parameters").process(frame:getParent().args, params)
	
	args = mw.text.trim(args)
	
	if args == "" or args:find("[[", nil, true) then
		return args
	else
		return " .. "]]"
	end
end

function export.section_link_t(frame)
	local params = {
		 = {},
	}
	
	local args = require("Module:parameters").process(frame:getParent().args, params)
	
	return require("Module:links").section_link(args)
end

function export.language_name_link_t(frame)
	local face = frame.args
	local allowSelfLink = frame.args; allowSelfLink = not allowSelfLink or allowSelfLink == ""
	
	local params = {
		 = {required = true},
		 = {},
		 = {},
		 = {alias_of = "gloss"},
		 = {list = true},
		 = {},
		 = {},
		 = {},
		 = {},
		 = {alias_of = "gloss"},
		 = {},
		 = {},
		 = {},
		 = { type = "boolean", default = false },
	}
	
	-- Compatibility mode for {{term}}.
	-- If given a nonempty value, the function uses lang= to specify the
	-- language, and all the positional parameters shift one number lower.
	local compat = (frame.args or "") ~= ""
	
	if compat then
		params = {},
		table.remove(params, 1)
	end
	
	local args = require("Module:parameters").process(frame:getParent().args, params)
	
	local lang = args
	
	-- Tracking for missing language or und
	if not lang then
		require("Module:debug").track("link/no lang")
	elseif lang == "und" then
		require("Module:debug").track("link/und")
	end
	
	lang = lang or "und"
	local sc = args
	
	local term = args
	local alt = args
	
	-- Check parameters
	lang = require("Module:languages").getByCode(lang, 1, "allow etym")
	local non_etym_lang = require("Module:languages").getNonEtymological(lang)
	
	if sc then
		sc = require("Module:scripts").getByCode(sc, "sc")
	end

	if not term and not alt and frame.args then
		term = frame.args
	end
	
	--[[
		Add a language name, linked to Wikipedia if the Wikipedia parameter is set to true.
		Forward the information to full_link.
	]]
	local language_name = args.w and lang:makeWikipediaLink() or lang:getCanonicalName()
	
	if term == "-" then
		return language_name
	else
		return language_name .. " " ..
			require("Module:links").full_link( 
				{
					lang = non_etym_lang, 
					sc = sc, 
					term = term, 
					alt = alt, 
					id = args, 
					tr = args, 
					ts = args, 
					genders = args, 
					gloss = args, 
					pos = args, 
					lit = args
				},
				face,
				allowSelfLink
			)
	end
end

function export.light_link_t(frame)
	local params = {
		 = { required = true },
		 = { required = true },
		 = {},
		 = {},
		 = { required = true },
	}
	
	local args = frame:getParent().args
	
	for key, value in pairs (params) do
		if value.required then
			if not args then
				error('Parameter "' .. key .. '" is required.')
			end
		end
	end
	
	return require("Module:links").light_link{  
		langCode = args, 
		term = args, 
		alt = args, 
		scCode = args.sc or "Latn",  
		langName = args.langname
	}
end

return export