<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3ASandbox%2FRexxS%2FDabcheck</id>
	<title>Module:Sandbox/RexxS/Dabcheck - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3ASandbox%2FRexxS%2FDabcheck"/>
	<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Sandbox/RexxS/Dabcheck&amp;action=history"/>
	<updated>2026-05-24T03:22:17Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://stockhub.co/index.php?title=Module:Sandbox/RexxS/Dabcheck&amp;diff=146066&amp;oldid=prev</id>
		<title>imported&gt;RexxS: better to re-write so that table displays properly</title>
		<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Sandbox/RexxS/Dabcheck&amp;diff=146066&amp;oldid=prev"/>
		<updated>2019-05-06T12:01:16Z</updated>

		<summary type="html">&lt;p&gt;better to re-write so that table displays properly&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;--[[&lt;br /&gt;
Helper function that checks a piece of text with 3-way match: valid match, invalid match, no match&lt;br /&gt;
It returns 3 configurable results.&lt;br /&gt;
The function test tests if a title contains a valid disabiguator.&lt;br /&gt;
--]]&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
-- exportable to other modules&lt;br /&gt;
function p._3way_check(text, args)&lt;br /&gt;
	if not text or text == &amp;quot;&amp;quot; then return false, &amp;quot;no text&amp;quot; end&lt;br /&gt;
&lt;br /&gt;
	-- Check if there is a match on the valid list&lt;br /&gt;
	for _, v in ipairs(args.valid) do&lt;br /&gt;
		if text:match(v) then&lt;br /&gt;
			return true, &amp;quot;&amp;quot;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Check if there is a match on the invalid list&lt;br /&gt;
	for k, v in pairs(args.invalid) do&lt;br /&gt;
		if text:match(k) then&lt;br /&gt;
			return false, v&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- if we&amp;#039;ve got this far, then there&amp;#039;s no match&lt;br /&gt;
	return false, args.nomatch&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.test(frame)&lt;br /&gt;
	local title = frame.args.title or &amp;quot;&amp;quot;&lt;br /&gt;
	if title == &amp;quot;&amp;quot; then return &amp;quot;No title&amp;quot; end&lt;br /&gt;
&lt;br /&gt;
	local exceptionList = {&lt;br /&gt;
		&amp;quot;The (206)&amp;quot;,&lt;br /&gt;
		&amp;quot;Cinderella (Apakah Cinta Hanyalah Mimpi?)&amp;quot;,&lt;br /&gt;
		&amp;quot;How to Live with Your Parents (For the Rest of Your Life)&amp;quot;,&lt;br /&gt;
		&amp;quot;I (Almost) Got Away With It&amp;quot;,&lt;br /&gt;
		&amp;quot;Monty Python: Almost the Truth (Lawyers Cut)&amp;quot;,&lt;br /&gt;
		&amp;quot;Randall and Hopkirk (Deceased)&amp;quot;,&lt;br /&gt;
		&amp;quot;Randall &amp;amp; Hopkirk (Deceased) (2000 TV series)&amp;quot;&lt;br /&gt;
	}&lt;br /&gt;
	-- finish if the title has brackets that are part of the title (not disambiguation)&lt;br /&gt;
	for _, v in ipairs(exceptionList) do&lt;br /&gt;
		if v == title then&lt;br /&gt;
			return &amp;quot;Title on exception list&amp;quot;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- extract the disambiguation text&lt;br /&gt;
	local disambiguation = string.match(title, &amp;quot;%s%((.-)%)&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
	-- set up the three possibilities&lt;br /&gt;
	local args = {&lt;br /&gt;
		valid = {&lt;br /&gt;
		&amp;quot;TV series&amp;quot;,&lt;br /&gt;
		&amp;quot;TV program&amp;quot;,&lt;br /&gt;
		&amp;quot;TV programme&amp;quot;,&lt;br /&gt;
		&amp;quot;TV film&amp;quot;,&lt;br /&gt;
		&amp;quot;film&amp;quot;,&lt;br /&gt;
		&amp;quot;miniseries&amp;quot;,&lt;br /&gt;
		&amp;quot;serial&amp;quot;,&lt;br /&gt;
		&amp;quot;game show&amp;quot;,&lt;br /&gt;
		&amp;quot;talk show&amp;quot;,&lt;br /&gt;
		&amp;quot;web series&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		invalid = {&lt;br /&gt;
			-- for testing we&amp;#039;ll just see the category, not categorise the page&lt;br /&gt;
			[&amp;quot;franchise&amp;quot;] = &amp;quot;[[:Category:Television articles using incorrect infobox - F]]&amp;quot;,&lt;br /&gt;
			[&amp;quot;season&amp;quot;] = &amp;quot;[[:Category:Television articles using incorrect infobox - S]]&amp;quot;&lt;br /&gt;
			-- [&amp;quot;franchise&amp;quot;] = &amp;quot;[[Category:Television articles using incorrect infobox|F]]&amp;quot;,&lt;br /&gt;
			-- [&amp;quot;season&amp;quot;] = &amp;quot;[[Category:Television articles using incorrect infobox|S]]&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		-- for testing we&amp;#039;ll just see the category, not categorise the page&lt;br /&gt;
		nomatch = &amp;quot;[[:Category:Television articles with incorrect naming style]]&amp;quot;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	local validmatch, msg = p._3way_check(disambiguation, args)&lt;br /&gt;
	if validmatch then&lt;br /&gt;
		return &amp;quot;Valid title&amp;quot;&lt;br /&gt;
	else&lt;br /&gt;
		return msg&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>imported&gt;RexxS</name></author>
	</entry>
</feed>