View Single Post
Old 06-06-2023, 01:17 PM   #1
Vanguard3000
Groupie
Vanguard3000 ought to be getting tired of karma fortunes by now.Vanguard3000 ought to be getting tired of karma fortunes by now.Vanguard3000 ought to be getting tired of karma fortunes by now.Vanguard3000 ought to be getting tired of karma fortunes by now.Vanguard3000 ought to be getting tired of karma fortunes by now.Vanguard3000 ought to be getting tired of karma fortunes by now.Vanguard3000 ought to be getting tired of karma fortunes by now.Vanguard3000 ought to be getting tired of karma fortunes by now.Vanguard3000 ought to be getting tired of karma fortunes by now.Vanguard3000 ought to be getting tired of karma fortunes by now.Vanguard3000 ought to be getting tired of karma fortunes by now.
 
Posts: 169
Karma: 474196
Join Date: Jan 2011
Location: Canada
Device: Kobo Libra 2
"Reverse" TOC generation - generate <h> tags at TOC points.

I've got an ebook that uses images for chapter titles, and don't have a "title" parameter. The book has its own table of contents, but they don't point directly to the images (they're just wrapped in <p>'s), and I'm curious if there's a way to have Sigil insert <h> tags at files/positions denoted by the existing table of contents, with the TOC element name as title? For example, I've currently got something like:

Code:
<p><img src="ch04.jpg"/></p>
And would like to get something like:

Code:
<h1 title="CHAPTER 7: MY ELBOW HURTS"/>
<p><img src="ch04.jpg"/></p>
so I could regex it into:

Code:
<h1 title="CHAPTER 7: MY ELBOW HURTS"><img src="ch04.jpg"/></h1>
The closest I can get is the "Create HTML TOC" function, but beyond getting a list of TOC names for copying, it's still not ideal. Is there a way for Sigil to do this and save me a bit of time when this kind of thing shows up? Thanks in advance.
Vanguard3000 is offline   Reply With Quote