Skip to content

Commit

Permalink
fix annos
Browse files Browse the repository at this point in the history
  • Loading branch information
Rathoz committed Sep 11, 2024
1 parent f1d44a8 commit 28921c5
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 23 deletions.
2 changes: 1 addition & 1 deletion components/squad/commons/squad.lua
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ function Squad:row(row)
return self
end

---@return Html
---@return string
function Squad:create()
local dataTable = Widget.TableNew{
css = {['margin-bottom'] = '10px'},
Expand Down
4 changes: 2 additions & 2 deletions components/squad/commons/squad_utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ end
---@param squadClass Squad
---@param personFunction fun(player: table, squadType: integer):WidgetTableRowNew
---@param injector WidgetInjector?
---@return Html
---@return string
function SquadUtils.defaultRunManual(frame, squadClass, personFunction, injector)
local args = Arguments.getArgs(frame)
local injectorInstance = (injector and injector()) or
Expand Down Expand Up @@ -210,7 +210,7 @@ end
---@param customTitle string?
---@param injector? WidgetInjector
---@param personMapper? fun(person: table): table
---@return Html?
---@return string?
function SquadUtils.defaultRunAuto(players, squadType, squadClass, rowCreator, customTitle, injector, personMapper)
local args = {type = squadType, title = customTitle}
local injectorInstance = (injector and injector()) or
Expand Down
2 changes: 1 addition & 1 deletion components/squad/wikis/dota2/squad_custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function ExtendedSquadRow:activeteam()
end

---@param frame Frame
---@return Html
---@return string
function CustomSquad.run(frame)
return SquadUtils.defaultRunManual(frame, Squad, CustomSquad._playerRow, CustomInjector)
end
Expand Down
4 changes: 2 additions & 2 deletions components/squad/wikis/overwatch/squad_custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function ExtendedSquadRow:number()
end

---@param frame Frame
---@return Html
---@return string
function CustomSquad.run(frame)
local args = Arguments.getArgs(frame)
local squad = Squad(args, CustomInjector()):title()
Expand All @@ -69,7 +69,7 @@ end
---@param playerList table[]
---@param squadType integer
---@param customTitle string?
---@return Html?
---@return string?
function CustomSquad.runAuto(playerList, squadType, customTitle)
return SquadUtils.defaultRunAuto(playerList, squadType, Squad, SquadUtils.defaultRow(SquadRow), customTitle)
end
Expand Down
2 changes: 1 addition & 1 deletion components/squad/wikis/smash/squad_custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function ExtendedSquadRow:mains()
end

---@param frame Frame
---@return Html
---@return string
function CustomSquad.run(frame)
local args = Arguments.getArgs(frame)
local squad = Squad(args, CustomInjector()):title():header()
Expand Down
2 changes: 1 addition & 1 deletion components/squad/wikis/starcraft/squad_custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function ExtendedSquadRow:elo()
end

---@param frame Frame
---@return Html
---@return string
function CustomSquad.run(frame)
local args = Arguments.getArgs(frame)
local tlpd = Logic.readBool(args.tlpd)
Expand Down
4 changes: 2 additions & 2 deletions components/squad/wikis/starcraft2/squad_custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ local SquadUtils = Lua.import('Module:Squad/Utils')
local CustomSquad = {}

---@param frame Frame
---@return Html
---@return string
function CustomSquad.run(frame)
return SquadUtils.defaultRunManual(frame, Squad, CustomSquad._playerRow)
end

---@param playerList table[]
---@param squadType integer
---@param customTitle string?
---@return Html?
---@return string?
function CustomSquad.runAuto(playerList, squadType, customTitle)
return SquadUtils.defaultRunAuto(
playerList,
Expand Down
4 changes: 2 additions & 2 deletions components/squad/wikis/stormgate/squad_custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ local SquadUtils = Lua.import('Module:Squad/Utils')
local CustomSquad = {}

---@param frame Frame
---@return Html
---@return string
function CustomSquad.run(frame)
return SquadUtils.defaultRunManual(frame, Squad, CustomSquad._playerRow)
end

---@param playerList table[]
---@param squadType integer
---@param customTitle string?
---@return Html?
---@return string?
function CustomSquad.runAuto(playerList, squadType, customTitle)
return SquadUtils.defaultRunAuto(
playerList,
Expand Down
18 changes: 7 additions & 11 deletions components/widget/widget_factory.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,21 @@ local WidgetFactory = Class.new()

---@param widget Widget
---@param injector WidgetInjector?
---@return Html
---@return string
function WidgetFactory.work(widget, injector)
local children = widget:tryMake(injector)

if not children then
return mw.html.create()
return ''
end

if Array.isArray(children) then
---@cast children Widget[]
local wrapper = mw.html.create()
Array.forEach(children, function(child)
wrapper:node(WidgetFactory.work(child, injector))
end)
return wrapper
if type(children) == 'string' then
return children
end

---@cast children Html
return children
return table.concat(Array.map(children, function(child)
return WidgetFactory.work(child, injector)
end))
end

return WidgetFactory

0 comments on commit 28921c5

Please sign in to comment.