Leaguepedia | League of Legends Esports Wiki
[checked revision][checked revision]
((via Mediawiker ST3))
Ispoonz (talk | contribs)
No edit summary
(32 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
local util_args = require('Module:ArgsUtil')
 
local util_args = require('Module:ArgsUtil')
local util_footnote = require('Module:FootnoteUtil')
 
local util_table = require('Module:TableUtil')
 
 
local util_text = require('Module:TextUtil')
 
local util_text = require('Module:TextUtil')
 
local i18n = require('Module:i18nUtil')
 
local i18n = require('Module:i18nUtil')
 
local m_champion = require('Module:Champion')
 
   
 
local h = {}
 
local h = {}
Line 15: Line 11:
 
['2'] = 'Red'
 
['2'] = 'Red'
 
},
 
},
years = { 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 },
+
years = { 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022 },
 
store_player_league_history = true, -- do we store to PlayerLeagueHistory from InfoboxPlayer? will prevent needing to sync a normally-unneeded dependency
 
store_player_league_history = true, -- do we store to PlayerLeagueHistory from InfoboxPlayer? will prevent needing to sync a normally-unneeded dependency
 
}
 
}
   
 
function p.linkPatch(str)
 
function p.linkPatch(str)
 
if not str then return nil end
return util_text.intLink(('Patch %s'):format(str), str)
+
return util_text.intLink(p.patchPage(str), str)
end
 
 
---------------------------------------------------------
 
------------------ MatchList hooks ---------------------
 
---------------------------------------------------------
 
 
local MATCHLIST_PATCH_TOGGLES = {
 
init = 'number',
 
order = { 'all', 'number', 'none' }
 
}
 
 
function p.onMatchListProcessTabRow(row, i, j, args, tab)
 
-- add patch as a table caption
 
util_table.initTable(tab, 'patchinfo', { patches = {}, hotfixes = {}, disabled = {}, footnotes = {} })
 
if not row.Patch then return true end
 
MATCH_LIST_HAS_PATCH = true
 
util_table.initDict(tab.patchinfo.patches, row.Patch)
 
if row.Hotfix then
 
util_table.initDict(tab.patchinfo.hotfixes, row.Hotfix)
 
end
 
if row.PatchFootnote then
 
util_table.initDict(tab.patchinfo.footnotes, row.PatchFootnote)
 
end
 
util_table.merge(tab.patchinfo.disabled, util_text.split(row.Disabled))
 
return true
 
end
 
 
function p.onMatchListPrintCaption(tbl, tab)
 
if not MATCH_LIST_HAS_PATCH then return true end
 
local caption = tbl:tag('caption')
 
h.printPatchNumber(caption, patchinfo)
 
h.printDisabledText(caption, patchinfo)
 
util_footnote.tagFootnotes(caption, tab.patchinfo.footnotes)
 
return true
 
end
 
 
function h.printPatchNumber(caption, patchinfo)
 
local span = caption:tag('span')
 
:wikitext(i18n.print('patchCaption', h.getPatchText(patchinfo.patches)))
 
end
 
 
function h.getPatchText(patches)
 
return util_table.concatNonempty(patches, ', ', p.linkPatch) or i18n.print('tbd')
 
end
 
 
function h.printDisabledText(caption, patchinfo)
 
if not patchinfo.disabled then return end
 
local span = caption:tag('span')
 
:wikitext(i18n.print('patchDisabled', h.getDisabledText(patchinfo.disabled)))
 
end
 
 
function h.getDisabledText(disabled)
 
if not next(disabled) then return nil end
 
return util_table.concat(disabled, '', m_champion.onlyimagelinked)
 
 
end
 
end
   
function p.onMatchListPrintTogglesEnd(tbl)
+
function p.patchPage(str)
  +
return ('Patch %s'):format(str)
div = tbl:tag('div'):addClass('toggle-button')
 
div:wikitext(i18n.print('patchToggle'))
 
util_toggle.printOptionFromListTogglers(div, MATCHLIST_PATCH_TOGGLES)
 
 
end
 
end
   

Revision as of 21:09, 17 January 2022

Edit the documentation or categories for this module.
local util_args = require('Module:ArgsUtil')
local util_text = require('Module:TextUtil')
local i18n = require('Module:i18nUtil')

local h = {}
local p = {
	players_per_team = 5,
	side_names = {
		'Blue', 'Red',
		['1'] = 'Blue',
		['2'] = 'Red'
	},
	years = { 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022 },
	store_player_league_history = true, -- do we store to PlayerLeagueHistory from InfoboxPlayer? will prevent needing to sync a normally-unneeded dependency
}

function p.linkPatch(str)
	if not str then return nil end
	return util_text.intLink(p.patchPage(str), str)
end

function p.patchPage(str)
	return ('Patch %s'):format(str)
end

return p