Skip to content

Commit

Permalink
feat: add support to auto inline icon to only show icon (#4896)
Browse files Browse the repository at this point in the history
feat: add supprt to auto inline icon to display the text
  • Loading branch information
Rathoz authored Oct 17, 2024
1 parent 4ae6ce0 commit dc117c3
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions components/auto_inline_icon/commons/auto_inline_icon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,19 @@
-- Please see https://github.com/Liquipedia/Lua-Modules to contribute

local Class = require('Module:Class')
local Logic = require('Module:Logic')
local Lua = require('Module:Lua')
local InlineIconAndText = require('Module:Widget/Misc/InlineIconAndText')
local ManualData = Lua.requireIfExists('Module:InlineIcon/ManualData', {loadData = true})

local AutoInlineIcon = {}

---@param _ table
---@param options table
---@param category string
---@param lookup string
---@param extraInfo string?
---@return string
function AutoInlineIcon.display(_, category, lookup, extraInfo)
---@return Widget
function AutoInlineIcon.display(options, category, lookup, extraInfo)
assert(category, 'Category parameter is required.')
assert(lookup, 'Lookup parameter is required.')

Expand All @@ -26,15 +27,15 @@ function AutoInlineIcon.display(_, category, lookup, extraInfo)

local icon = AutoInlineIcon._iconCreator(data)

if not data.text then
return tostring(icon)
if not data.text or Logic.readBool(options.onlyicon) then
return icon
end

return tostring(InlineIconAndText{
return InlineIconAndText{
icon = icon,
text = data.text,
link = data.link,
})
}
end

---@param category string
Expand Down

0 comments on commit dc117c3

Please sign in to comment.