Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 08-03-2018, 09:52 PM   #1
ghmerrill
Connoisseur
ghmerrill began at the beginning.
 
ghmerrill's Avatar
 
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.
ghmerrill is offline   Reply With Quote
Old 08-04-2018, 06:30 AM   #2
elibrarian
Imperfect Perfectionist
elibrarian ought to be getting tired of karma fortunes by now.elibrarian ought to be getting tired of karma fortunes by now.elibrarian ought to be getting tired of karma fortunes by now.elibrarian ought to be getting tired of karma fortunes by now.elibrarian ought to be getting tired of karma fortunes by now.elibrarian ought to be getting tired of karma fortunes by now.elibrarian ought to be getting tired of karma fortunes by now.elibrarian ought to be getting tired of karma fortunes by now.elibrarian ought to be getting tired of karma fortunes by now.elibrarian ought to be getting tired of karma fortunes by now.elibrarian ought to be getting tired of karma fortunes by now.
 
elibrarian's Avatar
 
Posts: 464
Karma: 724664
Join Date: Dec 2011
Location: Ølstykke, Denmark
Device: none
Quote:
Originally Posted by ghmerrill View Post
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.
If I understand you correctly, you want a different text from the header (eg <h2></h2>) in the TOC?

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
elibrarian is offline   Reply With Quote
Old 08-04-2018, 08:07 AM   #3
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
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.
DiapDealer is offline   Reply With Quote
Old 08-04-2018, 08:21 AM   #4
ghmerrill
Connoisseur
ghmerrill began at the beginning.
 
ghmerrill's Avatar
 
Posts: 72
Karma: 10
Join Date: Mar 2017
Location: Central NC
Device: Various
Quote:
Originally Posted by DiapDealer View Post
... 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.
Thanks. I won't complain about it. Just wanted to be sure I wasn't overlooking something.
ghmerrill is offline   Reply With Quote
Old 08-08-2018, 02:13 AM   #5
AlanHK
Guru
AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.
 
AlanHK's Avatar
 
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
AlanHK is offline   Reply With Quote
Old 08-10-2018, 08:13 AM   #6
ghmerrill
Connoisseur
ghmerrill began at the beginning.
 
ghmerrill's Avatar
 
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.
ghmerrill is offline   Reply With Quote
Old 08-10-2018, 09:06 AM   #7
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,549
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by ghmerrill View Post
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 ...
I can tell you right now, that Sigil's ToC generator will not be rendering html or css for dynamic content. Way too involved.
DiapDealer is offline   Reply With Quote
Reply


Forum Jump

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


All times are GMT -4. The time now is 08:51 PM.


MobileRead.com is a privately owned, operated and funded community.