code wiki / _hdl_build / nx_html_head.nx
nx_html_head.nx
buildroot/runtime/_hdl_build/nx_html_head.nx
about
nx_html_head.nx -- THE ONE canonical accessible document head for every page emitter.
WHY THIS EXISTS (debt seq702): a grep of the lang-less signature `<html><head>` across
the emitter tree found 84 distinct source files -- 19 test gates and 65 LIVE-PAGE
EMITTERS -- each hand-rolling its own <html><head><title>...</head><body> literal with
no lang attribute and no meta viewport. That count is a FLOOR: the scan hit its output
cap at 116 match lines, so more exist. Patching them one at a time costs 65+ build/promote
cycles AND leaves emitter 66 free to bake the same bad head. This library closes the class.
Same shape as nx_gate_verdict for gates (D001): a shared base the emitters delegate to,
adopted MIGRATE-ON-TOUCH. Rule 15, DRY through shared libraries.
USAGE -- three calls, composes around whatever <style> the emitter already has:
o = nxh_head_open(out, o, "My Page Title" as *u8) // doctype+lang+charset+viewport+title
o = <emitter appends its own <style>...</style> exactly as before>
o = nxh_body_open(out, o) // </head><body><main>
... page content ...
o = nxh_close(out, o) // </main></body></html>
The three things this guarantees are exactly the three nx_page_verify checks that no
stylesheet can supply: lang= on <html>, <meta name=viewport>, and a <main> landmark.
(nx_page_verify's lang/viewport checks were themselves false-passing until seq676 made
them structural -- so measure adoption with the REPAIRED verifier, not a banked number.)
dependencies 0 imports · 3 importers
imports: none
imported by: nx_common_tasks.nxnx_model_card.nxnx_pub_desk.nx
structs
| none |
consts
| none |
functions
| 27 | func nxh_lit(out: *u8, o: i64, s: *u8) -> i64 |
| 38 | func nxh_head_open(out: *u8, o: i64, title: *u8) -> i64 |
| 47 | func nxh_body_open(out: *u8, o: i64) -> i64 |
| 52 | func nxh_close(out: *u8, o: i64) -> i64 |