Module:AbilityTable: Difference between revisions

Jump to navigation Jump to search
Vergir (talk | contribs)
Restructure globals order; Notes declared in charges headers; add CSS classes to table elements (with help from vergir-bot LLM)
Vergir (talk | contribs)
Add auto-generated disclaimer with styled class above ability table (with help from vergir-bot LLM)
Line 254: Line 254:
         table.insert(final_headers, "Notes")
         table.insert(final_headers, "Notes")
     end
     end
    -- Disclaimer
    local edit_url = mw.uri.fullUrl("Module:AbilityTables", { action = "edit" })
    local disclaimer = frame:preprocess(
        '<div class="ability-table-disclaimer">'
        .. "This is an automatic list. "
        .. "[" .. tostring(edit_url) .. " Click here]"
        .. " to add notes or correct the contents."
        .. "</div>"
    )


     -- Render wikitable
     -- Render wikitable
     local out = {}
     local out = {}
    table.insert(out, disclaimer)
     table.insert(out, '{| class="wikitable sortable ability-table"')
     table.insert(out, '{| class="wikitable sortable ability-table"')


Line 287: Line 298:
         end
         end


         local row_cells = '| class="ability-table-cell-hero" | '   .. hero_cell
         local row_cells = '| class="ability-table-cell-hero" | '     .. hero_cell
                       .. ' || class="ability-table-cell-ability" | ' .. ability_cell
                       .. ' || class="ability-table-cell-ability" | ' .. ability_cell
         for _, header in ipairs(final_headers) do
         for _, header in ipairs(final_headers) do
             local value = extra[header]
             local value = extra[header]
             local cls   = "ability-table-cell-" .. header:lower():gsub("%s+", "-")
             local cls   = "ability-table-cell-" .. header:lower():gsub("%s+", "-")
             local content
             local content
             if value ~= nil then
             if value ~= nil then