Module:WikiProject banner/sandbox: Difference between revisions

Content deleted Content added
perhaps needed
will this work?
Line 288:
local article_class = p.readarticleclass({ignore_subtemplates=true}, title.prefixedText)
if article_class then -- banner shell exists
local special_chars = {'([%%%', '(', '%)', '%.', '%+', '%-', '%*', '%?', '%[', '%]', '%^', '%$])'}
local banner_name_escaped = banner_name.text
local page_content = title:getContent() -- get content of current page
Line 295:
for _, redirect in ipairs(cfg.banner_shell.redirects) do
if mw.ustring.find(capture, '^{{%s*' .. redirect .. '%s*[|}].*}}$') then -- found a banner shell
forbanner_name_escaped _,= char in ipairsbanner_name_escaped:gsub(special_chars, '%%%1') do -- escape each special character
banner_name_escapedcapture = banner_name_escapedcapture:gsub('%'..charspecial_chars, '%%%1'..char)
capture = capture:gsub('%'..char, '%%'..char)
end
content_without_shell = mw.ustring.gsub(page_content, capture, '') -- remove banner shell content from page content
break
end
if content_without_shell then break end
end
if content_without_shell then break end