Modulo:formo di
Dokumentizo por ica modulo povas kreesar ye Modulo:formo di/dokumentado
local m_links = require("Module:ligili")
local m_data = mw.loadData("Module:formo di/donaji")
local export = {}
function export.format_t(text, terminfo)
return
"<span class='form-of-definition'>" .. text .. " " ..
"<span class='form-of-definition-link'>" .. m_links.full_link(terminfo, "term", false) .. "</span>" ..
"</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"]
local categories = {}
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"] = {},
["ts"] = {},
}
local args = require("Module:parametri").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:lingui").getByCode(lang) or error("The language code \"" .. lang .. "\" is not valid.")
sc = (sc and (require("Module:skripti").getByCode(sc) or error("The script code \"" .. sc .. "\" is not valid.")) or nil)
-- add tracking category if term is same as page title
if mw.title.getCurrentTitle().text == lang:makeEntryName(term) then
table.insert(categories, "[[Kategorio:Forms linking to themselves]]")
end
-- add tracking category if term does not exist
local link_object = mw.title.new(lang:makeEntryName(term)) or nil
if (link_object) then
if (link_object.id == 0) then
table.insert(categories, "[[Kategorio:Forms of entries that do not exist]]")
if (lang:getCode() == "en") then
table.insert(categories, "[[Kategorio:Forms of entries that do not exist/en]]")
end
end
end
return export.format_t(text, {lang = lang, sc = sc, term = term, alt = alt, id = id, gloss = args["gloss"], tr = args["tr"]}) .. table.concat(categories)
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 = "[[Appendix:Glossary#" .. 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(inflections[1] .. " of", 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