વિભાગ:કડીઓ/ઢાંચાઓ
ક_શબ્દ_અનુ
ફેરફાર કરો{{#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 [[Template:l]] and [[Template:term]]
function export.l_term_t(frame)
local face = frame.args["face"]; if face ~= "term" 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["compat"] or "") ~= ""
local incompat = (frame.args["incompat"] or "") ~= ""
local args = frame:getParent().args
local lang = args[(compat and "lang" 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 = "und"
else
error("The first parameter (language code) has not been given")
end
end
lang = require("Module:ભાષાઓ").getLanguageByCode(lang) or error("The language code \"" .. lang .. "\" is not valid.")
local sc = args["sc"]; 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["text"]; 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["id"]; if id == "" then id = nil end
local tr = args["tr"]; if tr == "" then tr = nil end
local gloss = args["gloss"] 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["lit"]; 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["g"] or ""
local i = 2
while g ~= "" do
table.insert(genders, g)
g = args["g" .. 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