Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow span in toc nav items #1233

Merged
merged 1 commit into from
Jan 7, 2022
Merged

Conversation

johnfactotum
Copy link
Contributor

According to https://www.w3.org/publishing/epub32/epub-packages.html#sec-package-nav-def-model:

A child a element describes the target that the link points to, while a span element serves as a heading for breaking down lists into distinct groups (for example, a large list of illustrations can be segmented into several lists, one for each chapter).

Test case courtesy of @kianmeng: no_nested_submenu_in_toc.zip

Evaluating book.navigation.toc without this fix: toc ignores all items marked with span and their subitems.

[{"id":"intro.xhtml","href":"intro.xhtml","label":"Introduction","subitems":[]}]

With this fix: toc correctly contains all items.

[{"id":"intro.xhtml","href":"intro.xhtml","label":"Introduction","subitems":[]},{"id":"","href":"","label":"Languages","subitems":[{"id":"intro.xhtml","href":"intro.xhtml","label":"Introduction","subitems":[],"parent":""},{"id":"about.xhtml","href":"about.xhtml","label":"About this book","subitems":[],"parent":""}]}]

According to https://www.w3.org/publishing/epub32/epub-packages.html#sec-package-nav-def-model:

"A child `a` element describes the target that the link points to, while a `span` element serves as a heading for breaking down lists into distinct groups (for example, a large list of illustrations can be segmented into several lists, one for each chapter)."
@fchasen fchasen merged commit e727bc8 into futurepress:master Jan 7, 2022
@kianmeng
Copy link
Contributor

kianmeng commented Jan 9, 2022

🎉 🎉 🎉 🎉 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants