Jump to content

Module:Taxonbar/exists/sandbox

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Tom.Reding (talk | contribs) at 11:04, 14 August 2023 (Allow in template namespace). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
local p = {}

function p.check( frame )
	local pagename = mw.title.getCurrentTitle().baseText
	local content = mw.title.new(pagename):getContent() or ''
	--sandbox only: do not include this if-statement in the live module
	if string.match(pagename, 'sandbox') or
	   string.match(pagename, 'testcases') then
		content = mw.title.new(pagename, 'Template'):getContent() or ''
	end
	--
	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