01-17-2024, 02:06 AM | #1 |
Member
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! |
01-17-2024, 02:10 AM | #2 |
Wizard
Posts: 1,352
Karma: 6794938
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. |
Advert | |
|
01-17-2024, 02:28 AM | #3 |
Member
Posts: 22
Karma: 10
Join Date: May 2022
Device: Kindle Scribe
|
Beautiful, thank you.
|
01-17-2024, 02:57 AM | #4 |
Wizard
Posts: 1,352
Karma: 6794938
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> |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Table of Contents & Links | Jamestoo | Calibre | 4 | 02-21-2012 11:07 AM |
New bug on table of contents creation? | saxondawg | Conversion | 3 | 06-22-2011 01:34 AM |
Ebook Creation: Table of Contents | maurices5000 | Kindle Formats | 15 | 02-18-2011 02:58 AM |
Table of Contents Creation Not Working | MV64 | Calibre | 1 | 12-07-2010 05:37 AM |
Repeated Chapter Headings in Kobo Table of Contents | capsolo | Sigil | 5 | 06-20-2010 04:09 AM |