From bfb6d74cc42c8dcaf73412da175eeed8163d653d Mon Sep 17 00:00:00 2001 From: Hesketh2 <88981446+Hesketh2@users.noreply.github.com> Date: Tue, 12 Sep 2023 01:04:05 +0700 Subject: [PATCH 1/2] Add Patch support for PUBG (PC) --- .../infobox/wikis/pubg/infobox_league_custom.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/components/infobox/wikis/pubg/infobox_league_custom.lua b/components/infobox/wikis/pubg/infobox_league_custom.lua index 8ca65717f66..d506a2804ab 100644 --- a/components/infobox/wikis/pubg/infobox_league_custom.lua +++ b/components/infobox/wikis/pubg/infobox_league_custom.lua @@ -9,6 +9,7 @@ local Class = require('Module:Class') local Logic = require('Module:Logic') local Lua = require('Module:Lua') +local PageLink = require('Module:Page') local String = require('Module:StringUtils') local Template = require('Module:Template') local Table = require('Module:Table') @@ -91,6 +92,10 @@ function CustomInjector:parse(id, widgets) CustomLeague:_getGameMode() } }, + Cell{name = 'Patch', content = { + CustomLeague._getPatchVersion() + } + }, Cell{name = 'Platform', content = { CustomLeague:_getPlatform() } @@ -167,4 +172,15 @@ function CustomLeague:_getPlatform() return _PLATFORMS[platform] or _PLATFORMS['default'] end +function CustomLeague._getPatchVersion() + if String.isEmpty(_args.patch) then return nil end + local content = PageLink.makeInternalLink(_args.patch, 'Patch ' .. _args.patch) + if not String.isEmpty(_args.epatch) then + content = content .. ' – ' + content = content .. PageLink.makeInternalLink(_args.epatch, 'Patch ' .. _args.epatch) + end + + return content +end + return CustomLeague From 043a38463ce3db3cae7442393d705cd8b175173b Mon Sep 17 00:00:00 2001 From: Hesketh2 <88981446+Hesketh2@users.noreply.github.com> Date: Tue, 12 Sep 2023 15:56:40 +0700 Subject: [PATCH 2/2] Update infobox_league_custom.lua --- .../wikis/pubg/infobox_league_custom.lua | 28 ++++++------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/components/infobox/wikis/pubg/infobox_league_custom.lua b/components/infobox/wikis/pubg/infobox_league_custom.lua index d506a2804ab..3fe5fa31462 100644 --- a/components/infobox/wikis/pubg/infobox_league_custom.lua +++ b/components/infobox/wikis/pubg/infobox_league_custom.lua @@ -28,6 +28,8 @@ local CustomInjector = Class.new(Injector) local _args local _game +local NONE_BREAKING_SPACE = ' ' +local DASH = '–' local _GAME = mw.loadData('Module:GameVersion') local _MODES = { @@ -84,22 +86,10 @@ end function CustomInjector:parse(id, widgets) if id == 'gamesettings' then return { - Cell{name = 'Game version', content = { - CustomLeague._getGameVersion() - } - }, - Cell{name = 'Game mode', content = { - CustomLeague:_getGameMode() - } - }, - Cell{name = 'Patch', content = { - CustomLeague._getPatchVersion() - } - }, - Cell{name = 'Platform', content = { - CustomLeague:_getPlatform() - } - }, + Cell{name = 'Game version', content = {CustomLeague._getGameVersion()}}, + Cell{name = 'Game mode', content = {CustomLeague:_getGameMode()}}, + Cell{name = 'Patch', content = {CustomLeague._getPatchVersion()}}, + Cell{name = 'Platform', content = {CustomLeague:_getPlatform()}}, } elseif id == 'customcontent' then if _args.player_number then @@ -175,9 +165,9 @@ end function CustomLeague._getPatchVersion() if String.isEmpty(_args.patch) then return nil end local content = PageLink.makeInternalLink(_args.patch, 'Patch ' .. _args.patch) - if not String.isEmpty(_args.epatch) then - content = content .. ' – ' - content = content .. PageLink.makeInternalLink(_args.epatch, 'Patch ' .. _args.epatch) + if String.isNotEmpty(_args.epatch) then + return content .. NONE_BREAKING_SPACE .. DASH .. NONE_BREAKING_SPACE + .. PageLink.makeInternalLink(_args.epatch, 'Patch ' .. _args.epatch) end return content