feat(std/html): the markup builder (WEB.md slice 1) #457
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/93-html-builder"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Task
torbscript/language#93: WEB.md slice 1, the
std/htmlmarkup builder (loop item, stage implement).What and why
std/htmlgets its writing side:Html<Message = Never>withrender(),Markup<Message>as the receiver of the builder blocks, 110 elements asvar fns in the three shapes (td "text",td class: "amount" { ... },tr { ... }),fragment,document title: lang:,script(source: Resource), and theLinktrait for URL attributes (implemented forUriandUriReference; any scheme but http, https and mailto becomesabout:invalid; aStringis not aLink).tools/html/elements.trb(a pure function overtools/html/elements.txt) writesstd/html/src/elements.trb, which is committed unmodified.& < >, attribute values escape& < > " 'and are always double-quoted, a bad name inattributes:is a panic that names it.kind:writestype,target:writesfor; the one element namedvarisvariable.Not in this PR (so this is "Part of", not "Closes")
Html.trusted(file: EmbeddedText)andstyle(sheet: EmbeddedText):EmbeddedText.text()does not exist yet (RESOURCES.md slice 2, #135). #93 stays open for these two.script(source:)links the file's stable name until fingerprinted URLs land (WEB slice 5).Findings
The generic parameter Message was not substituted).fragmentanddocumentare therefore non-generic overNeverfor now; components stayextend<Message> Markup<Message>.attributes:additionally refuseson*names and URL-ish names (href,src, ...), which have typed parameters.Test
std/html/tests/page.test.trb: the WEB.md 4.2 example page as an exact-output test (includingAda <admin>becomingAda <admin>), plus the empty case.std/html/tests/markup.test.trb,escape.test.trb: the 4.7 rows.torb testof the three files in the VM andtorb format --checkof the new files. Gates run in CI.sh benchmarks/run.sh html-render.std/htmlmarkup (WEB slice 1) #93std/htmlmarkup (WEB slice 1) #93std/htmlmarkup (WEB slice 1) #93CI red on
1a9dd0a:ci / tier A (linux-x64)failed after 23m58s, which also failsci / gates. I could not read the failing step through the API, so the cause is unknown to me. The PR is also reported as not mergeable (mergeable: false; its merge base is behind currentmain), so it needs a rebase ontomainbefore it can merge. Pushing a new head re-triggers CI and brings this review back.a3eb3c29181be6316822Approved on
1be6316.&is escaped first, attribute values are always double-quoted with both quotes escaped,attributes:names are checked against the HTML grammar andon*/URL names are refused.Linkis a whitelist (http, https, mailto, relative), so unknown or odd schemes fall toabout:invalid.Html.trustedandstyleare named, and the PR is "Part of", not "Closes".Stringcannot reach a URL attribute orscript; no secrets in the diff.elements.trbis committed with its generator and input.std/html.Non-blocking: none.