Module:AbilityTable: Difference between revisions

Jump to navigation Jump to search
remove divinebarrier from extra_columns, revert get_cells contract back to (ability) only (with help from vergir-bot LLM)
Tag: Manual revert
LVL (talk | contribs)
add support for collapsible tables
Line 167: Line 167:


     local compact = mw.text.trim(frame.args["compact"] or "") ~= ""
     local compact = mw.text.trim(frame.args["compact"] or "") ~= ""
   
    local collapsed = mw.text.trim(frame.args["collapsed"] or ""):lower()


     local key_lookup, _ = build_lookup()
     local key_lookup, _ = build_lookup()
Line 251: Line 253:
     local needs_notes = (has_notes_header or stat_notes ~= nil) and not hide_set["Notes"]
     local needs_notes = (has_notes_header or stat_notes ~= nil) and not hide_set["Notes"]
     if needs_notes then table.insert(final_headers, "Notes") end
     if needs_notes then table.insert(final_headers, "Notes") end
    local table_class = 'wikitable sortable ability-table'
    if collapsed ~= "" then
        table_class = table_class .. ' mw-collapsible'
        if collapsed == "yes" or collapsed == "true" or collapsed == "1" then
            table_class = table_class .. ' mw-collapsed'
        end
    end


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


     local header_row = '! class="ability-table-col-hero" | Hero'
     local header_row = '! class="ability-table-col-hero" | Hero'