08-03-2018, 09:52 PM | #1 |
Connoisseur
Posts: 72
Karma: 10
Join Date: Mar 2017
Location: Central NC
Device: Various
|
CSS heading counters & TOC?
I'm using CSS counters in my heading tags to auto-generate chapter and section numbers that are prepended to the heading text (currently just for h2 and h3 headings). It all works perfectly well in the html pages, but the numbers don't appear in the TOC.
At this point, I'm assuming that Sigil just doesn't handle this degree of complexity in the use of CSS. But is there something I'm missing? Is the only way to get the numbers into the TOC to put them there manually (and hence update them every time a new TOC is generated)? Thanks for any insight. |
08-04-2018, 06:30 AM | #2 | |
Imperfect Perfectionist
Posts: 464
Karma: 724664
Join Date: Dec 2011
Location: Ølstykke, Denmark
Device: none
|
Quote:
If so, you can use the title property of the header tag: <h2 title="1: On the First Day of Christmas">On the First Day of Christmas</h2> Then Sigil will regenerate the TOC based on the text in the title tag. I'm not sure, but I don't think the epub spec supports the CSS-way, you mention, even if it works in html pages. Regards, Kim |
|
Advert | |
|
08-04-2018, 08:07 AM | #3 |
Grand Sorcerer
Posts: 27,549
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
There's no way I know of to get CSS to generate tag attributes. The ToC's text is derived from either the text content of the h tags, or the title attribute of the h tags (as elibrarian pointed out). But if the numbers don't exist until the html is rendered, there'll be no numbers for the toc generation routines to gather.
It's not just a Sigil thing, either. The internal toc pieces of an epub will simply not support dynamic content (with the exception of list elements in an EPUB3's NAV document. |
08-04-2018, 08:21 AM | #4 | |
Connoisseur
Posts: 72
Karma: 10
Join Date: Mar 2017
Location: Central NC
Device: Various
|
Quote:
|
|
08-08-2018, 02:13 AM | #5 |
Guru
Posts: 668
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
|
maybe one of these plugins could help:
AddIDs - Generates incremental ids https://www.mobileread.com/forums/sh...d.php?t=266120 ReworkChapterHeads - Add, replace and reformat chapter headings https://www.mobileread.com/forums/sh...d.php?t=301108 |
Advert | |
|
08-10-2018, 08:13 AM | #6 |
Connoisseur
Posts: 72
Karma: 10
Join Date: Mar 2017
Location: Central NC
Device: Various
|
Thanks. Some of that looks promising as an expedient. It would be better, of course, for the Sigil TOC generator to handle the relevant CSS in context and avoid ad hoc approaches. But if something like this works and isn't buggy, I'll likely use it rather than hand-editing.
|
08-10-2018, 09:06 AM | #7 |
Grand Sorcerer
Posts: 27,549
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
I can tell you right now, that Sigil's ToC generator will not be rendering html or css for dynamic content. Way too involved.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
question about sgc-toc.css | Gregg Bell | Sigil | 5 | 03-16-2015 09:33 PM |
How to get 4 levels of heading in ToC? | Kumara | Conversion | 2 | 10-16-2014 01:48 AM |
Add h2 tag to chapter heading to make TOC | Ozman | Editor | 4 | 08-26-2014 07:00 AM |
TOC conversion with images as Chapter Heading | cabpp | Conversion | 5 | 04-21-2014 06:36 PM |
CSS style, TOC and other stuff | sebdea | Sigil | 8 | 04-19-2011 03:40 AM |