Modul:etymology/templates
Bu modul uchun Modul:etymology/templates/doc nomli hujjat sahifasini yaratishingiz mumkin
local export = {}
function export.etyl(frame)
local params = {
[1] = {required = true, default = "va"},
[2] = {},
["sort"] = {},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local source = args[1]
local tili = args[2]
local sort_key = args["sort"]
-- Empty language means English, but "-" means no language. Yes, confusing...
if not tili then
tili = "uz"
elseif tili == "-" then
tili = nil
end
if tili then
tili = require("Module:tili").getByCode(lang) or error("The language code \"" .. tili .. "\" is not valid.")
end
source =
require("Module:tili").getByCode(source) or
require("Module:etymology languages").getByCode(source) or
require("Module:families").getByCode(source) or
error("The language, family or etymology language code \"" .. source .. "\" is not valid.")
return require("Module:etymology").format_etyl(tili, source, sort_key)
end
function export.derived(frame)
local params = {
[1] = {required = true, default = "va"},
[2] = {required = true, default = "va"},
[3] = {},
[4] = {alias_of = "alt"},
[5] = {alias_of = "gloss"},
["alt"] = {},
["g"] = {},
["gloss"] = {},
["id"] = {},
["lit"] = {},
["pos"] = {},
["t"] = {alias_of = "gloss"},
["tr"] = {},
["sc"] = {},
["sort"] = {},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local tili = args[1]
local source = args[2]
local sc = args["sc"]
lang = require("Module:tili").getByCode(lang) or error("The language code \"" .. tili .. "\" is not valid.")
source =
require("Module:tili").getByCode(source) or
require("Module:etymology languages").getByCode(source) or
require("Module:families").getByCode(source) or
error("The language, family or etymology language code \"" .. source .. "\" is not valid.")
sc = (sc and (require("Module:scripts").getByCode(sc) or error("The script code \"" .. sc .. "\" is not valid.")) or nil)
return require("Module:etymology").format_derived(
tili, sc, source, args[3], args["alt"], args["id"],
{genders = {args["g"]}, tr = args["tr"], gloss = args["gloss"], pos = args["pos"], lit = args["lit"]},
args["sort"])
end
function export.inherited(frame)
local params = {
[1] = {required = true, default = "va"},
[2] = {required = true, default = "va"},
[3] = {},
[4] = {alias_of = "alt"},
[5] = {alias_of = "gloss"},
["alt"] = {},
["g"] = {},
["gloss"] = {},
["id"] = {},
["lit"] = {},
["pos"] = {},
["t"] = {alias_of = "gloss"},
["tr"] = {},
["sc"] = {},
["sort"] = {},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local tili = args[1]
local source = args[2]
local sc = args["sc"]
tili = require("Module:tili").getByCode(tili) or error("The language code \"" .. tili .. "\" is not valid.")
source =
require("Module:tili").getByCode(source) or
require("Module:etymology languages").getByCode(source) or
error("The language or etymology language code \"" .. source .. "\" is not valid.")
sc = (sc and (require("Module:scripts").getByCode(sc) or error("The script code \"" .. sc .. "\" is not valid.")) or nil)
return require("Module:etymology").format_inherited(
tili, sc, source, args[3], args["alt"], args["id"],
{genders = {args["g"]}, tr = args["tr"], gloss = args["gloss"], pos = args["pos"], lit = args["lit"]},
args["sort"])
end
function export.borrowed(frame)
local learned = frame.args["learned"]; if not learned or learned == "" then learned = false else learned = true end
local params = {
[1] = {required = true, default = "und"},
[2] = {required = true, default = "und"},
[3] = {},
[4] = {alias_of = "alt"},
[5] = {alias_of = "gloss"},
["alt"] = {},
["g"] = {},
["gloss"] = {},
["id"] = {},
["lit"] = {},
["nocap"] = {type = "boolean"},
["notext"] = {type = "boolean"},
["pos"] = {},
["t"] = {alias_of = "gloss"},
["tr"] = {},
["sc"] = {},
["sort"] = {},
}
local compat = false
if frame:getParent().args["tili"] then
compat = true
end
if compat then
require("Module:debug").track("borrowing/lang")
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]
local source = args[compat and 1 or 2]
local sc = args["sc"]
tili = require("Module:tili").getByCode(tili) or error("The language code \"" .. tili .. "\" is not valid.")
source =
require("Module:tili").getByCode(source) or
require("Module:etymology languages").getByCode(source) or
require("Module:families").getByCode(source) or
error("The language, family or etymology language code \"" .. source .. "\" is not valid.")
sc = (sc and (require("Module:scripts").getByCode(sc) or error("The script code \"" .. sc .. "\" is not valid.")) or nil)
return require("Module:etymology").format_borrowed(
tili, sc, source, args[compat and 2 or 3], args["alt"], args["id"],
{genders = {args["g"]}, tr = args["tr"], gloss = args["gloss"], pos = args["pos"], lit = args["lit"]},
args["sort"], args["nocap"], args["notext"], learned)
end
return export