Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Editor

Notices

Reply
 
Thread Tools Search this Thread
Old 03-27-2014, 09:47 PM   #1
phossler
Wizard
phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.
 
Posts: 1,087
Karma: 447222
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
Inline TOC formatting

I generated a 3 level inline TOC, and wanted to change the styling for the different levels

In Sigil, each level had it's own class, so it was trivial to replace Sigil's TOC.CSS with the one that I liked to use

The Editor will generate a toc.xhtml file with a <ul> <li> <ul> <li> etc. nested, and with the <style type="text/css"> in the toc.xhtml file

If I change the CSS for the <li> the container value is inherited, and something like font-size:1.25em; really gets ugly.

1. IHMO it's be more flexible if each TOC level had it's own class

2. In the epub, I tweaked some generated settings, and the font-size I added really got messed up. Is there a correct way?

3. My end goal would be to have (maybe) ...

H1 enteries = bold, 2em, 1 em below,
H2 enteries = bold, 1em, 1 em below,
H3 enteries followed by another H3 = normal, 1em, 0 em below,
H3 enteries NOT followed by another H3 = normal, 1em, 2 em below

OK, that might be ugly, but it's an example of TOC level-specific styling

Open to alternatives, but in this case, I think Sigil's approach might possibly be more flexible
Attached Thumbnails
Click image for larger version

Name:	Capture.JPG
Views:	425
Size:	109.8 KB
ID:	120901  
Attached Files
File Type: epub test_toc.epub (6.1 KB, 286 views)
phossler is offline   Reply With Quote
Old 03-27-2014, 09:52 PM   #2
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
You can use descending CSS selectors, specifically the Child Selector in order to strictly control which one is matched.

Perhaps Kovid could add in classes to the ToC generator; however, this should work in the meantime, or you could just add classes by hand.
eschwartz is offline   Reply With Quote
Advert
Old 03-27-2014, 10:22 PM   #3
phossler
Wizard
phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.
 
Posts: 1,087
Karma: 447222
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
thanks, I was actually out to W3Schools (http://www.w3schools.com/css/default.asp) searching for something like that. I will do some experimenting

The reason I was hoping Kovid would consider some changes is because the TOC is regenerated each time. Life would be easier if the user could have a style sheet with the TOC styles so that the toc.xhtml would only require minimal tweaking.

Adding classes by hand would be a real source of error
phossler is offline   Reply With Quote
Old 03-27-2014, 11:38 PM   #4
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,339
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You do not need to add classes, CSS 2.1 selectors can do all this via child selectors. For example for level 1

#calibre_generated_inline_toc > ul > li

For level 2

#calibre_generated_inline_toc > ul > li > ul > li

And just go on adding > ul >li

for every additional level.
kovidgoyal is offline   Reply With Quote
Old 03-27-2014, 11:43 PM   #5
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Quote:
Originally Posted by kovidgoyal View Post
You do not need to add classes, CSS 2.1 selectors can do all this via child selectors. For example for level 1

#calibre_generated_inline_toc > ul > li

For level 2

#calibre_generated_inline_toc > ul > li > ul > li

And just go on adding > ul >li

for every additional level.
As I suggested; however, it does make it more difficult to see at a glance what is affecting what, if you have to count levels like that. But you can easily tell what

#toc_level_1

is doing.

It can't hurt to add classes, can it?
eschwartz is offline   Reply With Quote
Advert
Old 03-28-2014, 12:21 AM   #6
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Thanks for adding this!

@phossler, this will be in the next release, tomorrow. Use class "level1" "level2" etc.

See: https://github.com/kovidgoyal/calibr...88fb41893d5b70
eschwartz is offline   Reply With Quote
Old 03-28-2014, 08:25 AM   #7
phossler
Wizard
phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.
 
Posts: 1,087
Karma: 447222
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
@all-- THANKS !!!

This will make things much easier for me (at least) to understand as well as saving some work
phossler is offline   Reply With Quote
Old 03-28-2014, 04:51 PM   #8
phossler
Wizard
phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.
 
Posts: 1,087
Karma: 447222
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
@Kovid

Can I ask why it goes from Level 1 to Level 2 to Level 5?

No big deal, just curious

Thanks

Now I have to figure out how to use it
Attached Thumbnails
Click image for larger version

Name:	Capture.JPG
Views:	392
Size:	108.5 KB
ID:	120953  
phossler is offline   Reply With Quote
Old 03-29-2014, 04:43 AM   #9
arspr
Dead account. Bye
arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.
 
Posts: 587
Karma: 668244
Join Date: Mar 2011
Device: none
Just guessing, but check if what you have in your book is h1, h2 and then h5, not h3, tags.
arspr is offline   Reply With Quote
Old 03-29-2014, 06:05 AM   #10
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,339
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
https://github.com/kovidgoyal/calibr...59ff8ba0b173d7
kovidgoyal is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Retaining formatting in inline links MacEachaidh ePub 4 03-16-2014 04:11 PM
Inline TOC from toc.ncx elmago79 Kindle Formats 38 03-25-2011 12:56 PM
Use Regex to Code an Inline TOC, from an External TOC's .ncx File mostlynovels ePub 2 03-16-2011 12:15 PM
Tags around inline TOC links jhempel24 Sigil 0 01-08-2011 06:21 AM
Trying to make an Inline TOC crutledge Sigil 2 05-09-2010 05:46 AM


All times are GMT -4. The time now is 10:38 AM.


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