UI/Markdown: surface spellbook in MD output and sidebar

- New AE:GenerateMarkdownSpellbook(): one section per spell tab
  (General, class, pet) with icon + name + db.ascension.gg link + rank.
  Skips empty tabs.
- /coae export mdspellbook        new slash subcommand
- /coae export md                 now appends a Spellbook section after
                                  Talents in the full wiki page
- UI sidebar: "MD Spellbook" button added under Markdown (Wiki)
This commit is contained in:
2026-05-07 12:20:44 +02:00
parent 6badf0e7ea
commit f9a7ab5beb
3 changed files with 56 additions and 5 deletions
+45 -1
View File
@@ -262,6 +262,44 @@ function AE:GenerateMarkdownEnchants()
return table.concat(lines, "\n")
end
function AE:GenerateMarkdownSpellbook()
local sb = self.CollectSpellbook and self.CollectSpellbook() or { tabs = {} }
local lines = {}
table.insert(lines, "## Spellbook\n")
if not sb.tabs or #sb.tabs == 0 then
table.insert(lines, "*Spellbook not available - run `/coae debug` to check collector.*\n")
return table.concat(lines, "\n")
end
table.insert(lines, string.format("Total: **%d** spells across %d tab(s).\n",
sb.totalSpells or 0, #sb.tabs))
for _, tab in ipairs(sb.tabs) do
if tab.spells and #tab.spells > 0 then
table.insert(lines, string.format("### %s (%d)", tab.name or "Tab", #tab.spells))
table.insert(lines, "")
table.insert(lines, "| Icon | Spell | Rank |")
table.insert(lines, "|------|-------|------|")
for _, sp in ipairs(tab.spells) do
local icon = sp.icon or ""
local iconImg = icon ~= "" and string.format(
'<img src="/icons/spells/%s.png" width="20" height="20" style="vertical-align: middle;" />',
icon) or ""
local link = (sp.spellID or 0) > 0
and string.format("[%s](https://db.ascension.gg/?spell=%d)", sp.name or "", sp.spellID)
or (sp.name or "")
local rank = (sp.rank ~= nil and sp.rank ~= "") and tostring(sp.rank) or "-"
table.insert(lines, string.format("| %s | %s | %s |", iconImg, link, rank))
end
table.insert(lines, "")
end
end
return table.concat(lines, "\n")
end
function AE:GenerateMarkdownFull()
local data = self:AssembleExport("all") or {}
local char = data.character or {}
@@ -326,6 +364,10 @@ function AE:GenerateMarkdownFull()
table.insert(lines, "*No talent data - run `/coae debug` to check collector.*")
end
-- Spellbook section
table.insert(lines, "")
table.insert(lines, self:GenerateMarkdownSpellbook())
return table.concat(lines, "\n")
end
@@ -335,7 +377,7 @@ local HELP = [[
CoaExporter commands:
/coae export all|talents|spellbook|gear|enchants
/coae export mdgear|mdenchants|md (full wiki)
/coae export mdgear|mdenchants|mdspellbook|md (full wiki)
/coae catalog all|skills|talents
/coae catalog dispels [class]|passives [class]|status
/coae scrolls scan|export|reset|status
@@ -350,6 +392,8 @@ local function HandleExport(rest)
AE:ShowExport(AE:GenerateMarkdownGear(), "CoaExporter - Markdown Gear (Ctrl+C)")
elseif rest == "mdenchants" then
AE:ShowExport(AE:GenerateMarkdownEnchants(), "CoaExporter - Markdown Enchants (Ctrl+C)")
elseif rest == "mdspellbook" then
AE:ShowExport(AE:GenerateMarkdownSpellbook(), "CoaExporter - Markdown Spellbook (Ctrl+C)")
elseif rest == "md" or rest == "mdfull" or rest == "wiki" then
AE:ShowExport(AE:GenerateMarkdownFull(), "CoaExporter - Wiki Markdown (Ctrl+C)")
elseif rest == "all" or rest == "talents" or rest == "spellbook" or rest == "gear" or rest == "enchants" then
+6
View File
@@ -45,6 +45,12 @@ local function buildSections()
showExport(ae:GenerateMarkdownEnchants() or "", "CoaExporter - Markdown Enchants (Ctrl+C)")
end
end },
{ "MD Spellbook", function()
local ae = ce()
if ae and ae.GenerateMarkdownSpellbook then
showExport(ae:GenerateMarkdownSpellbook() or "", "CoaExporter - Markdown Spellbook (Ctrl+C)")
end
end },
{ "MD Full", function()
local ae = ce()
if ae and ae.GenerateMarkdownFull then
+2 -1
View File
@@ -52,7 +52,8 @@ Primary slash: `/coae`. Aliases: `/coaexp`, `/ascx`, `/asxc`.
/coae export mdgear Markdown gear table (Wiki.js)
/coae export mdenchants Markdown enchants table
/coae export md Full wiki page (header + gear + enchants + talents)
/coae export mdspellbook Markdown spellbook (one section per tab)
/coae export md Full wiki page (header + gear + enchants + talents + spellbook)
```
### Mystic scroll catalog (per-account, slow scan)