Module:Navbox Automatic Groups: Difference between revisions

ReisuDesign (talk | contribs)
No edit summary
ReisuDesign (talk | contribs)
No edit summary
 
Line 43: Line 43:
return group
return group
end)
end)
end
-- Link a group name if the page exists
local function linkGroup(group)
local page = mw.text.decode(group or '')
local frame = mw.getCurrentFrame()
if page ~= ''
and not page:match('[#<>%[%]{}]+')
and frame:callParserFunction('PROTECTIONEXPIRY:edit', page) ~= '' then
return '[[' .. group .. '|' .. group .. ']]'
end
return group
end
end


Line 88: Line 102:
local function expandDpl(frame, args, group, exclusions)
local function expandDpl(frame, args, group, exclusions)
local dplArgs = getDplArgs(args, group, exclusions)
local dplArgs = getDplArgs(args, group, exclusions)
return frame:expandTemplate{
return frame:expandTemplate{
title = 'Navbox DPL',
title = 'Navbox DPL',
Line 180: Line 195:
}
}


-- Link normal group names when the corresponding page exists
if not isNoGroup then
if not isNoGroup then
row.group = group
row.group = linkGroup(group)
end
end