Jump to content

Module:Sandbox/Alex 21

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Alex 21 (talk | contribs) at 00:43, 12 January 2025. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

local p = {}

function p.main(frame) 
	local args = require('Module:Arguments').getArgs(frame, {frameOnly = true})
	args = args or {}
	
	content = args[1]
	matches = {
		"%((season) (%d+)%)", "%1 %2",
		"%((series) (%d+)%)", "%1 %2",
		"%((%d+ TV series), (season) (%d+)%)", "(%1) %2 %3",
		"%((%d+ TV series), (series) (%d+)%)", "(%1) %2 %3",
		"%(([%w%s]+) (season) (%d+)%)", "(%1 TV series) %2 %3",
		"%(([%w%s]+) (series) (%d+)%)", "(%1 TV series) %2 %3"
	}
	
	for i=1, #matches, 2 do
		if content:match(matches[i]) then
			content = content:gsub(matches[i], matches[i+1])
			break
		end
	end
	
	return content
end

return p