Modul:form of
Görünüş
Not to be invoked directly, but from Module:form of/templates instead. Used by many templates.
local m_links = require("Module:links")
local m_data = mw.loadData("Module:form of/data")
local export = {}
function export.format_t(text, terminfo)
return
"<span class='form-of-definition'>" ..
"<span class='form-of-definition-link'>" .. m_links.full_link(terminfo, "term", false) .. "</span>" ..
" " .. text .. "</span>"
end
function export.form_of_t(frame)
local iargs = frame.args
local term_param = tonumber(iargs["term_param"]) or 1
local text = iargs[1]; if text == "" then text = nil end
local lang = iargs["lang"]
local sc = iargs["sc"]
local id = iargs["id"]
if not text then
error("No definition text provided.")
end
local params = {
[term_param] = {required = true},
[term_param + 1] = {},
[term_param + 2] = {alias_of = "gloss"},
["cap"] = {},
["dot"] = {},
["from"] = {},
["from2"] = {},
["from3"] = {},
["from4"] = {},
["from5"] = {},
["from6"] = {},
["gloss"] = {},
["id"] = {},
["is lemma"] = {type = "boolean"},
["lang"] = {required = lang == nil},
["nocap"] = {type = "boolean"},
["nocat"] = {type = "boolean"},
["nodot"] = {type = "boolean"},
["POS"] = {},
["pos"] = {},
["sc"] = {},
["sort"] = {},
["tr"] = {},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local term = args[term_param] or "term"
local alt = args[term_param + 1]
lang = lang or args["lang"] or "und"
sc = sc or args["sc"]
id = id or args["id"]
lang = require("Module:languages").getByCode(lang) or error("The language code \"" .. lang .. "\" is not valid.")
sc = (sc and (require("Module:scripts").getByCode(sc) or error("The script code \"" .. sc .. "\" is not valid.")) or nil)
return export.format_t(text, {lang = lang, sc = sc, term = term, alt = alt, id = id, gloss = args["gloss"], tr = args["tr"]})
end
function export.tagged_inflections(tags, terminfo)
local cur_infl = {}
local inflections = {}
for i, tag in ipairs(tags) do
if m_data.shortcuts[tag] then
elseif m_data.tags[tag] then
else
require("Module:debug").track("inflection of/unknown")
require("Module:debug").track("inflection of/unknown/" .. tag:gsub("%[", "("):gsub("%]", ")"):gsub("|", "!"))
end
if tag == ";" then
if #cur_infl > 0 then
table.insert(inflections, table.concat(cur_infl, " "))
end
cur_infl = {}
else
tag = m_data.shortcuts[tag] or tag
local data = m_data.tags[tag]
-- If there is a nonempty glossary index, then show a link to it
if data and data.glossary then
tag = "[[Əlavə:Qlossari#" .. mw.uri.anchorEncode(data.glossary) .. "|" .. tag .. "]]"
end
table.insert(cur_infl, tag)
end
end
if #cur_infl > 0 then
table.insert(inflections, table.concat(cur_infl, " "))
end
if #inflections == 1 then
return export.format_t("sözünün " .. inflections[1] .. " halı", terminfo)
else
return
"<span class='form-of-definition'>inflection of " ..
"<span class='form-of-definition-link'>" .. m_links.full_link(terminfo, "term", false) .. "</span>" ..
":</span>\n## <span class='form-of-definition'>" .. table.concat(inflections, "</span>\n## <span class='form-of-definition'>") .. "</span>"
end
end
return export