Module:alternative forms: Difference between revisions

Jump to navigation Jump to search
no edit summary
(Created page with "local export = {} local labels_module = "Module:labels" local links_module = "Module:links" local parameter_utilities_module = "Module:parameter utilities" local function track(page) require("Module:debug/track")("alter/" .. page) end --[==[ Main function for displaying alternative forms. Extracted out from the template-callable function so this can be called by other modules (in particular, Module:descendants tree). `show_labels_after_terms` no longer has any me...")
 
No edit summary
 
Line 11: Line 11:
--[==[
--[==[
Main function for displaying alternative forms. Extracted out from the template-callable function so this can be
Main function for displaying alternative forms. Extracted out from the template-callable function so this can be
called by other modules (in particular, [[Module:descendants tree]]). `show_labels_after_terms` no longer has any
called by other modules (in particular, [[Module:descendants tree]]). `allow_self_link` causes terms the same as the
meaning. `allow_self_link` causes terms the same as the pagename to be shown normally; otherwise they are displayed
pagename to be shown normally; otherwise they are displayed unlinked. `default_separator` controls the separator between
unlinked.
terms when the user didn't use a special separator term like ";" (defaulting to ", ").
]==]
]==]
function export.display_alternative_forms(parent_args, pagename, show_labels_after_terms, allow_self_link)
function export.display_alternative_forms(parent_args, pagename, allow_self_link, default_separator)
local params = {
local params = {
[1] = {required = true, type = "language", default = "en"},
[1] = {required = true, type = "language", default = "en"},
Line 31: Line 31:
}
}


local items, args = m_param_utils.process_list_arguments {
local items, args = m_param_utils.parse_list_with_inline_modifiers_and_separate_params {
params = params,
params = params,
param_mods = param_mods,
param_mods = param_mods,
Line 41: Line 41:
sc = "sc.default",
sc = "sc.default",
stop_when = function(data)
stop_when = function(data)
return not data.any_param_at_index
local stop = not data.any_param_at_index
if stop and parent_args[data.orig_index + 1] == nil then
track("actual hole in params")
end
return stop
end,
end,
default_separator = default_separator,
}
}


Navigation menu