Module:links/templates

Hello, you have come here looking for the meaning of the word Module:links/templates. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:links/templates, but we will also tell you about its etymology, its characteristics and you will know how to say Module:links/templates in singular and plural. Everything you need to know about the word Module:links/templates you have here. The definition of the word Module:links/templates will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:links/templates, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.

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 process_params = require("Module:parameters").process
local remove = table.remove
local upper = require("Module:string utilities").upper

local export = {}

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

do
	local function get_args(frame)
		-- `compat` is a 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 iargs = frame.args
		iargs.compat = iargs.compat and iargs.compat ~= ""
		iargs.langname = iargs.langname and iargs.langname ~= ""
		iargs.notself = iargs.notself and iargs.notself ~= ""
		local alias_of_4 = {alias_of = 4}
		local boolean = {type = "boolean"}
		local params = {
			 = {required = true, type = "language", default = "und"},
			 = true,
			 = true,
			 = true,
			 = {list = true},
			 = alias_of_4,
			 = true,
			 = true,
			 = true,
			 = {type = "script"},
			 = alias_of_4,
			 = true,
			 = true,
			 = true,
			 = true,
			 = true,
			 = true,
			 = true,
			 = boolean,
		}
		if iargs.compat then
			params = {type = "language", default = "und"}
			remove(params, 1)
			alias_of_4.alias_of = 3
		end
		if iargs.langname then
			params = boolean
		end
		return process_params(frame:getParent().args, params), iargs
	end
	
	-- Used in ] and ].
	function export.l_term_t(frame)
		local m_debug = require("Module:debug")
		
		local args, iargs = get_args(frame)
		local compat = iargs.compat
		local lang = args
		
		-- Tracking for und.
		if not compat and lang:getCode() == "und" then
			m_debug.track("link/und")
		end
		
		local term = args
		local alt = args
		term = term ~= "" and term or nil
		
		if not term and not alt and iargs.demo then
			term = iargs.demo
		end
		
		local langname = iargs.langname and (
			args.w and lang:makeWikipediaLink() or
			lang:getCanonicalName()
		) or nil
		
		if langname and term == "-" then
			return langname
		end
		-- Forward the information to full_link
		return (langname and langname .. " " or "") .. require("Module:links").full_link(
			{
				lang = lang,
				sc = args.sc,
				track_sc = true,
				term = term,
				alt = alt,
				gloss = args,
				id = args,
				tr = args,
				ts = args,
				genders = args,
				pos = args,
				lit = args,
				accel = args and {
					form = args,
					translit = args,
					lemma = args,
					lemma_translit = args,
					gender = args,
					nostore = args,
				} or nil
			},
			iargs.face,
			not iargs.notself
		)
	end
end

-- Used in ].
do
	local function get_args(frame)
		return process_params(frame:getParent().args, {
			 = {required = true, type = "language", default = "und"},
			 = {allow_empty = true},
			 = true,
			 = true,
			 = {type = "script"},
		})
	end
	
	function export.ll(frame)
		local args = get_args(frame)
		local lang = args
		local sc = args
		local term = args
		term = term ~= "" and term or nil
		
		return require("Module:links").language_link{
			lang = lang,
			sc = sc,
			term = term,
			alt = args,
			id = args.id
		} or "<small></small>" ..
			require("Module:utilities").format_categories(
				{lang:getFullName() .. " term requests"},
				lang, "-", nil, nil, sc
			)
	end
end

function export.def_t(frame)
	local args = process_params(frame:getParent().args, {
		 = {required = true, default = ""},
	})
	
	local lang = require("Module:languages").getByCode("en")
	local sc = require("Module:scripts").getByCode("Latn")
	
	return require("Module:script utilities").tag_text(require("Module:links").embedded_language_links{
		term = args,
		lang = lang,
		sc = sc
	}, lang, sc)
end


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

function export.cap_t(frame)
	local args = process_params(frame:getParent().args, {
		 = {required = true},
		 = true,
		 = {type = "language", default = "en"},
	})
	
	local term = args
	
	return require("Module:links").full_link{
		lang = args.lang,
		term = term,
		alt = term:gsub("^.*", upper) .. (args or "")
	}
end

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

return export