Jump to content

Module:Taxonbar/exists: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
m Undid revision 925806814 by Tom.Reding (talk) Needs sandboxing
Line 4: Line 4:
local pagename = mw.title.getCurrentTitle().baseText
local pagename = mw.title.getCurrentTitle().baseText
local content = mw.title.new(pagename):getContent() or ''
local content = mw.title.new(pagename):getContent() or ''
local getRegex = require('Module:Template redirect regex').main
local found = string.match(content, '%{%{ *[Tt]axon?[ _-]?[bB]ar') or --5 redirects as of 2019/9
local tregex = getRegex('Taxonbar')
string.match(content, '%{%{ *[Tt]axonIds')
for _, v in pairs (tregex) do
if found then return true end
local found = string.match(content, v)
if found then return true end
end
return false
return false
end
end

Revision as of 10:56, 14 August 2023

local p = {}

function p.check( frame )
	local pagename = mw.title.getCurrentTitle().baseText
	local content = mw.title.new(pagename):getContent() or ''
	local getRegex = require('Module:Template redirect regex').main
	local tregex = getRegex('Taxonbar')
	for _, v in pairs (tregex) do
		local found = string.match(content, v)
		if found then return true end
	end
	return false
end

return p