Module:Sandbox/Vergir

From The Deadlock Wiki
Revision as of 07:55, 10 August 2026 by Vergir (talk | contribs) (Temporary verification harness for Module:ArcaneSurge (with help from vergir-bot LLM))
Jump to navigation Jump to search

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

-- Temporary harness: summarises Module:ArcaneSurge output for verification.
local p = {}

function p.check(frame)
    local out = require("Module:ArcaneSurge").render(frame)

    local heroes, abilities, notes = 0, 0, 0
    for _ in out:gmatch("<li>") do heroes = heroes + 1 end
    for _ in out:gmatch("%(after T") do notes = notes + 1 end

    local lines = {}
    for item in out:gmatch("<li>(.-)</li>") do
        local hero = item:match('data%-hero%-name="([^"]*)"') or "?"
        local names = {}
        for name in item:gmatch('data%-ability%-name="([^"]*)"') do
            table.insert(names, name)
            abilities = abilities + 1
        end
        for name in item:gmatch('data%-ability%-name="([^"]*)"[^\n]-') do end
        table.insert(lines, hero .. " = " .. table.concat(names, ", "))
    end

    -- flag which abilities carry a tier note
    local flagged = {}
    for item in out:gmatch("<li>(.-)</li>") do
        for name, tail in item:gmatch('data%-ability%-name="([^"]*)"(.-)</span></span>') do end
    end
    for name in out:gmatch('data%-ability%-name="([^"]*)"[^<]*<span[^>]*>.-</span></span> %(after T%d%)') do
        table.insert(flagged, name)
    end

    return "<pre>heroes=" .. heroes .. " abilities=" .. abilities .. " notes=" .. notes
        .. "\nnoted: " .. table.concat(flagged, ", ")
        .. "\n\n" .. table.concat(lines, "\n") .. "</pre>"
end

return p