Skip to content

Commit

Permalink
Ordering xml.table and autogenerated html nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
Frityet committed Oct 19, 2023
1 parent faf734a commit a170f63
Show file tree
Hide file tree
Showing 5 changed files with 3,734 additions and 53 deletions.
38 changes: 35 additions & 3 deletions .luarc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,37 @@
{
"runtime.special": {
"typename" : "type"
}
"Lua.workspace.checkThirdParty": false,
"diagnostics.groupSeverity": {
"ambiguity": "Error",
"await": "Error",
"codestyle": "Error",
"duplicate": "Hint",
"global": "Error",
"luadoc": "Error",
"redefined": "Information",
"strict": "Error",
"strong": "Error",
"type-check": "Error",
"unbalanced": "Error",
"unused": "Hint",
"conventions": "Error"
},
"diagnostics.disable": [
"duplicate-doc-alias",
"duplicate-doc-field"
],
"runtime.path": [
"?.lua",
"?/init.lua",
],
"runtime.pathStrict": true,
"runtime.version": "LuaJIT",
"workspace.ignoreDir": [
".vscode",
".luarocks"
],
"workspace.library": [
"deps/",
"lua_modules/lib/lua/5.1/",
"lua_modules/share/lua/5.1/",
],
}
42 changes: 42 additions & 0 deletions autogen.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env lua

local data = require("parse-data") "items-raw.html"

---@alias WriteFunction fun(...: string): WriteFunction
---@alias WriteLineFunction fun(...: string): WriteFunction

---@type WriteFunction
local function w(...)
io.write(...)
return w
end

---@type WriteLineFunction
local function wl(...)
io.write(...)
io.write "\n"
return wl
end

for k, v in pairs(data) do
w "--[[# <code>" (k) '</code>\n'

wl "## Description" (v.description) '\n'

w (#v.categories > 0 and "## Categories" or "")
for _, cat in ipairs(v.categories) do
w "- " (cat) '\n'
end

w "]]\n"


w "---@class HTMLElement." (k) ' : ' "XML.Node\n"
for _, cat in ipairs(v.attributes) do
if cat.name == "global" then goto next end
w "---@field " (cat.name) " any " "[Documentation](" (cat.url or "") ")\n"
::next::
end

w "export.xml."(k)'=''export.xml.'(k) '\n\n'
end
Loading

0 comments on commit a170f63

Please sign in to comment.