3415
редагувань
Admin (обговорення | внесок) Немає опису редагування |
Admin (обговорення | внесок) Немає опису редагування |
||
Рядок 5: | Рядок 5: | ||
local player = frame.args.player | local player = frame.args.player | ||
-- Updated list of seasons with new entries | |||
local season_titles = { | local season_titles = { | ||
"Перший_сезон", "Другий_сезон", "Третій_сезон", | "Перший_сезон", "Другий_сезон", "Третій_сезон", | ||
"Четвертий_сезон", "П'ятий_сезон" | "Четвертий_сезон", "П'ятий_сезон", "Шостий_сезон", | ||
"Сьомий_сезон", "Восьмий_сезон", "Дев'ятий_сезон" | |||
} | } | ||
Рядок 15: | Рядок 17: | ||
local season_title = season_titles[tonumber(season)] | local season_title = season_titles[tonumber(season)] | ||
mw.log("Season page title: ", season_title) | mw.log("Season page title: ", season_title) | ||
if not season_title then | |||
return "??" | |||
end | |||
local title = mw.title.makeTitle(0, season_title) | local title = mw.title.makeTitle(0, season_title) | ||
Рядок 21: | Рядок 27: | ||
if not content then | if not content then | ||
mw.log("Error: Content not found for the season page.") | mw.log("Error: Content not found for the season page.") | ||
return " | return "??" | ||
end | end | ||
Рядок 34: | Рядок 40: | ||
mw.log("Rating section extracted, length: ", string.len(rating_section)) | mw.log("Rating section extracted, length: ", string.len(rating_section)) | ||
-- Adjusted | -- Adjusted to fetch the player's position (column 1 "№") instead of points | ||
local pattern = "|%s*%[%[" .. mw.ustring.gsub(player, "([%(%)%.%-%+])", "%%%1") .. "%]%] | local pattern = "|%s*(%d+)%s*|%s*%[%[" .. mw.ustring.gsub(player, "([%(%)%.%-%+])", "%%%1") .. "%]%]" | ||
local direct_pattern = "|%s*(%d+)%s*|%s*" .. mw.ustring.gsub(player, "([%(%)%.%-%+])", "%%%1") .. "%s*" | |||
local rank = mw.ustring.match(rating_section, pattern) or mw.ustring.match(rating_section, direct_pattern) | local rank = mw.ustring.match(rating_section, pattern) or mw.ustring.match(rating_section, direct_pattern) | ||
if not rank then | if not rank then | ||
mw.log("Error: Player not found in season rankings or regex failed.") | mw.log("Error: Player not found in season rankings or regex failed.") | ||
return " | return "-" | ||
end | end | ||