From a170f636b43653d59aa2cc689f9d5ec368b3e41a Mon Sep 17 00:00:00 2001 From: Amrit Bhogal Date: Thu, 19 Oct 2023 15:02:46 -0700 Subject: [PATCH] Ordering xml.table and autogenerated html nodes --- .luarc.json | 38 +- autogen.lua | 42 + items-raw.html | 2074 +++++++++++++++++++++++++++++++++++++++++++++ parse-data.lua | 132 +++ xml-generator.lua | 1501 ++++++++++++++++++++++++++++++-- 5 files changed, 3734 insertions(+), 53 deletions(-) create mode 100644 autogen.lua create mode 100644 items-raw.html create mode 100644 parse-data.lua diff --git a/.luarc.json b/.luarc.json index 3d0fa2b..8ee8ac3 100644 --- a/.luarc.json +++ b/.luarc.json @@ -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/", + ], } diff --git a/autogen.lua b/autogen.lua new file mode 100644 index 0000000..dff9708 --- /dev/null +++ b/autogen.lua @@ -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 "--[[# " (k) '\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 diff --git a/items-raw.html b/items-raw.html new file mode 100644 index 0000000..ebd90f5 --- /dev/null +++ b/items-raw.html @@ -0,0 +1,2074 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
List of elements
Element + Description + Categories + Parents† + Children + Attributes + Interface +
aHyperlinkflow; + phrasing*; + interactive; + palpable + phrasingtransparent*globals; + href; + target; + download; + ping; + rel; + hreflang; + type; + referrerpolicy + HTMLAnchorElement
abbr + Abbreviationflow; + phrasing; + palpable + phrasingphrasingglobalsHTMLElement
address + Contact information for a page or article + elementflow; + palpable + flowflow*globalsHTMLElement
areaHyperlink or dead area on an image mapflow; + phrasing + phrasing*emptyglobals; + alt; + coords; + shape; + href; + target; + download; + ping; + rel; + referrerpolicy + HTMLAreaElement
article + Self-contained syndicatable or reusable compositionflow; + sectioning; + palpable + flowflowglobalsHTMLElement
asideSidebar for tangentially related contentflow; + sectioning; + palpable + flowflowglobalsHTMLElement
audioAudio playerflow; + phrasing; + embedded; + interactive; + palpable* + phrasingsource*; + track*; + transparent* + globals; + src; + crossorigin; + preload; + autoplay; + loop; + muted; + controls + HTMLAudioElement
bKeywordsflow; + phrasing; + palpable + phrasingphrasingglobalsHTMLElement
baseBase URL and default target navigable for hyperlinks and + formsmetadataheademptyglobals; + href; + target + HTMLBaseElement
bdi + Text directionality isolationflow; + phrasing; + palpable + phrasingphrasingglobalsHTMLElement
bdo + Text directionality formattingflow; + phrasing; + palpable + phrasingphrasingglobalsHTMLElement
blockquote + A section quoted from another sourceflow; + palpable + flowflowglobals; + cite + HTMLQuoteElement
bodyDocument bodynonehtmlflowglobals; + onafterprint; + onbeforeprint; + onbeforeunload; + onhashchange; + onlanguagechange; + onmessage; + onmessageerror; + onoffline; + ononline; + onpagehide; + onpageshow; + onpopstate; + onrejectionhandled; + onstorage; + onunhandledrejection; + onunload + HTMLBodyElement
br + Line break, e.g. in poem or postal addressflow; + phrasing + phrasingemptyglobalsHTMLBRElement
button + Button controlflow; + phrasing; + interactive; + listed; + labelable; + submittable; + form-associated; + palpable + phrasingphrasing*globals; + disabled; + form; + formaction; + formenctype; + formmethod; + formnovalidate; + formtarget; + name; + popovertarget; + popovertargetaction; + type; + value + HTMLButtonElement
canvasScriptable bitmap canvasflow; + phrasing; + embedded; + palpable + phrasingtransparentglobals; + width; + height + HTMLCanvasElement
caption + Table captionnonetableflow*globalsHTMLTableCaptionElement
cite + Title of a workflow; + phrasing; + palpable + phrasingphrasingglobalsHTMLElement
code + Computer codeflow; + phrasing; + palpable + phrasingphrasingglobalsHTMLElement
colTable columnnonecolgroup + emptyglobals; + span + HTMLTableColElement
colgroup + Group of columns in a tablenonetablecol*; + template* + globals; + span + HTMLTableColElement
data + Machine-readable equivalentflow; + phrasing; + palpable + phrasingphrasingglobals; + value + HTMLDataElement
datalist + Container for options for combo box + controlflow; + phrasing + phrasingphrasing*; + option*; + script-supporting elements* + globalsHTMLDataListElement
ddContent for corresponding dt + element(s)nonedl; + div* + flowglobalsHTMLElement
delA removal from the documentflow; + phrasing*; + palpable + phrasingtransparentglobals; + cite; + datetime + HTMLModElement
details + Disclosure control for hiding detailsflow; + interactive; + palpable + flowsummary*; + flow + globals; + name; + open + HTMLDetailsElement
dfn + Defining instanceflow; + phrasing; + palpable + phrasingphrasing*globalsHTMLElement
dialog + Dialog box or windowflowflowflowglobals; + open + HTMLDialogElement
div + Generic flow container, or container for name-value groups in dl + elementsflow; + palpable + flow; + dl + flowglobalsHTMLDivElement
dlAssociation list consisting of zero or more name-value groupsflow; + palpable + flowdt*; + dd*; + div*; + script-supporting elements + globalsHTMLDListElement
dtLegend for corresponding dd + element(s)nonedl; + div* + flow*globalsHTMLElement
em + Stress emphasisflow; + phrasing; + palpable + phrasingphrasingglobalsHTMLElement
embed + Pluginflow; + phrasing; + embedded; + interactive; + palpable + phrasingemptyglobals; + src; + type; + width; + height; + any* + HTMLEmbedElement
fieldset + Group of form controlsflow; + listed; + form-associated; + palpable + flowlegend*; + flow + globals; + disabled; + form; + name + HTMLFieldSetElement
figcaption + Caption for figure + nonefigure + flowglobalsHTMLElement
figure + Figure with optional captionflow; + palpable + flowfigcaption*; + flow + globalsHTMLElement
footer + Footer for a page or sectionflow; + palpable + flowflow*globalsHTMLElement
formUser-submittable formflow; + palpable + flowflow*globals; + accept-charset; + action; + autocomplete; + enctype; + method; + name; + novalidate; + rel; + target + HTMLFormElement
h1, + h2, + h3, + h4, + h5, + h6 + Headingflow; + heading; + palpable + legend; + summary; + flow + phrasingglobalsHTMLHeadingElement
headContainer for document metadatanonehtmlmetadata content*globalsHTMLHeadElement
header + Introductory or navigational aids for a page or sectionflow; + palpable + flowflow*globalsHTMLElement
hgroup + Heading containerflow; + palpable + + legend; + summary; + flow + h1; + h2; + h3; + h4; + h5; + h6; + script-supporting elements + globalsHTMLElement
hrThematic breakflowflowemptyglobalsHTMLHRElement
htmlRoot elementnonenone*head*; + body* + globals; + manifest + HTMLHtmlElement
iAlternate voiceflow; + phrasing; + palpable + phrasingphrasingglobalsHTMLElement
iframe + Child navigable + flow; + phrasing; + embedded; + interactive; + palpable + phrasingemptyglobals; + src; + srcdoc; + name; + sandbox; + allow; + allowfullscreen; + width; + height; + referrerpolicy; + loading + HTMLIFrameElement
img + Imageflow; + phrasing; + embedded; + interactive*; + form-associated; + palpable + phrasing; + picture + emptyglobals; + alt; + src; + srcset; + sizes; + crossorigin; + usemap; + ismap; + width; + height; + referrerpolicy; + decoding; + loading; + fetchpriority + HTMLImageElement
inputForm controlflow; + phrasing; + interactive*; + listed; + labelable; + submittable; + resettable; + form-associated; + palpable* + phrasingemptyglobals; + accept; + alt; + autocomplete; + checked; + dirname; + disabled; + form; + formaction; + formenctype; + formmethod; + formnovalidate; + formtarget; + height; + list; + max; + maxlength; + min; + minlength; + multiple; + name; + pattern; + placeholder; + popovertarget; + popovertargetaction; + readonly; + required; + size; + src; + step; + type; + value; + width + HTMLInputElement
insAn addition to the documentflow; + phrasing*; + palpable + phrasingtransparentglobals; + cite; + datetime + HTMLModElement
kbd + User inputflow; + phrasing; + palpable + phrasingphrasingglobalsHTMLElement
labelCaption for a form controlflow; + phrasing; + interactive; + palpable + phrasingphrasing*globals; + for + HTMLLabelElement
legend + Caption for fieldset + nonefieldset + phrasing; + heading content + globalsHTMLLegendElement
liList itemnoneol; + ul; + menu* + flowglobals; + value* + HTMLLIElement
linkLink metadatametadata; + flow*; + phrasing* + head; + noscript*; + phrasing* + emptyglobals; + href; + crossorigin; + rel; + as; + media; + hreflang; + type; + sizes; + imagesrcset; + imagesizes; + referrerpolicy; + integrity; + blocking; + color; + disabled; + fetchpriority + HTMLLinkElement
main + Container for the dominant contents of the documentflow; + palpable + flow*flowglobalsHTMLElement
mapImage mapflow; + phrasing*; + palpable + phrasingtransparent; + area* + globals; + name + HTMLMapElement
mark + Highlightflow; + phrasing; + palpable + phrasingphrasingglobalsHTMLElement
MathML mathMathML rootflow; + phrasing; + embedded; + palpable + phrasingper [MATHML]per [MATHML]Element +
menu + Menu of commandsflow; + palpable* + flowli; + script-supporting elements + globalsHTMLMenuElement
metaText metadatametadata; + flow*; + phrasing* + head; + noscript*; + phrasing* + emptyglobals; + name; + http-equiv; + content; + charset; + media + HTMLMetaElement
meter + Gaugeflow; + phrasing; + labelable; + palpable + phrasingphrasing*globals; + value; + min; + max; + low; + high; + optimum + HTMLMeterElement
navSection with navigational linksflow; + sectioning; + palpable + flowflowglobalsHTMLElement
noscript + Fallback content for scriptmetadata; + flow; + phrasing + head*; + phrasing* + varies*globalsHTMLElement
object + Image, child + navigable, or pluginflow; + phrasing; + embedded; + interactive*; + listed; + form-associated; + palpable + phrasingtransparentglobals; + data; + type; + name; + form; + width; + height + HTMLObjectElement
olOrdered listflow; + palpable* + flowli; + script-supporting elements + globals; + reversed; + start; + type + HTMLOListElement
optgroup + Group of options in a list boxnoneselect + option; + script-supporting elements + globals; + disabled; + label + HTMLOptGroupElement
option + Option in a list box or combo box controlnoneselect; + datalist; + optgroup + text*globals; + disabled; + label; + selected; + value + HTMLOptionElement
output + Calculated output valueflow; + phrasing; + listed; + labelable; + resettable; + form-associated; + palpable + phrasingphrasingglobals; + for; + form; + name + HTMLOutputElement
pParagraphflow; + palpable + flowphrasingglobalsHTMLParagraphElement
picture + Imageflow; + phrasing; + embedded; + palpable + phrasingsource*; + one img; + script-supporting elements + globalsHTMLPictureElement
pre + Block of preformatted textflow; + palpable + flowphrasingglobalsHTMLPreElement
progress + Progress barflow; + phrasing; + labelable; + palpable + phrasingphrasing*globals; + value; + max + HTMLProgressElement
qQuotationflow; + phrasing; + palpable + phrasingphrasingglobals; + cite + HTMLQuoteElement
rp + Parenthesis for ruby annotation textnoneruby + textglobalsHTMLElement
rt + Ruby annotation textnoneruby + phrasingglobalsHTMLElement
ruby + Ruby annotation(s)flow; + phrasing; + palpable + phrasingphrasing; + rt; + rp* + globalsHTMLElement
sInaccurate textflow; + phrasing; + palpable + phrasingphrasingglobalsHTMLElement
samp + Computer outputflow; + phrasing; + palpable + phrasingphrasingglobalsHTMLElement
script + Embedded scriptmetadata; + flow; + phrasing; + script-supporting + head; + phrasing; + script-supporting + script, data, or script documentation*globals; + src; + type; + nomodule; + async; + defer; + crossorigin; + integrity; + referrerpolicy; + blocking; + fetchpriority + HTMLScriptElement
search + Container for search controlsflow; + palpable + flowflowglobalsHTMLElement
section + Generic document or application sectionflow; + sectioning; + palpable + flowflowglobalsHTMLElement
select + List box controlflow; + phrasing; + interactive; + listed; + labelable; + submittable; + resettable; + form-associated; + palpable + phrasingoption; + optgroup; + script-supporting elements + globals; + autocomplete; + disabled; + form; + multiple; + name; + required; + size + HTMLSelectElement
slotShadow tree slotflow; + phrasing + phrasingtransparentglobals; + name + HTMLSlotElement
small + Side commentflow; + phrasing; + palpable + phrasingphrasingglobalsHTMLElement
source + Image source for img or + media source for video or audiononepicture; + video; + audio + emptyglobals; + type; + media; + src; + srcset; + sizes; + width; + height + HTMLSourceElement
span + Generic phrasing containerflow; + phrasing; + palpable + phrasingphrasingglobalsHTMLSpanElement
strong + Importanceflow; + phrasing; + palpable + phrasingphrasingglobalsHTMLElement
styleEmbedded styling informationmetadatahead; + noscript* + text*globals; + media; + blocking + HTMLStyleElement
sub + Subscriptflow; + phrasing; + palpable + phrasingphrasingglobalsHTMLElement
summary + Caption for details + nonedetails + phrasing; + heading content + globalsHTMLElement
sup + Superscriptflow; + phrasing; + palpable + phrasingphrasingglobalsHTMLElement
SVG svgSVG rootflow; + phrasing; + embedded; + palpable + phrasingper [SVG]per [SVG]SVGSVGElement +
tableTableflow; + palpable + flowcaption*; + colgroup*; + thead*; + tbody*; + tfoot*; + tr*; + script-supporting elements + globalsHTMLTableElement
tbodyGroup of rows in a tablenonetabletr; + script-supporting elements + globalsHTMLTableSectionElement
tdTable cellnonetrflowglobals; + colspan; + rowspan; + headers + HTMLTableCellElement
template + Templatemetadata; + flow; + phrasing; + script-supporting + metadata; + phrasing; + script-supporting; + colgroup* + emptyglobalsHTMLTemplateElement
textarea + Multiline text controlsflow; + phrasing; + interactive; + listed; + labelable; + submittable; + resettable; + form-associated; + palpable + phrasingtextglobals; + autocomplete; + cols; + dirname; + disabled; + form; + maxlength; + minlength; + name; + placeholder; + readonly; + required; + rows; + wrap + HTMLTextAreaElement
tfootGroup of footer rows in a tablenonetabletr; + script-supporting elements + globalsHTMLTableSectionElement
thTable header cellinteractive*trflow*globals; + colspan; + rowspan; + headers; + scope; + abbr + HTMLTableCellElement
theadGroup of heading rows in a tablenonetabletr; + script-supporting elements + globalsHTMLTableSectionElement
time + Machine-readable equivalent of date- or time-related dataflow; + phrasing; + palpable + phrasingphrasingglobals; + datetime + HTMLTimeElement
titleDocument titlemetadataheadtext*globalsHTMLTitleElement
trTable rownonetable; + thead; + tbody; + tfoot + th*; + td; + script-supporting elements + globalsHTMLTableRowElement
trackTimed text tracknoneaudio; + video + emptyglobals; + default; + kind; + label; + src; + srclang + HTMLTrackElement
uUnarticulated annotationflow; + phrasing; + palpable + phrasingphrasingglobalsHTMLElement
ulListflow; + palpable* + flowli; + script-supporting elements + globalsHTMLUListElement
var + Variableflow; + phrasing; + palpable + phrasingphrasingglobalsHTMLElement
videoVideo playerflow; + phrasing; + embedded; + interactive; + palpable + phrasingsource*; + track*; + transparent* + globals; + src; + crossorigin; + poster; + preload; + autoplay; + playsinline; + loop; + muted; + controls; + width; + height + HTMLVideoElement
wbr + Line breaking opportunityflow; + phrasing + phrasingemptyglobalsHTMLElement
autonomous custom elementsAuthor-defined elementsflow; + phrasing; + palpable + flow; + phrasing + transparentglobals; any, as decided + by the element's authorSupplied by the element's author (inherits from HTMLElement)
diff --git a/parse-data.lua b/parse-data.lua new file mode 100644 index 0000000..9089aff --- /dev/null +++ b/parse-data.lua @@ -0,0 +1,132 @@ +local xml = require("xml2lua") +local parser = xml.parser(require("xmlhandler.tree")) + +---@class Element.Attribute +---@field name string +---@field url string + +---@class Element +---@field attributes Element.Attribute[] +---@field categories string[] +---@field description string + +---@param filename string +---@return { [string]: Element } +return function(filename) + ---@type string + local contents do + local file = assert(io.open(filename, "r")) + contents = file:read("*a") + file:close() + end + + parser:parse(contents) + + local BASE_URL = "https://html.spec.whatwg.org/multipage/" + + local body = parser.handler.root.table.tbody + + local data = {} + for _, row in ipairs(body.tr) do + local row_data = nil + for index, cell in pairs(row) do + if index == "th" then + io.stderr:write(xml.toString(cell), '\n') + io.stderr:write("-----------\n") + local txt = ((cell.code or {}).a or {})[1] + if not txt then goto next end + row_data = {} + data[txt] = row_data + else + if not row_data then goto next end + + --#region Description + local desc = cell[1] + do + --for example: + --[[ + Contact information for a page or article element + ]] + if type(desc) == "table" then + row_data.description = xml.toXml(desc, "lol-ignore-this") + row_data.description = row_data.description:gsub('dl +## Description +Association list consisting of zero or more name-value groups ----Usage: ---[=[ -```lua -local generate_html = require("html") - -local str = generate_html(function() - return html { - head { - title "Hello" - }, - body { - div { id = "main" } { - h1 "Hello", - img { src = "http://leafo.net/hi" } - p [[This is a paragraph]] - } - } - } -end) -``` -]=] +]] +---@class HTMLElement.dl : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.dl=export.xml.dl + +--[[# datalist +## Description +Container for options for + + +]] +---@class HTMLElement.datalist : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.datalist=export.xml.datalist + +--[[# blockquote +## Description +A section quoted from another source + + +]] +---@class HTMLElement.blockquote : XML.Node +export.xml.blockquote=export.xml.blockquote + +--[[# dd +## Description + + Content for corresponding + element(s) + + + dt + + + + + + +]] +---@class HTMLElement.dd : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.dd=export.xml.dd + +--[[# tbody +## Description +Group of rows in a table + + +]] +---@class HTMLElement.tbody : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.tbody=export.xml.tbody + +--[[# style +## Description +Embedded styling information + + +]] +---@class HTMLElement.style : XML.Node +---@field media any [Documentation](https://html.spec.whatwg.org/multipage/semantics.html#attr-style-media) +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.style=export.xml.style + +--[[# ol +## Description +Ordered list + + +## Categories- flow +- palpable +]] +---@class HTMLElement.ol : XML.Node +---@field reversed any [Documentation](https://html.spec.whatwg.org/multipage/grouping-content.html#attr-ol-reversed) +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.ol=export.xml.ol + +--[[# dt +## Description + + Legend for corresponding + element(s) + + + dd + + + + + + +]] +---@class HTMLElement.dt : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.dt=export.xml.dt + +--[[# div +## Description + + Generic flow container, or container for name-value groups in + elements + + + dl + + + + + + +]] +---@class HTMLElement.div : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.div=export.xml.div + +--[[# hgroup +## Description +Heading container + + +]] +---@class HTMLElement.hgroup : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.hgroup=export.xml.hgroup + +--[[# template +## Description +Template + + +## Categories- metadata +- flow +- phrasing +- script-supporting +]] +---@class HTMLElement.template : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.template=export.xml.template + +--[[# header +## Description +Introductory or navigational aids for a page or section + + +]] +---@class HTMLElement.header : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.header=export.xml.header + +--[[# del +## Description +A removal from the document + + +## Categories- flow +- phrasing +- palpable +]] +---@class HTMLElement.del : XML.Node +---@field cite any [Documentation](https://html.spec.whatwg.org/multipage/edits.html#attr-mod-cite) +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.del=export.xml.del + +--[[# img +## Description +Image + + +## Categories- flow +- phrasing +- embedded +- interactive +- form-associated +- palpable +]] +---@class HTMLElement.img : XML.Node +---@field alt any [Documentation](https://html.spec.whatwg.org/multipage/embedded-content.html#attr-img-alt) +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.img=export.xml.img + +--[[# td +## Description +Table cell + + +]] +---@class HTMLElement.td : XML.Node +---@field colspan any [Documentation](https://html.spec.whatwg.org/multipage/tables.html#attr-tdth-colspan) +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.td=export.xml.td + +--[[# abbr +## Description +Abbreviation + + +## Categories- flow +- phrasing +- palpable +]] +---@class HTMLElement.abbr : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.abbr=export.xml.abbr + +--[[# menu +## Description +Menu of commands + + +## Categories- flow +- palpable +]] +---@class HTMLElement.menu : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.menu=export.xml.menu + +--[[# dfn +## Description +Defining instance + + +## Categories- flow +- phrasing +- palpable +]] +---@class HTMLElement.dfn : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.dfn=export.xml.dfn + +--[[# span +## Description +Generic phrasing container + + +## Categories- flow +- phrasing +- palpable +]] +---@class HTMLElement.span : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.span=export.xml.span + +--[[# iframe +## Description + + + Child navigable + + + + + +## Categories- flow +- phrasing +- embedded +- interactive +- palpable +]] +---@class HTMLElement.iframe : XML.Node +---@field src any [Documentation](https://html.spec.whatwg.org/multipage/iframe-embed-object.html#attr-iframe-src) +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.iframe=export.xml.iframe + +--[[# meter +## Description +Gauge + + +## Categories- flow +- phrasing +- labelable +- palpable +]] +---@class HTMLElement.meter : XML.Node +---@field value any [Documentation](https://html.spec.whatwg.org/multipage/form-elements.html#attr-meter-value) +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.meter=export.xml.meter + +--[[# wbr +## Description +Line breaking opportunity + + +]] +---@class HTMLElement.wbr : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.wbr=export.xml.wbr + +--[[# area +## Description +Hyperlink or dead area on an image map + + +]] +---@class HTMLElement.area : XML.Node +---@field alt any [Documentation](https://html.spec.whatwg.org/multipage/image-maps.html#attr-area-alt) +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.area=export.xml.area + +--[[# video +## Description +Video player + + +## Categories- flow +- phrasing +- embedded +- interactive +- palpable +]] +---@class HTMLElement.video : XML.Node +---@field src any [Documentation](https://html.spec.whatwg.org/multipage/media.html#attr-media-src) +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.video=export.xml.video + +--[[# var +## Description +Variable + + +## Categories- flow +- phrasing +- palpable +]] +---@class HTMLElement.var : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.var=export.xml.var + +--[[# ul +## Description +List + + +## Categories- flow +- palpable +]] +---@class HTMLElement.ul : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.ul=export.xml.ul + +--[[# u +## Description +Unarticulated annotation + + +## Categories- flow +- phrasing +- palpable +]] +---@class HTMLElement.u : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.u=export.xml.u + +--[[# noscript +## Description +Fallback content for script + + +## Categories- metadata +- flow +- phrasing +]] +---@class HTMLElement.noscript : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.noscript=export.xml.noscript + +--[[# track +## Description +Timed text track + + +]] +---@class HTMLElement.track : XML.Node +---@field default any [Documentation](https://html.spec.whatwg.org/multipage/media.html#attr-track-default) +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.track=export.xml.track + +--[[# source +## Description + + Image source for + or + media source for + or + + + + img + + + + + video + + + + + audio + + + + + + + +]] +---@class HTMLElement.source : XML.Node +---@field type any [Documentation](https://html.spec.whatwg.org/multipage/embedded-content.html#attr-source-type) +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.source=export.xml.source + +--[[# dialog +## Description +Dialog box or window + + +]] +---@class HTMLElement.dialog : XML.Node +export.xml.dialog=export.xml.dialog + +--[[# title +## Description +Document title + + +]] +---@class HTMLElement.title : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.title=export.xml.title + +--[[# time +## Description +Machine-readable equivalent of date- or time-related data + + +## Categories- flow +- phrasing +- palpable +]] +---@class HTMLElement.time : XML.Node +export.xml.time=export.xml.time + +--[[# details +## Description +Disclosure control for hiding details + + +## Categories- flow +- interactive +- palpable +]] +---@class HTMLElement.details : XML.Node +---@field name any [Documentation](https://html.spec.whatwg.org/multipage/interactive-elements.html#attr-details-name) +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.details=export.xml.details + +--[[# nav +## Description +Section with navigational links + + +## Categories- flow +- sectioning +- palpable +]] +---@class HTMLElement.nav : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.nav=export.xml.nav + +--[[# i +## Description +Alternate voice + + +## Categories- flow +- phrasing +- palpable +]] +---@class HTMLElement.i : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.i=export.xml.i + +--[[# search +## Description +Container for search controls + + +]] +---@class HTMLElement.search : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.search=export.xml.search + +--[[# fieldset +## Description +Group of form controls + + +## Categories- flow +- listed +- form-associated +- palpable +]] +---@class HTMLElement.fieldset : XML.Node +---@field disabled any [Documentation](https://html.spec.whatwg.org/multipage/form-elements.html#attr-fieldset-disabled) +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.fieldset=export.xml.fieldset + +--[[# tr +## Description +Table row + + +]] +---@class HTMLElement.tr : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.tr=export.xml.tr + +--[[# progress +## Description +Progress bar + + +## Categories- flow +- phrasing +- labelable +- palpable +]] +---@class HTMLElement.progress : XML.Node +---@field value any [Documentation](https://html.spec.whatwg.org/multipage/form-elements.html#attr-progress-value) +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.progress=export.xml.progress + +--[[# sub +## Description +Subscript + + +## Categories- flow +- phrasing +- palpable +]] +---@class HTMLElement.sub : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.sub=export.xml.sub + +--[[# figcaption +## Description +Caption for + + +]] +---@class HTMLElement.figcaption : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.figcaption=export.xml.figcaption + +--[[# col +## Description +Table column + + +]] +---@class HTMLElement.col : XML.Node +export.xml.col=export.xml.col + +--[[# table +## Description +Table + + +]] +---@class HTMLElement.table : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.table=export.xml.table + +--[[# object +## Description + + Image, + , or + + + child + navigable + + + plugin + + + + + + +## Categories- flow +- phrasing +- embedded +- interactive +- listed +- form-associated +- palpable +]] +---@class HTMLElement.object : XML.Node +---@field data any [Documentation](https://html.spec.whatwg.org/multipage/iframe-embed-object.html#attr-object-data) +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.object=export.xml.object + +--[[# sup +## Description +Superscript + + +## Categories- flow +- phrasing +- palpable +]] +---@class HTMLElement.sup : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.sup=export.xml.sup + +--[[# summary +## Description +Caption for + + +]] +---@class HTMLElement.summary : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.summary=export.xml.summary + +--[[# head +## Description +Container for document metadata + + +]] +---@class HTMLElement.head : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.head=export.xml.head + +--[[# form +## Description +User-submittable form + + +]] +---@class HTMLElement.form : XML.Node +---@field accept-charset any [Documentation](https://html.spec.whatwg.org/multipage/forms.html#attr-form-accept-charset) +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.form=export.xml.form + +--[[# aside +## Description +Sidebar for tangentially related content + + +## Categories- flow +- sectioning +- palpable +]] +---@class HTMLElement.aside : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.aside=export.xml.aside + +--[[# hr +## Description +Thematic break + + +]] +---@class HTMLElement.hr : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.hr=export.xml.hr + +--[[# embed +## Description + + + Plugin + + + + + +## Categories- flow +- phrasing +- embedded +- interactive +- palpable +]] +---@class HTMLElement.embed : XML.Node +---@field src any [Documentation](https://html.spec.whatwg.org/multipage/iframe-embed-object.html#attr-embed-src) +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.embed=export.xml.embed + +--[[# textarea +## Description +Multiline text controls + + +## Categories- flow +- phrasing +- interactive +- listed +- labelable +- submittable +- resettable +- form-associated +- palpable +]] +---@class HTMLElement.textarea : XML.Node +---@field autocomplete any [Documentation](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-autocomplete) +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.textarea=export.xml.textarea + +--[[# small +## Description +Side comment + + +## Categories- flow +- phrasing +- palpable +]] +---@class HTMLElement.small : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.small=export.xml.small + +--[[# b +## Description +Keywords + + +## Categories- flow +- phrasing +- palpable +]] +---@class HTMLElement.b : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.b=export.xml.b + +--[[# a +## Description +Hyperlink + + +## Categories- flow +- phrasing +- interactive +- palpable +]] +---@class HTMLElement.a : XML.Node +---@field href any [Documentation](https://html.spec.whatwg.org/multipage/links.html#attr-hyperlink-href) +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.a=export.xml.a + +--[[# br +## Description +Line break, e.g. in poem or postal address + + +]] +---@class HTMLElement.br : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.br=export.xml.br + +--[[# option +## Description +Option in a list box or combo box control + + +]] +---@class HTMLElement.option : XML.Node +---@field disabled any [Documentation](https://html.spec.whatwg.org/multipage/form-elements.html#attr-option-disabled) +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.option=export.xml.option + +--[[# pre +## Description +Block of preformatted text + + +]] +---@class HTMLElement.pre : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.pre=export.xml.pre + +--[[# samp +## Description +Computer output + + +## Categories- flow +- phrasing +- palpable +]] +---@class HTMLElement.samp : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.samp=export.xml.samp + +--[[# mark +## Description +Highlight + + +## Categories- flow +- phrasing +- palpable +]] +---@class HTMLElement.mark : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.mark=export.xml.mark + +--[[# section +## Description +Generic document or application section + + +## Categories- flow +- sectioning +- palpable +]] +---@class HTMLElement.section : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.section=export.xml.section + +--[[# tfoot +## Description +Group of footer rows in a table + + +]] +---@class HTMLElement.tfoot : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.tfoot=export.xml.tfoot + +--[[# body +## Description +Document body + + +]] +---@class HTMLElement.body : XML.Node +---@field onafterprint any [Documentation](https://html.spec.whatwg.org/multipage/webappapis.html#handler-window-onafterprint) +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.body=export.xml.body + +--[[# output +## Description +Calculated output value + + +## Categories- flow +- phrasing +- listed +- labelable +- resettable +- form-associated +- palpable +]] +---@class HTMLElement.output : XML.Node +---@field for any [Documentation](https://html.spec.whatwg.org/multipage/form-elements.html#attr-output-for) +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.output=export.xml.output + +--[[# script +## Description +Embedded script + + +## Categories- metadata +- flow +- phrasing +- script-supporting +]] +---@class HTMLElement.script : XML.Node +---@field src any [Documentation](https://html.spec.whatwg.org/multipage/scripting.html#attr-script-src) +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.script=export.xml.script + +--[[# cite +## Description +Title of a work + + +## Categories- flow +- phrasing +- palpable +]] +---@class HTMLElement.cite : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.cite=export.xml.cite + +--[[# slot +## Description +Shadow tree slot + + +]] +---@class HTMLElement.slot : XML.Node +export.xml.slot=export.xml.slot + +--[[# s +## Description +Inaccurate text + + +## Categories- flow +- phrasing +- palpable +]] +---@class HTMLElement.s : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.s=export.xml.s + +--[[# article +## Description +Self-contained syndicatable or reusable composition + + +## Categories- flow +- sectioning +- palpable +]] +---@class HTMLElement.article : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.article=export.xml.article + +--[[# audio +## Description +Audio player + + +## Categories- flow +- phrasing +- embedded +- interactive +- palpable +]] +---@class HTMLElement.audio : XML.Node +---@field src any [Documentation](https://html.spec.whatwg.org/multipage/media.html#attr-media-src) +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.audio=export.xml.audio + +--[[# input +## Description +Form control + + +## Categories- flow +- phrasing +- interactive +- listed +- labelable +- submittable +- resettable +- form-associated +- palpable +]] +---@class HTMLElement.input : XML.Node +---@field accept any [Documentation](https://html.spec.whatwg.org/multipage/input.html#attr-input-accept) +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.input=export.xml.input + +--[[# p +## Description +Paragraph + + +]] +---@class HTMLElement.p : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.p=export.xml.p + +--[[# bdi +## Description +Text directionality isolation + + +## Categories- flow +- phrasing +- palpable +]] +---@class HTMLElement.bdi : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.bdi=export.xml.bdi + +--[[# bdo +## Description +Text directionality formatting + + +## Categories- flow +- phrasing +- palpable +]] +---@class HTMLElement.bdo : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.bdo=export.xml.bdo + +--[[# rt +## Description +Ruby annotation text + + +]] +---@class HTMLElement.rt : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.rt=export.xml.rt + +--[[# map +## Description + + + Image map + + + + + +## Categories- flow +- phrasing +- palpable +]] +---@class HTMLElement.map : XML.Node +export.xml.map=export.xml.map + +--[[# main +## Description +Container for the dominant contents of the document + + +]] +---@class HTMLElement.main : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.main=export.xml.main + +--[[# figure +## Description +Figure with optional caption + + +]] +---@class HTMLElement.figure : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.figure=export.xml.figure + +--[[# colgroup +## Description +Group of columns in a table + + +]] +---@class HTMLElement.colgroup : XML.Node +export.xml.colgroup=export.xml.colgroup + +--[[# q +## Description +Quotation + + +## Categories- flow +- phrasing +- palpable +]] +---@class HTMLElement.q : XML.Node +export.xml.q=export.xml.q + +--[[# button +## Description +Button control + + +## Categories- flow +- phrasing +- interactive +- listed +- labelable +- submittable +- form-associated +- palpable +]] +---@class HTMLElement.button : XML.Node +---@field disabled any [Documentation](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-disabled) +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.button=export.xml.button + +--[[# picture +## Description +Image + + +## Categories- flow +- phrasing +- embedded +- palpable +]] +---@class HTMLElement.picture : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.picture=export.xml.picture + +--[[# select +## Description +List box control + + +## Categories- flow +- phrasing +- interactive +- listed +- labelable +- submittable +- resettable +- form-associated +- palpable +]] +---@class HTMLElement.select : XML.Node +---@field autocomplete any [Documentation](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-autocomplete) +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.select=export.xml.select + +--[[# code +## Description +Computer code + + +## Categories- flow +- phrasing +- palpable +]] +---@class HTMLElement.code : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.code=export.xml.code + +--[[# caption +## Description +Table caption + + +]] +---@class HTMLElement.caption : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.caption=export.xml.caption + +--[[# html +## Description +Root element + + +]] +---@class HTMLElement.html : XML.Node +export.xml.html=export.xml.html + +--[[# link +## Description +Link metadata + + +## Categories- metadata +- flow +- phrasing +]] +---@class HTMLElement.link : XML.Node +---@field href any [Documentation](https://html.spec.whatwg.org/multipage/semantics.html#attr-link-href) +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.link=export.xml.link + +--[[# em +## Description +Stress emphasis + + +## Categories- flow +- phrasing +- palpable +]] +---@class HTMLElement.em : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.em=export.xml.em + +--[[# li +## Description +List item + + +]] +---@class HTMLElement.li : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.li=export.xml.li + +--[[# ruby +## Description +Ruby annotation(s) + + +## Categories- flow +- phrasing +- palpable +]] +---@class HTMLElement.ruby : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.ruby=export.xml.ruby + +--[[# data +## Description +Machine-readable equivalent + + +## Categories- flow +- phrasing +- palpable +]] +---@class HTMLElement.data : XML.Node +export.xml.data=export.xml.data + +--[[# thead +## Description +Group of heading rows in a table + + +]] +---@class HTMLElement.thead : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.thead=export.xml.thead + +--[[# footer +## Description +Footer for a page or section + + +]] +---@class HTMLElement.footer : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.footer=export.xml.footer + +--[[# th +## Description +Table header cell + + +]] +---@class HTMLElement.th : XML.Node +---@field colspan any [Documentation](https://html.spec.whatwg.org/multipage/tables.html#attr-tdth-colspan) +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.th=export.xml.th + +--[[# label +## Description +Caption for a form control + + +## Categories- flow +- phrasing +- interactive +- palpable +]] +---@class HTMLElement.label : XML.Node +export.xml.label=export.xml.label + +--[[# base +## Description + + Base URL and default target + for + and + + + navigable + + + hyperlinks + + + forms + + + + + + +]] +---@class HTMLElement.base : XML.Node +---@field href any [Documentation](https://html.spec.whatwg.org/multipage/semantics.html#attr-base-href) +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.base=export.xml.base + +--[[# canvas +## Description +Scriptable bitmap canvas + + +## Categories- flow +- phrasing +- embedded +- palpable +]] +---@class HTMLElement.canvas : XML.Node +---@field width any [Documentation](https://html.spec.whatwg.org/multipage/canvas.html#attr-canvas-width) +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.canvas=export.xml.canvas + +--[[# kbd +## Description +User input + + +## Categories- flow +- phrasing +- palpable +]] +---@class HTMLElement.kbd : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.kbd=export.xml.kbd + +--[[# ins +## Description +An addition to the document + + +## Categories- flow +- phrasing +- palpable +]] +---@class HTMLElement.ins : XML.Node +---@field cite any [Documentation](https://html.spec.whatwg.org/multipage/edits.html#attr-mod-cite) +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.ins=export.xml.ins + +--[[# meta +## Description +Text metadata + + +## Categories- metadata +- flow +- phrasing +]] +---@class HTMLElement.meta : XML.Node +---@field name any [Documentation](https://html.spec.whatwg.org/multipage/semantics.html#attr-meta-name) +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.meta=export.xml.meta + +--[[# address +## Description + + Contact information for a page or + element + + + article + + + + + + +]] +---@class HTMLElement.address : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.address=export.xml.address + +--[[# rp +## Description +Parenthesis for ruby annotation text + + +]] +---@class HTMLElement.rp : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.rp=export.xml.rp + +--[[# legend +## Description +Caption for + + +]] +---@class HTMLElement.legend : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.legend=export.xml.legend + +--[[# strong +## Description +Importance + + +## Categories- flow +- phrasing +- palpable +]] +---@class HTMLElement.strong : XML.Node +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.strong=export.xml.strong + +--[[# optgroup +## Description +Group of options in a list box + + +]] +---@class HTMLElement.optgroup : XML.Node +---@field disabled any [Documentation](https://html.spec.whatwg.org/multipage/form-elements.html#attr-optgroup-disabled) +---@field globals any [Documentation](https://html.spec.whatwg.org/multipage/dom.html#global-attributes) +export.xml.optgroup=export.xml.optgroup ---@generic T ---@param func fun(...: T): XML.Node @@ -177,9 +1564,11 @@ end) function export.declare_generator(func) return setfenv(func, export.xml) end ---Turns a lua table into an html table, recursively, with multiple levels of nesting ----@param tbl table +---@generic TKey, TValue +---@param tbl { [TKey] : TValue }, +---@param order TKey[]? ---@return XML.Node -function export.html_table(tbl) +function export.html_table(tbl, order) local xml = export.xml return xml.table { function () @@ -194,24 +1583,36 @@ function export.html_table(tbl) return export.html_table(v) end - for i, v in ipairs(tbl) do - coroutine.yield ( - xml.tr { - xml.td(tostring(i)), - xml.td(getval(v)), - } - ) + if order ~= nil then + for i, v in ipairs(order) do + local val = tbl[v] + coroutine.yield ( + xml.tr { + xml.td(tostring(v)), + xml.td(getval(val)) + } + ) + end + else + for i, v in ipairs(tbl) do + coroutine.yield ( + xml.tr { + xml.td(tostring(i)), + xml.td(getval(v)), + } + ) - tbl[i] = nil - end + tbl[i] = nil + end - for k, v in pairs(tbl) do - coroutine.yield ( - xml.tr { - xml.td(tostring(k)), - xml.td(getval(v)), - } - ) + for k, v in pairs(tbl) do + coroutine.yield ( + xml.tr { + xml.td(tostring(k)), + xml.td(getval(v)), + } + ) + end end end }