Module:Lockbox: Difference between revisions

Content deleted Content added
trim
optimisation voodoo
Line 8:
mw.title.getCurrentTitle():getContent() -- self-transclude; see [[mw:Extension:Scribunto/Lua reference manual#Title objects]]
if frame:preprocess "{{CASCADINGSOURCES}}" == "" then
table.insert(output, '<strong class="warning">Warning: this page (' .. mw.title.getCurrentTitle().fullText .. ') is not cascade-protected.</strong>\n')
end
local match = string.match
-- transclude everything, and discard the output
for _, item in ipairs(frame.args) do
Line 19 ⟶ 20:
frame:expandTemplate { title = item }
 
iflocal notns = item:match(item, "^(.-):") then
if not ns or not mw.site.namespaces[ns] then
item = "Template:" .. item
elseif item:match(ns == "^File:") or item:match(ns == "^Image:") then
-- XXX: leaving this separate just in case it needs special handling
item = ":" .. item
elseif item:match(ns == "^Category:") then
item = ":" .. item
end
table.insert(output, ('* [[%s' .. item .. ']]\n'):format(item))
end
 
Line 33 ⟶ 35:
return ""
else
return table.concat(output, "\n")
end
end