Modul:links/andozalar

Vikilug‘atdan olingan

l_term_t[tahrirlash]

{{[[Andoza:#invoke:links/andozalar|#invoke:links/andozalar]]|l_term_t}}

Bu andozalari tomonidan, deyiladi {{l}}, {{m}} va {{term}}. Bu Andoza parametrlarini to'playdi, keyin ish eng qilsa full_link chaqiradi.


local m_links = require("Module:links")

local export = {}

local params = {
	[1] = {required = true},
	[2] = {},
	[3] = {},
	[4] = {alias_of = "gloss"},
	["g"] = {list = true},
	["gloss"] = {},
	["id"] = {},
	["lit"] = {},
	["pos"] = {},
	["tr"] = {},
	["sc"] = {},
}

-- Used in [[Template:l]] and [[Template:m]]
function export.l_term_t(frame)
	local face = frame.args["face"]
	local allowSelfLink = frame.args["notself"]; allowSelfLink = not allowSelfLink or allowSelfLink == ""
	
	local params = mw.clone(params)
	
	-- Compatibility mode for {{term}}.
	-- If given a nonempty value, the function uses tili= to specify the
	-- language, and all the positional parameters shift one number lower.
	local compat = (frame.args["compat"] or "") ~= ""
	
	if compat then
		params["tili"] = {},
		table.remove(params, 1)
	end
	
	local args = require("Module:parameters").process(frame:getParent().args, params)
	
	local tili = args[compat and "tili" or 1]
	
	-- Tracking for missing language or und
	if not tili then
		require("Module:debug").track("link/no tili")
	elseif tili == "va" then
		require("Module:debug").track("link/und")
	end
	
	tili = tili or "und"
	local sc = args["sc"]
	
	local term = args[(compat and 1 or 2)]
	local alt = args[(compat and 2 or 3)]
	local id = args["id"]
	
	local tr = args["tr"]
	local gloss = args["gloss"]
	local pos = args["pos"]
	local lit = args["lit"]
	local genders = args["g"]
	
	-- Check parameters
	tili = require("Module:tili").getByCode(tili) or error("The language code \"" .. tili .. "\" is not valid.")
	sc = (sc and (require("Module:scripts").getByCode(sc) or error("The script code \"" .. sc .. "\" is not valid.")) or nil)
	
	if not term and not alt and mw.title.getCurrentTitle().nsText == "Andoza" then
		term = "term"
	end
	
	-- Forward the information to full_link
	return m_links.full_link(term, alt, tili, sc, face, id, {tr = tr, genders = genders, gloss = gloss, pos = pos, lit = lit}, allowSelfLink)
end

function export.ll(frame)
	local args = frame:getParent().args
	
	local text = args[2]
	local alt = args[3]
	if text == "" then return alt or "" end
	if alt == "" then alt = nil end
	
	local tili = args[1]
	tili = require("Module:tili").getByCode(tili) or error("The language code \"" .. tili .. "\" is not valid.")
	
	local id = args["id"]; if id == "" then id = nil end
	local allowSelfLink = args["allowSelfLink"]; allowSelfLink = not not (allowSelfLink and allowSelfLink ~= "")
	
	return m_links.language_link(text, alt, tili, id, allowSelfLink)
end

return export