Module:head/templates: Difference between revisions

ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
(Created page with "local export = {} local m_head = require("Module:head") local m_languages = require("Module:languages") local m_parameters = require("Module:parameters") local params = { [1] = {required = true}, [2] = {required = true}, [3] = {list = true}, ["g"] = {list = true}, ["head"] = {}, ["nocat"] = {type = "boolean"}, } local function get_inflections(list) local inflections = {} local i = 1 while list[i] do local inflection = {["label"] = list[i]} if not list[i+1...")
 
No edit summary
Tag: Manual revert
 
(32 intermediate revisions by 2 users not shown)
Line 10: Line 10:
[3] = {list = true},
[3] = {list = true},
["g"] = {list = true},
["g"] = {list = true},
["label"] = {list = true},
["head"] = {},
["head"] = {},
["nocat"] = {type = "boolean"},
["nocat"] = {type = "boolean"},
Line 44: Line 45:
local function get_data(args)
local function get_data(args)
local p = m_parameters.process(args, params)
local p = m_parameters.process(args, params)
local language = m_languages.get_by_code(p[1])
local term = mw.title.getCurrentTitle().text
if language.proto then
term = mw.ustring.gsub(term, "^[^/]+/", "")
end
return {
return {
term = args["head"] or mw.title.getCurrentTitle().text,
term = term,
language = m_languages.get_by_code(p[1]),
language = language,
pos = p[2],
pos = p[2],
genders = p["g"],
genders = p["g"],
head = p["head"],
nocat = p["nocat"],
labels = p["label"],
inflections = get_inflections(p[3]),
inflections = get_inflections(p[3]),
}
}