ક_શબ્દ_અનુ

ફેરફાર કરો

<સંકેત રીત="white-space:nowrap">{{#invoke:કડીઓ|ક_શબ્દ_અનુ}}</સંકેત>

This is called by the templates {{}} and {{શબ્દ}}. It gathers the template parameters and then calls <સંકેત>full_link</સંકેત> which does most of the work.


local m_links = require("Module:કડીઓ")

local export = {}

-- Used in [[ઢાંચો:ક] and [[ઢાંચો:શબ્દ]]
function export.l_term_t(frame)
	local face = frame.args["મોઢું"]; if face ~= "શબ્દ" then face = nil end
	-- Compatibility mode.
	-- 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 "") ~= ""
	local incompat = (frame.args["અસંગત"] or "") ~= ""
	local args = frame:getParent().args
	
	local lang = args[(compat and "ભાષા" or 1)]
	if lang == nil or lang == "" then
		-- Temporary. Unfortunately, many pages are missing the language parameter.
		-- These all need to be fixed, but until then this is needed to avoid
		-- thousands of script errors. See [[:Category:term cleanup]]!
		if compat then
			lang = "અનિર્ધારિત"
		else
			error("The first parameter (language code) has not been given")
		end
	end
	
	lang = require("Module:ભાષાઓ").getLanguageByCode(lang) or error("ભાષા સંકેત \"" .. lang .. "\" યોગ્ય નથી.")
	
	local sc = args["લિપિ"]; if sc == "" then sc = nil end

	local term = args[(compat and 1 or 2)]; if term == "" then term = nil end
	local alt
	if incompat then
		alt = args[""] or args["લખાણ"]; if alt == "" then alt = nil end
		if term and alt then
			error("Cannot specify both linked text and linkless text")
		end
	else
		alt = args[(compat and 2 or 3)]; if alt == "" then alt = nil end
	end
	local id = args["ઓળખ"]; if id == "" then id = nil end
	
	local tr = args["લિપ્ય"]; if tr == "" then tr = nil end
	local gloss = args["પરિભાષા"] or args[(compat and 3 or (incompat and (alt and 2 or 3) or 4))]; if gloss == "" then gloss = nil end
	local pos = args["pos"]; if pos == "" then pos = nil end
	local lit = args["અક્ષરશઃ"]; if lit == "" then lit = nil end

	-- Gather gender and number specifications
	-- Iterate over all gn parameters (g2, g3 and so on) until one is empty
	local genders = {}
	local g = args["લિંગ"] or ""
	local i = 2
	
	while g ~= "" do
		table.insert(genders, g)
		g = args["લિંગ" .. i] or ""
		i = i + 1
	end
	
	-- Forward the information to full_link
	return m_links.full_link(term, alt, lang, sc, face, id, {tr = tr, genders = genders, gloss = gloss, pos = pos, lit = lit})
end

return export