December Adventure Day 4

Published as part of 'December Adventure 2025' series.

Today I got as far as being able to go from items in my flattened table of contents to getting the xhtml content. I had to go on a bit of a detour that I suspect I wouldn't need if I was feeling sharper today.

The items out of the table of contents have a target property, which is the path to its xhtml file inside the ePub. But in order to pull it out, you need the id for the find_content_by_id method on the Document object. The id isn't a part of the table of content items. I had to match each one to an entry in the manifest, which has both the path to the xhtml and id, but the manifest doesn't have ordering.

It's just a little dance. It's fine.

I also put a # type: ignore directive on a line that I just didn't want to bother figuring out how to please pyright this morning. (I use pyright).

Tomorrow I'm betting I'll get to making fresh xhtml files, re-slicing the content into consistently sized files.