You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have implemented a Table of Contents (TOC) for the documentation generated by
libodd.xsl. Below is a summary of the changes:
XSLT Enhancements in libodd.xsl
New Parameter: Added odd:toc (boolean, defaults to true) to toggle the TOC.
TOC Logic: Created a dedicated odd:toc template and mode that recursively scans for tei:div elements containing a tei:head.
Anchor Integration: Links in the TOC use the same anchor logic as the main content (targeting the section's xml:id or a generated ID), ensuring seamless navigation.
Unified Layout: Integrated the TOC into the html:content template so it automatically appears at the top of the generated documentation.
Modern Styling in documentation.css
Layout: Added a stylized .toc container with a light background and subtle borders to differentiate it from the main content.
Hierarchy: Styled nested lists to clearly represent the document structure.
Interactivity: Added hover effects to TOC links for better user experience.
Your code looks good. However, there's one thing, I'd ask you to change: Though your idea to introduce a stylesheet parameter to toggle the toc on/off is consistent, we should leave it to the processed content, if there's a toc or not. TEI has specified a PI-like element named <divGen>. See https://tei-c.org/release/doc/tei-p5-doc/en/html/DS.html#DSVIRT
So, please remove the stylesheet parameter and its evaluation. Instead, add a template in mode text:text that matches div[@type eq 'toc'] and let it generate a toc in the mode that you introduced.
You may ask yourself, which divisions to process from a <divGen> element. All in //text/body? All the <divGen>'s sibling divisions and their descendants? All the <divGen>'s following sibling devisions and their descendands? Your solution may even depend on the ancestors of the <divGen>: Is it nested in //text/body or in the front matter (//text/front) or back matter (//text/back) of the document? You may take the content model of div-like elements into account. You can even change select="//body" in line 100 of libodd.xsl, if you think that it should be different.
I'm sure, you find a consistent solution.
I've just pushed commit 0650626 for an example is usage of <devGen>.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I have implemented a Table of Contents (TOC) for the documentation generated by
libodd.xsl. Below is a summary of the changes:
XSLT Enhancements in libodd.xsl
New Parameter: Added odd:toc (boolean, defaults to true) to toggle the TOC.
TOC Logic: Created a dedicated odd:toc template and mode that recursively scans for tei:div elements containing a tei:head.
Anchor Integration: Links in the TOC use the same anchor logic as the main content (targeting the section's xml:id or a generated ID), ensuring seamless navigation.
Unified Layout: Integrated the TOC into the html:content template so it automatically appears at the top of the generated documentation.
Modern Styling in documentation.css
Layout: Added a stylized .toc container with a light background and subtle borders to differentiate it from the main content.
Hierarchy: Styled nested lists to clearly represent the document structure.
Interactivity: Added hover effects to TOC links for better user experience.
Closes issue #77