Module:labels/templates: Difference between revisions
Jump to navigation
Jump to search
(Created page with "local export = {} --[=[ Modules used: Module:labels Module:parameters Module:utilities Module:languages Module:template_link ]=] function export.sh...") |
No edit summary |
||
| Line 1: | Line 1: | ||
local export = {} | local export = {} | ||
local labels_module = "Module:labels" | |||
function export.show(frame) | function export.show(frame) | ||
| Line 16: | Line 9: | ||
local params = { | local params = { | ||
[1] = {required = true}, | [1] = {required = true, type = "language", default = "und"}, | ||
[2] = {list = true}, | [2] = {required = true, list = true, default = "example"}, | ||
["nocat"] = {type = "boolean"}, | ["nocat"] = {type = "boolean"}, | ||
["sort"] = {}, | ["sort"] = {}, | ||
} | } | ||
if compat then | if compat then | ||
params["lang"] = params[1] | |||
params[1] = params[2] | params[1] = params[2] | ||
params[2] = nil | params[2] = nil | ||
end | end | ||
| Line 36: | Line 26: | ||
local lang = args[compat and "lang" or 1] | local lang = args[compat and "lang" or 1] | ||
local labels = args[compat and 1 or 2] | local labels = args[compat and 1 or 2] | ||
return require(labels_module).show_labels { | |||
lang = lang, | |||
labels = labels, | |||
sort = args.sort, | |||
nocat = args.nocat, | |||
mode = term_mode and "term-label" or nil, | |||
return require( | |||
} | } | ||
end | end | ||
return export | return export | ||
Latest revision as of 12:12, 11 January 2025
- The following documentation is located at Module:labels/templates/doc.[edit]
- Useful links: root page • root page's subpages • links • transclusions • testcases • sandbox
local export = {}
local labels_module = "Module:labels"
function export.show(frame)
local parent_args = frame:getParent().args
local compat = (frame.args["compat"] or "") ~= "" and parent_args["lang"]
local term_mode = (frame.args["term"] or "") ~= ""
local params = {
[1] = {required = true, type = "language", default = "und"},
[2] = {required = true, list = true, default = "example"},
["nocat"] = {type = "boolean"},
["sort"] = {},
}
if compat then
params["lang"] = params[1]
params[1] = params[2]
params[2] = nil
end
local args = require("Module:parameters").process(parent_args, params)
-- Gather parameters
local lang = args[compat and "lang" or 1]
local labels = args[compat and 1 or 2]
return require(labels_module).show_labels {
lang = lang,
labels = labels,
sort = args.sort,
nocat = args.nocat,
mode = term_mode and "term-label" or nil,
}
end
return export