Module:Labelled list hatnote: Difference between revisions

m
(Prototype. Was going to add this to Module:Hatnote list but it's probably better as its own module…)
 
m (7 revisions imported from templatewiki:Module:Labelled_list_hatnote)
 
(6 intermediate revisions by 2 users not shown)
Line 14:
-- Defaults global to this module
local defaults = {
label = 'See also', --Final fallback for label argument
labelForm = '%s: %s',
prefixes = {'label', 'label ', 'l'},
template = 'Module:Labelled list hatnote'
}
 
Line 22 ⟶ 25:
-- Prefixes specify which parameters, in order, to check for display options
-- They each have numbers auto-appended, e.g. 'label1', 'label 1', & 'l1'
prefixes = prefixes or {'label', 'label ', 'l'}defaults.prefixes
local pages = {}
for k, v in pairs(args) do
Line 52 ⟶ 55:
local pages = p.preprocessDisplays(args)
local options = {
selfrefextraclasses = frame.args.selfrefextraclasses,
category = args.category,
selfref = frame.args.selfref or args.selfref,
template = template
}
Line 64 ⟶ 68:
return mHatnote.makeWikitextError(
'no page names specified',
(options.template or 'Module:Labelled list hatnote'defaults.template) .. '#Errors',
options.category
)
end
label = (#pages == 1 and labels[1] or labels[2]) or defaults.label
local text = string.format('%s: %s', label, mHatlist.andList(pages, true))
options.labelForm or defaults.labelForm,
local hnOptions = {selfref = options.selfref}
label,
mHatlist.andList(pages, true)
)
local hnOptions = {
extraclasses = options.extraclasses,
local hnOptions = { selfref = options.selfref}
}
return mHatnote._hatnote(text, hnOptions)
end