diff --git a/components/widget/widget.lua b/components/widget/widget.lua index 7919829192b..28bc9cf88d6 100644 --- a/components/widget/widget.lua +++ b/components/widget/widget.lua @@ -26,10 +26,9 @@ function Widget:assertExistsAndCopy(value) return assert(String.nilIfEmpty(value), 'Tried to set a nil value to a mandatory property') end ----@param injector WidgetInjector? ---@param children string[] ---@return string|nil -function Widget:make(injector, children) +function Widget:make(children) error('A Widget must override the make() function!') end @@ -38,7 +37,7 @@ end function Widget:tryMake(injector) local processedChildren = self:tryChildren(injector) return Logic.tryOrElseLog( - function() return self:make(injector, processedChildren) end, + function() return self:make(processedChildren) end, function(error) return tostring(ErrorDisplay.InlineError(error)) end, function(error) error.header = 'Error occured in widget: (caught by Widget:tryMake)' diff --git a/components/widget/widget_breakdown.lua b/components/widget/widget_breakdown.lua index 34333140058..9358c00c33a 100644 --- a/components/widget/widget_breakdown.lua +++ b/components/widget/widget_breakdown.lua @@ -24,10 +24,9 @@ local Breakdown = Class.new( end ) ----@param injector WidgetInjector? ---@param children string[] ---@return string? -function Breakdown:make(injector, children) +function Breakdown:make(children) return Breakdown:_breakdown(children, self.classes, self.contentClasses) end diff --git a/components/widget/widget_builder.lua b/components/widget/widget_builder.lua index a89aaa6335b..09637f7715a 100644 --- a/components/widget/widget_builder.lua +++ b/components/widget/widget_builder.lua @@ -21,10 +21,9 @@ local Builder = Class.new( end ) ----@param injector WidgetInjector? ---@param children string[] ---@return string -function Builder:make(injector, children) +function Builder:make(children) return table.concat(children) end diff --git a/components/widget/widget_cell.lua b/components/widget/widget_cell.lua index df285ed61bc..db78f3c24fa 100644 --- a/components/widget/widget_cell.lua +++ b/components/widget/widget_cell.lua @@ -88,10 +88,9 @@ function Cell:_content(...) return self end ----@param injector WidgetInjector? ---@param children string[] ---@return string? -function Cell:make(injector, children) +function Cell:make(children) self:_new(self.name) self:_class(unpack(self.classes or {})) self:_content(unpack(children)) diff --git a/components/widget/widget_center.lua b/components/widget/widget_center.lua index 1a96c26d6ad..d6cee7a9588 100644 --- a/components/widget/widget_center.lua +++ b/components/widget/widget_center.lua @@ -23,10 +23,9 @@ local Center = Class.new( end ) ----@param injector WidgetInjector? ---@param children string[] ---@return string? -function Center:make(injector, children) +function Center:make(children) return Center:_create(children, self.classes) end diff --git a/components/widget/widget_chronology.lua b/components/widget/widget_chronology.lua index 5866af72275..e7ac1698db4 100644 --- a/components/widget/widget_chronology.lua +++ b/components/widget/widget_chronology.lua @@ -22,10 +22,9 @@ local Chronology = Class.new( end ) ----@param injector WidgetInjector? ---@param children string[] ---@return string? -function Chronology:make(injector, children) +function Chronology:make(children) return Chronology:_chronology(self.links) end diff --git a/components/widget/widget_customizable.lua b/components/widget/widget_customizable.lua index e2ba33ed4ab..817a6559b30 100644 --- a/components/widget/widget_customizable.lua +++ b/components/widget/widget_customizable.lua @@ -21,10 +21,9 @@ local Customizable = Class.new( end ) ----@param injector WidgetInjector? ---@param children string[] ---@return string -function Customizable:make(injector, children) +function Customizable:make(children) return table.concat(children) end diff --git a/components/widget/widget_div.lua b/components/widget/widget_div.lua index 5d9e12790a7..8cd0dfa8095 100644 --- a/components/widget/widget_div.lua +++ b/components/widget/widget_div.lua @@ -23,10 +23,9 @@ local Div = Class.new( end ) ----@param injector WidgetInjector? ---@param children string[] ---@return string? -function Div:make(injector, children) +function Div:make(children) local div = mw.html.create('div') Array.forEach(self.classes, FnUtil.curry(div.addClass, div)) Array.forEach(children, FnUtil.curry(div.node, div)) diff --git a/components/widget/widget_header.lua b/components/widget/widget_header.lua index 276edff36dd..ba9e3473cb2 100644 --- a/components/widget/widget_header.lua +++ b/components/widget/widget_header.lua @@ -35,10 +35,9 @@ local Header = Class.new( end ) ----@param injector WidgetInjector? ---@param children string[] ---@return string -function Header:make(injector, children) +function Header:make(children) local header = { Header:_name(self.name), Header:_image( diff --git a/components/widget/widget_highlights.lua b/components/widget/widget_highlights.lua index 14f517888d6..891db587b1a 100644 --- a/components/widget/widget_highlights.lua +++ b/components/widget/widget_highlights.lua @@ -21,10 +21,9 @@ local Highlights = Class.new( end ) ----@param injector WidgetInjector? ---@param children string[] ---@return string? -function Highlights:make(injector, children) +function Highlights:make(children) return Highlights:_highlights(children) end diff --git a/components/widget/widget_links.lua b/components/widget/widget_links.lua index 927b953e40e..e9fb284fe32 100644 --- a/components/widget/widget_links.lua +++ b/components/widget/widget_links.lua @@ -27,10 +27,9 @@ local Links = Class.new( local PRIORITY_GROUPS = Lua.import('Module:Links/PriorityGroups', {loadData = true}) ----@param injector WidgetInjector? ---@param children string[] ---@return string? -function Links:make(injector, children) +function Links:make(children) local infoboxLinks = mw.html.create('div') infoboxLinks :addClass('infobox-center') :addClass('infobox-icons') diff --git a/components/widget/widget_table.lua b/components/widget/widget_table.lua index ebd5085a13b..b95ffeab429 100644 --- a/components/widget/widget_table.lua +++ b/components/widget/widget_table.lua @@ -47,10 +47,9 @@ function Table:addClass(class) return self end ----@param injector WidgetInjector? ---@param children string[] ---@return string? -function Table:make(injector, children) +function Table:make(children) local displayTable = mw.html.create('div'):addClass('csstable-widget') displayTable:css{ ['grid-template-columns'] = 'repeat(' .. (self.columns or self:_getMaxCells()) .. ', auto)', diff --git a/components/widget/widget_table_cell.lua b/components/widget/widget_table_cell.lua index 68b1015c129..97dbb885225 100644 --- a/components/widget/widget_table_cell.lua +++ b/components/widget/widget_table_cell.lua @@ -55,10 +55,9 @@ function TableCell:addCss(key, value) return self end ----@param injector WidgetInjector? ---@param children string[] ---@return string? -function TableCell:make(injector, children) +function TableCell:make(children) local cell = mw.html.create('div'):addClass('csstable-widget-cell') cell:css{ ['grid-row'] = self.rowSpan and 'span ' .. self.rowSpan or nil, diff --git a/components/widget/widget_table_cell_new.lua b/components/widget/widget_table_cell_new.lua index 66d8b836c0f..da8c61a6508 100644 --- a/components/widget/widget_table_cell_new.lua +++ b/components/widget/widget_table_cell_new.lua @@ -41,10 +41,9 @@ local TableCell = Class.new( end ) ----@param injector WidgetInjector? ---@param children string[] ---@return string? -function TableCell:make(injector, children) +function TableCell:make(children) local cell = mw.html.create(self.isHeader and 'th' or 'td') cell:attr('colspan', self.colSpan) cell:attr('rowspan', self.rowSpan) diff --git a/components/widget/widget_table_new.lua b/components/widget/widget_table_new.lua index 082cf2f53cd..1a6e95db92d 100644 --- a/components/widget/widget_table_new.lua +++ b/components/widget/widget_table_new.lua @@ -30,10 +30,9 @@ local Table = Class.new( end ) ----@param injector WidgetInjector? ---@param children string[] ---@return string? -function Table:make(injector, children) +function Table:make(children) local wrapper = mw.html.create('div'):addClass('table-responsive') local output = mw.html.create('table'):addClass('wikitable') diff --git a/components/widget/widget_table_row.lua b/components/widget/widget_table_row.lua index 9004c016da7..f20e8bdde13 100644 --- a/components/widget/widget_table_row.lua +++ b/components/widget/widget_table_row.lua @@ -56,10 +56,9 @@ function TableRow:getCellCount() return #self.children end ----@param injector WidgetInjector? ---@param children string[] ---@return string? -function TableRow:make(injector, children) +function TableRow:make(children) local row = mw.html.create('div'):addClass('csstable-widget-row') for _, class in ipairs(self.classes) do diff --git a/components/widget/widget_table_row_new.lua b/components/widget/widget_table_row_new.lua index 596fdb02482..e284e14559b 100644 --- a/components/widget/widget_table_row_new.lua +++ b/components/widget/widget_table_row_new.lua @@ -30,10 +30,9 @@ local TableRow = Class.new( end ) ----@param injector WidgetInjector? ---@param children string[] ---@return string? -function TableRow:make(injector, children) +function TableRow:make(children) local row = mw.html.create('tr') Array.forEach(self.classes, FnUtil.curry(row.addClass, row)) diff --git a/components/widget/widget_title.lua b/components/widget/widget_title.lua index c388d60cff1..69f37d22826 100644 --- a/components/widget/widget_title.lua +++ b/components/widget/widget_title.lua @@ -20,10 +20,9 @@ local Title = Class.new( end ) ----@param injector WidgetInjector? ---@param children string[] ---@return string? -function Title:make(injector, children) +function Title:make(children) return Title:_create(children[1]) end