papermario/docs/doxytheme/theme.js
Alex Bates 37f59877e5
Doxygen (#1142)
* use doxygen
* add documenting guide based on https://github.com/zeldaret/oot/blob/main/docs/Documenting.md
* exclude stdlib readme from doxygen
* refuse to configure matching iQue on macOS (EGCS compiler is not built for macOS, so iQue won't build. We still enable iQue builds on macOS by using gcc-papermario via --non-matching.)
* use proper doxygen bug comment style
* document common EVT API funcs nicely
* add doxygen ci
* add \vars command
2024-01-09 23:56:08 +00:00

50 lines
1.8 KiB
JavaScript

// Make @evtapi prototype use EVT_CALL and params
for (const item of document.querySelectorAll(".memitem:has(.evtapi)")) {
// <a id="..." /> appears 2 children before item
const id = item.previousElementSibling.previousElementSibling.id
const tbody = item.querySelector(".memproto tbody")
const name = tbody.querySelector("td.memname").childNodes[1].textContent.trim()
const params = [`<a class="el" href="#${id}">${name}</a>`]
for (const param of item.querySelectorAll(".params:not(.vars) .paramname")) {
params.push(param.textContent.trim())
}
const proto = `EVT_CALL(${params.join(", ")})`
tbody.innerHTML = `<tr>${proto}</tr>`
// Find its link
const tr = document.getElementById(`r_${id}`)
tr.innerHTML = `<td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom">${proto}</td>`
}
// Combine @vars tables
for (const table of document.querySelectorAll("table.vars + table.vars")) {
const tbody = table.querySelector("tbody")
table.previousElementSibling.querySelector("tbody").append(...tbody.childNodes)
table.remove()
}
// Wrap @vars tables in a description
for (const table of document.querySelectorAll("table.vars")) {
const dl = document.createElement("dl")
const dt = document.createElement("dt")
dt.textContent = "Variables"
dl.appendChild(dt)
const dd = document.createElement("dd")
dd.innerHTML = table.outerHTML // makes copy of table
dl.appendChild(dd)
table.replaceWith(dl)
}
// Remove spaces in [in]/[out]/[in,out]
// These can appear because of spaces between the @vars arg separators
for (const paramdir of document.querySelectorAll("table.vars .paramdir")) {
paramdir.textContent = paramdir.textContent.replace(/\s/g, "")
}