Module:Lockbox: Difference between revisions

Content deleted Content added
optimisation voodoo
more voodoo
Line 3:
function export.lock(frame)
local output = {}
local wikitext = {}
-- check if the current page is cascade-protected
Line 18 ⟶ 19:
-- 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
frame:expandTemplatetable.insert(wikitext, '{{' title =.. item .. '}}')
 
local ns = match(item, "^(.-):")
if not ns or not mw.site.namespaces[ns] then
itemtable.insert(output, ='* "[[Template:"' .. item .. ']]\n')
elseif (ns == "File") or (ns == "Image") then
-- XXX: leaving this separate just in case it needs special handling
itemtable.insert(output, ='* "[[:"' .. item .. ']]\n')
elseif ns == "Category" then
itemtable.insert(output, ='* "[[:"' .. item .. ']]\n')
end
table.insert(output, '* [[' .. item .. ']]\n')
end
frame:preprocess(table.concat(wikitext))
 
if frame.args.silent then