pretext icon indicating copy to clipboard operation
pretext copied to clipboard

EPUB Table of Contents issues

Open mitchkeller opened this issue 4 years ago • 2 comments

  • Would be nice to go deeper than just chapters. (Respect the publisher file's TOC specification?) EPUB spec is really persnickety on how to do this. Probably need to use ol and style it to have no visible list marker and then have the XSL write out the division number.
  • I suspect we're going to have to resort to using shorttitle rather than title as the text that appears in the TOC. EPUB spec limits use of span in a TOC (mainly to do something like provide a heading of "Appendices" that leads to a nested list…this would also be used to wrap "1 My First Chapter" and then have a following nested list of sections). This effectively rules out math in the TOC since (a) we wrap our math in a span and (b) we run into duplicate identifier issues when the division title's math is both in the TOC and in the hn for the division in the reading portion.

mitchkeller avatar Jul 21 '21 18:07 mitchkeller

OK, I'm learning more about the duplicate IDs thing. Fortunately (and sensibly, now that I think about it), it only seems to be a problem when an ID is duplicated within a single XHTML file in the EPUB. Ramifications:

  • TOC can retain the math content if it exists, but we would need to do something to not wrap that math in span. (I'll do some hacking on an EPUB file to see if it renders OK with that span removed/passes validation at that point.)
  • Would a related clean solution be to have the XHTML head/title element contain "Section 2.3.1" (or whatever) rather than the contents of title or shorttitle. Since we're not aware of a reading system that exposes this information, it seems the contents aren't super important (and the division number is at least meaningful information that a reader could use if it were exposed to them).

mitchkeller avatar Jul 22 '21 15:07 mitchkeller

Can confirm that if the math content in a TOC entry is not wrapped in span, the validator is ok with svg or math being there. Can we use a modal template for m with mode="title-simple" in pretext-epub.xsl and not wrap the span? Maybe we want to inject the CSS for .mjpage as a @style on the top-level svg or math that gets dropped? I'm feeling a little out of my depths on that.

mitchkeller avatar Jul 22 '21 19:07 mitchkeller