From 2cd7f9c40adcaad0ee22a096ccd51af7debd6c44 Mon Sep 17 00:00:00 2001 From: Tyler Nullmeier Date: Fri, 31 Jul 2026 11:12:25 -0500 Subject: [PATCH 01/11] Add document roles to epub pages --- .../src/epub/__snapshots__/page.test.ts.snap | 1 + .../src/epub/__snapshots__/toc.test.ts.snap | 31 +++++++++++-- bakery-js/src/epub/page.test.ts | 19 ++++++++ bakery-js/src/epub/page.tsx | 6 +++ bakery-js/src/epub/toc.test.ts | 44 +++++++++++++++++-- bakery-js/src/epub/toc.tsx | 26 +++++++++++ bakery-js/src/model/base-toc.tsx | 4 ++ 7 files changed, 124 insertions(+), 7 deletions(-) diff --git a/bakery-js/src/epub/__snapshots__/page.test.ts.snap b/bakery-js/src/epub/__snapshots__/page.test.ts.snap index db8f741a..628c4334 100644 --- a/bakery-js/src/epub/__snapshots__/page.test.ts.snap +++ b/bakery-js/src/epub/__snapshots__/page.test.ts.snap @@ -50,6 +50,7 @@ exports[`Pages parses all the fields with a simple page 1`] = ` PageFile { "_parsed": undefined, "_readPath": "/pageLink1", + "ariaRole": null, }, ], "resources": [], diff --git a/bakery-js/src/epub/__snapshots__/toc.test.ts.snap b/bakery-js/src/epub/__snapshots__/toc.test.ts.snap index 92cc1132..6ecd9842 100644 --- a/bakery-js/src/epub/__snapshots__/toc.test.ts.snap +++ b/bakery-js/src/epub/__snapshots__/toc.test.ts.snap @@ -56,6 +56,31 @@ exports[`TocFile and Friends Cover image with TocFile and Friends with an empty " `; +exports[`TocFile and Friends with a small book captures data-toc-type for units, chapters, and pages 1`] = ` +[ + { + "children": [ + { + "children": [ + { + "page": "/foo/iamthepage.xhtml", + "title": "PageTitle", + "tocType": "page", + "type": "LEAF", + }, + ], + "title": "ChapterTitle", + "tocType": "chapter", + "type": "INNER", + }, + ], + "title": "UnitTitle", + "tocType": "unit", + "type": "INNER", + }, +] +`; + exports[`TocFile and Friends with a small book generates an NCX file 1`] = ` " @@ -133,13 +158,13 @@ exports[`TocFile and Friends with a small book parses a ToC with one page 1`] =