47,697
edits
![]() | We're back! Sorry, bad combo of sickness, funeral and a month-long trip abroad. The site is back now. ![]() |
No edit summary Tag: Manual revert |
No edit summary |
||
Line 11: | Line 11: | ||
[[Module:scripts]] | [[Module:scripts]] | ||
[[Module:parameters]] | [[Module:parameters]] | ||
[[Module:debug]] | |||
]=] | ]=] | ||
Line 24: | Line 25: | ||
local alias_of_4 = {alias_of = 4} | local alias_of_4 = {alias_of = 4} | ||
local boolean = {type = "boolean"} | local boolean = {type = "boolean"} | ||
local params = { | local params = { | ||
[1] = {required = true, type = "language", default = "und"}, | [1] = {required = true, type = "language", default = "und"}, | ||
[2] = | [2] = true, | ||
[3] = | [3] = true, | ||
[4] = | [4] = true, | ||
["g"] = {list = true}, | ["g"] = {list = true}, | ||
["gloss"] = alias_of_4, | ["gloss"] = alias_of_4, | ||
["id"] = | ["id"] = true, | ||
["lit"] = | ["lit"] = true, | ||
["pos"] = | ["pos"] = true, | ||
["sc"] = {type = "script"}, | ["sc"] = {type = "script"}, | ||
["t"] = alias_of_4, | ["t"] = alias_of_4, | ||
["tr"] = | ["tr"] = true, | ||
["ts"] = | ["ts"] = true, | ||
["accel-form"] = | ["accel-form"] = true, | ||
["accel-translit"] = | ["accel-translit"] = true, | ||
["accel-lemma"] = | ["accel-lemma"] = true, | ||
["accel-lemma-translit"] = | ["accel-lemma-translit"] = true, | ||
["accel-gender"] = | ["accel-gender"] = true, | ||
["accel-nostore"] = boolean, | ["accel-nostore"] = boolean, | ||
} | } | ||
if iargs.compat then | if iargs.compat then | ||
Line 53: | Line 52: | ||
end | end | ||
if iargs.langname then | if iargs.langname then | ||
params["w"] = | params["w"] = boolean | ||
end | end | ||
return process_params(frame:getParent().args, params), iargs | return process_params(frame:getParent().args, params), iargs | ||
end | end | ||
-- Used in [[Template:l]] and [[Template: | -- Used in [[Template:l]] and [[Template:m]]. | ||
function export.l_term_t(frame) | function export.l_term_t(frame) | ||
local m_debug = require("Module:debug") | |||
local args, iargs = get_args(frame) | local args, iargs = get_args(frame) | ||
local compat = iargs.compat | local compat = iargs.compat | ||
local lang = args[compat and "lang" or 1] | local lang = args[compat and "lang" or 1] | ||
local term = args[(compat and 1 or 2)] | local term = args[(compat and 1 or 2)] | ||
Line 72: | Line 74: | ||
end | end | ||
local langname = | local langname = iargs.langname and ( | ||
args.w and lang:makeWikipediaLink() or | args.w and lang:makeWikipediaLink() or | ||
lang:getCanonicalName() | lang:getCanonicalName() | ||
Line 95: | Line 97: | ||
pos = args["pos"], | pos = args["pos"], | ||
lit = args["lit"], | lit = args["lit"], | ||
accel = args["accel-form"] and { | accel = args["accel-form"] and { | ||
form = args["accel-form"], | form = args["accel-form"], | ||
Line 114: | Line 115: | ||
do | do | ||
local function get_args(frame) | local function get_args(frame) | ||
return process_params(frame:getParent().args, { | return process_params(frame:getParent().args, { | ||
[1] = {required = true, type = "language", default = "und"}, | [1] = {required = true, type = "language", default = "und"}, | ||
[2] = {allow_empty = true}, | [2] = {allow_empty = true}, | ||
[3] = | [3] = true, | ||
["id"] = | ["id"] = true, | ||
["sc"] = {type = "script"}, | ["sc"] = {type = "script"}, | ||
}) | }) | ||
Line 178: | Line 178: | ||
local args = process_params(frame:getParent().args, { | local args = process_params(frame:getParent().args, { | ||
[1] = {required = true}, | [1] = {required = true}, | ||
[2] = true, | |||
["lang"] = {type = "language", default = "en"}, | ["lang"] = {type = "language", default = "en"}, | ||
}) | }) | ||
Line 186: | Line 187: | ||
lang = args.lang, | lang = args.lang, | ||
term = term, | term = term, | ||
alt = term:gsub("^.[\128-\191]*", upper) | alt = term:gsub("^.[\128-\191]*", upper) .. (args[2] or "") | ||
} | } | ||
end | end |