From 1c203c69e4d229c6922ee3f259547d1c19346973 Mon Sep 17 00:00:00 2001 From: Amrit Bhogal Date: Sat, 2 Dec 2023 11:24:53 -0800 Subject: [PATCH] Remove old files --- autogen.lua | 42 - items-raw.html | 2074 ------------------------------------------------ parse-data.lua | 132 --- test.lua | 91 +-- 4 files changed, 2 insertions(+), 2337 deletions(-) delete mode 100644 autogen.lua delete mode 100644 items-raw.html delete mode 100644 parse-data.lua diff --git a/autogen.lua b/autogen.lua deleted file mode 100644 index dff9708..0000000 --- a/autogen.lua +++ /dev/null @@ -1,42 +0,0 @@ -#!/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 deleted file mode 100644 index ebd90f5..0000000 --- a/items-raw.html +++ /dev/null @@ -1,2074 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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 deleted file mode 100644 index 9089aff..0000000 --- a/parse-data.lua +++ /dev/null @@ -1,132 +0,0 @@ -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(' Tree using <details> and <summary> ----@param tbl table ----@return XML.Node -local function tree(tbl) - return xml.div { - function() - local function getval(v) - local tname = xml_gen.typename(v) - if tname == "XML.Node" then return v, false end +local test = xml.div {key="value"} - if tname ~= "table" or (getmetatable(v) or {}).__tostring then - return xml.p(tostring(v)), false - end - - return tree(v), true - end - - for i, v in ipairs(tbl) do - local val, is_tree = getval(v) - if is_tree then - coroutine.yield( - xml.details { - xml.summary(tostring(i)), - val - } - ) - else - coroutine.yield( - xml.table { - xml.tr { - xml.td(tostring(i)), - xml.td(val), - } - } - ) - end - - tbl[i] = nil - end - - for k, v in pairs(tbl) do - local val, is_tree = getval(v) - if is_tree then - coroutine.yield( - xml.details { - xml.summary(tostring(k)), - val - } - ) - else - coroutine.yield( - xml.table { - xml.tr { - xml.td(tostring(k)), - xml.td(val), - } - } - ) - end - end - end - } -end - - -local doc = xml.html { charset = "utf8" } { - xml.head { - xml.title "Hello, World!", - xml_gen.style { - ["details > div"] = { - ["margin-left"] = "10px" - } - } - }, - - xml.body { - xml.div { id = "numbers" } { - tree { - key = "value", - sub = { - key = "value" - }, - - array = { 1, 2, 3, 4, 5 } - } - } - } -} - -print(doc) +print(xml_gen.node_to_string(test))