Anonymous user
Module:Labelled list hatnote: Difference between revisions
Jump to navigation
Jump to search
Enhanced with the ability to vary the label based on the namespace(s) of the target page(s), from sandbox
Richardpruen (talk | contribs) m (1 revision imported: Wikipedia article on Nicotine templates needed) |
Wikipedia >Nihiltres (Enhanced with the ability to vary the label based on the namespace(s) of the target page(s), from sandbox) |
||
Line 51: | Line 51: | ||
local labels = {frame.args[1] or defaults.label} | local labels = {frame.args[1] or defaults.label} | ||
labels[2] = frame.args[2] or labels[1] | labels[2] = frame.args[2] or labels[1] | ||
labels[3] = frame.args[3] --no defaulting | |||
labels[4] = frame.args[4] --no defaulting | |||
local template = frame:getParent():getTitle() | local template = frame:getParent():getTitle() | ||
local args = mArguments.getArgs(frame, {parentOnly = true}) | local args = mArguments.getArgs(frame, {parentOnly = true}) | ||
Line 73: | Line 75: | ||
end | end | ||
label = (#pages == 1 and labels[1] or labels[2]) or defaults.label | label = (#pages == 1 and labels[1] or labels[2]) or defaults.label | ||
for k, v in pairs(pages) do | |||
if mHatnote.findNamespaceId(v) ~= 0 then | |||
label = | |||
( | |||
#pages == 1 and | |||
(labels[3] or labels[1] or defaults.label) or | |||
(labels[4] or labels[2] or defaults.label) | |||
) or defaults.label | |||
end | |||
end | |||
local text = string.format( | local text = string.format( | ||
options.labelForm or defaults.labelForm, | options.labelForm or defaults.labelForm, |