Content deleted Content added
m sync with main Tags: Manual revert Reverted |
|||
Line 24:
frame = frame or mw.getCurrentFrame()
cfg = cfg or mw.loadData(CONFIG_MODULE)
local templateMode = yesno(options.template)
local isCategorized = yesno(options.category) ~= false
Line 32 ⟶ 33:
end
end
-- Make the list items. These are the shortcuts plus any extra lines such
Line 37 ⟶ 39:
local listItems = {}
for i, shortcut in ipairs(shortcuts) do
local templatePath
if yesno(options['target']) then▼
if templateMode then
listItems[i] = string.format("[[%s]]",shortcut)▼
-- Namespace detection
local titleObj = mw.title.new(shortcut, 10)
if titleObj.namespace == 10 then
templatePath = titleObj.fullText
else
templatePath = shortcut
end
end
listItems[i] = templateMode
and string.format("{{[[%s|%s]]}}", templatePath, shortcut)
else
listItems[i] = frame:expandTemplate{
title = 'No redirect',
args = templateMode and {templatePath, shortcut} or {shortcut}
}
if templateMode then
listItems[i] = string.format("{{%s}}", listItems[i])
end
end
end
|