Module:Sandbox/Alex 21: Difference between revisions
Appearance
Content deleted Content added
No edit summary |
No edit summary |
||
Line 5: | Line 5: | ||
args = args or {} |
args = args or {} |
||
content = args[1] |
|||
matches = { |
|||
⚫ | |||
"%((season) (%d+)%)", "%1 %2", |
|||
"%((series) (%d+)%)", "%1 %2", |
|||
⚫ | |||
"%((%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 |
|||
⚫ | |||
end |
end |
||
Revision as of 00:43, 12 January 2025
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