code wiki / _hdl_build / nx_book_titles_gate.nx
nx_book_titles_gate.nx
buildroot/runtime/_hdl_build/nx_book_titles_gate.nx
about
nx_book_titles_gate.nx -- liar-kill gate for the "TOC just shows Chapter 1" fix. Two layers:
PART 1 (unit): cs_extract_heading (shared by MOBI+KF8 via nx_chapter_split) must read <h1> OR <h2> OR <h3>,
stripping nested inline tags -- the reason ~390 Kindle TOCs degraded to "Chapter N" was reading
ONLY <h1>.
PART 2 (e2e): build a nav-LESS EPUB (so the reader falls back to chapters[].title = nx_epub_book's chap_title)
with a NESTED <h1><span>..</span></h1> chapter + an <h2>-only chapter, run the REAL nx_epub_book,
and assert book.json carries the real heading text -- NOT the "Chapter 0"/"Chapter 1" fallback.
Sovereign: opc_write + fork/exec, no shell. expect_exit: 0 license_tier: ORIGINAL
dependencies 3 imports · 0 importers
imports: nx_syscalls.nxnx_opc.nxnx_chapter_split.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| none |
functions
| 13 | func tg_p(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 14 | func tg_n(v0: i64) -> i64 { var v: i64=v0; if v<0 { sys_write(1,"-" as *u8,1); v=0-v } let b: *u8=sys_mmap(24); var k: i64=0; if v==0 {b[0]=48 as u8;k=1} while v>0 {b[k]=(48+(v%10)) as u8; v=v/10; k=k+1} let o: *u8=sys_mmap(24); var j: i64=0; while j<k {o[j]=b[k-1-j];j=j+1} sys_write(1,o,k); return 0 } |
| 15 | func tg_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } |
| 16 | func ensure_dir(path: *u8) -> i64 { __syscall(258, 0-100, path, 0x1ed, 0, 0, 0); return 0 } called by 1: main |
| 19 | func streq(out: *u8, exp: *u8) -> i64 called by 1: uchk |
| 26 | func hassub(buf: *u8, n: i64, needle: *u8) -> i64 calls 1: tg_slen |
| 32 | func run2(path: *u8, a0: *u8, a1: *u8, redir: *u8) -> i64 |
| 47 | func uchk(label: *u8, html: *u8, exp: *u8, pf: *i64) -> i64 |
| 55 | func main() -> i64 |