Module:Lockbox: Difference between revisions

Content deleted Content added
other voodoo
screw it, use titles
Line 13:
local match = string.match
local args = { }
 
-- transclude everything, and discard the output
for _, item in ipairs(frame.args) do
item = mw.text.trim(item)
-- getContent() on a title object might be cleaner, but getContent() and title objects
-- are considered "expensive". even though they are probably cheaper than actual transclusion
args.title = item
frame:expandTemplate(args)
 
local ns = match(item, "^(.-):")
if not ns or not mw.site.namespaces[ns] then
mw.title.makeTitle('Template', item):getContent()
table.insert(output, '* [[Template:' .. item .. ']]\n')
elseif (ns == "File") or (ns == "Image") then
local _ = mw.title.makeTitle('File', item).fileExists
-- XXX: leaving this separate just in case it needs special handling
table.insert(output, '* [[:' .. item .. ']]\n')
elseif ns == "Category" then
mw.title.makeTitle('Category', item):getContent()
table.insert(output, '* [[:' .. item .. ']]\n')
else
mw.title.makeTitle(item):getContent()
table.insert(output, '* [[' .. item .. ']]\n')
end
end