View Single Post
Old 08-10-2024, 08:34 AM   #535
PubFut
Junior Member
PubFut began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Aug 2024
Device: Sigil
Create chapter TOCs

I have another little task that may be a bit more complicated but also not too difficult: I would like to auto-generate a litte TOC in a <nav> section of every chapter/html file. It shall include entries for the current file itself and for all subordinated files and their headings from H1 to H3 with classes from the sgc-toc.css.

So steps could be:
1. Create a TOC entry for the current chapter in the <nav> section of the current file
2. Create additional entries for every subordinated file/chapter with correct classes from sgc-toc.css
3. Go to next file: If it is subordinated just copy the created TOC from the <nav> section of the previous file
4. If it is NOT subordinated, start with 1.

Perhaps it can also be done based on the existing HTML-TOC generation. But as I am not a developer I do not have enough insight.
PubFut is offline   Reply With Quote