Module:Sandbox/MSGJ
Appearance
require('strict')
local p = {}
p.main = function(frame)
local banner_name = mw.text.trim(frame.args[1]) -- name of template to look for
local WPBSredirects = mw.loadData('Module:WikiProject banner/config').banner_shell.redirects
local page_content = mw.title.getCurrentTitle():getContent()
local content_without_shell = page_content
for capture in mw.ustring.gmatch(page_content, '%b{}') do
for _, redirect in ipairs(WPBSredirects) do
if mw.ustring.find(capture, '^{{%s*' .. redirect .. '%s*[%|}].*}}$') then -- found a banner shell
content_without_shell = mw.ustring.gsub(page_content, capture, '') -- remove banner shell content from page content
end
end
end
local template_outside_shell = false
if content_without_shell then -- banner shell was found
if mw.ustring.find(content_without_shell, '{{%s*' .. banner_name .. '%s*[%|}]') then
template_outside_shell = true
end
end
return template_outside_shell
end
return p