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 01-17-2024, 01:06 AM   #1
John IV
Member
John IV began at the beginning.
 
Posts: 22
Karma: 10
Join Date: May 2022
Device: Kindle Scribe
[Q] Table of Contents Creation from Single digits & no Headings?x

Hello, I could have sworn there was a thread somewhere on this forum for TOC generation using different XPath examples for somewhat oddly formatted Chapter indicators, but I can't find it again.

I'm just trying to create a TOC from the html files that simply has the chapters as '1' and '2' and so forth through '23' on their own lines. E.g:

<p class="calibre_2">1</p>
<p class="calibre_2">2</p>
etc.
<p class="calibre_2">23</p>

How would one accomplish this? Presumably w/ the generate ToC from XPath wizard? Thank you!
John IV is offline   Reply With Quote
Old 01-17-2024, 01:10 AM   #2
Karellen
Wizard
Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.
 
Karellen's Avatar
 
Posts: 1,103
Karma: 4911876
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
I would convert those chapter headings to real heading tags.

Find: <p class="calibre_2">(\d+)</p>
Replace: <h2>\1</h2>

Then you can run the TOC generator which will find the <h2> tags.
Karellen is offline   Reply With Quote
Advert
Old 01-17-2024, 01:28 AM   #3
John IV
Member
John IV began at the beginning.
 
Posts: 22
Karma: 10
Join Date: May 2022
Device: Kindle Scribe
Beautiful, thank you.
John IV is offline   Reply With Quote
Old 01-17-2024, 01:57 AM   #4
Karellen
Wizard
Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.
 
Karellen's Avatar
 
Posts: 1,103
Karma: 4911876
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
Sorry, should have also mentioned that you will need to style the <h2> tag in the css file.
Or maybe you could reuse class="calibre_2"

If you want to reuse, then the replace should be... <h2 class="calibre_2">\1</h2>
Karellen is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Table of Contents & Links Jamestoo Calibre 4 02-21-2012 10:07 AM
New bug on table of contents creation? saxondawg Conversion 3 06-22-2011 12:34 AM
Ebook Creation: Table of Contents maurices5000 Kindle Formats 15 02-18-2011 01:58 AM
Table of Contents Creation Not Working MV64 Calibre 1 12-07-2010 04:37 AM
Repeated Chapter Headings in Kobo Table of Contents capsolo Sigil 5 06-20-2010 03:09 AM


All times are GMT -4. The time now is 11:51 AM.


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