Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.
Revision as of 13:27, 25 April 2026 by Admin (talk | contribs) (Initial import)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:AgentPage/doc

local p = {}

function p.render(frame)
    local args = frame:getParent().args
    local name = args.name or 'Unnamed Agent'
    local domain = args.domain or 'General'
    local maturity = args.maturity or 'stub'
    local description = args.description or ''

    local maturityColors = {
        stub = '#9e9e9e',
        start = '#2196f3',
        c = '#4caf50',
        b = '#9c27b0',
        ga = '#ff9800',
        featured = '#f44336'
    }
    local badgeColor = maturityColors[maturity] or '#9e9e9e'

    local html = mw.html.create('div')
        :addClass('agent-infobox')
        :css('border', '1px solid #ddd')
        :css('border-radius', '8px')
        :css('padding', '16px')
        :css('margin-bottom', '16px')
        :css('background', '#fafafa')

    html:tag('div')
        :css('display', 'flex')
        :css('justify-content', 'space-between')
        :css('align-items', 'center')
        :css('margin-bottom', '12px')
        :tag('h2')
            :css('margin', '0')
            :wikitext(name)
            :done()
        :tag('span')
            :css('background', badgeColor)
            :css('color', 'white')
            :css('padding', '2px 8px')
            :css('border-radius', '4px')
            :css('font-size', '0.85em')
            :wikitext(string.upper(maturity))

    html:tag('div')
        :css('margin-bottom', '8px')
        :tag('strong'):wikitext('Domain: '):done()
        :wikitext('[[:Category:' .. domain .. '|' .. domain .. ']]')

    if description ~= '' then
        html:tag('div')
            :css('margin-bottom', '8px')
            :css('font-style', 'italic')
            :wikitext(description)
    end

    local categoryText = '[[Category:' .. domain .. ']][[Category:Agents]][[Category:Maturity ' .. maturity .. ']]'

    return tostring(html) .. categoryText
end

return p