Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
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: 152
Karma: 474196
Join Date: Jan 2011
Location: Ottawa
Device: Kobo Aura H2O
"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
Old 06-06-2023, 01:56 PM   #2
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,654
Karma: 5433388
Join Date: Nov 2009
Device: many
You might try my TOCSaver plugin but I have not played with it in years:

https://www.mobileread.com/forums/sh...d.php?t=333097

Please read this first:

Before Running on ePub3
This plugin will only parse the NCX ToC. So if you have an epub3 and want to save the Nav ToC, then use Sigil's ePub3 Tools to generate an NCX from the current Nav before launching the plugin.

Notes
Since this plugin could make changes to many xhtml files, it would be either a good idea to make a CheckPoint before running the plugin, or at the very least do a File Save-As under a new name, to make sure nothing is ever lost.

Last edited by KevinH; 06-06-2023 at 01:59 PM.
KevinH is online now   Reply With Quote
Advert
Old 06-06-2023, 04:15 PM   #3
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: 152
Karma: 474196
Join Date: Jan 2011
Location: Ottawa
Device: Kobo Aura H2O
Hey! That worked exactly as I was hoping! And it didn't seem to break anything using Sigil v1.9.30, so it's held up well for not having an update in nearly three years.

Thanks!
Vanguard3000 is offline   Reply With Quote
Old 06-06-2023, 04:36 PM   #4
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,654
Karma: 5433388
Join Date: Nov 2009
Device: many
Glad to hear it still works and helped. FWIW, I made no updates because no one has reported any bugs yet. I am a firm believer in "if it ain't broke, don't fix it!"
KevinH is online now   Reply With Quote
Reply

Tags
table of contents, toc


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
suggestion: add "apply" or "save" functionality in edit toc davidhcje Editor 1 08-20-2021 10:40 PM
Request: "Are You Sure" Prompt for "Edit ToC" enuddleyarbl Calibre 2 07-27-2021 11:15 PM
"generate ToC from all headings" doesn't save newly created entries davidhcje Calibre 0 05-30-2021 01:19 AM
Embed the functions of "TOC Edit" into "TOC Tab"? hhtmp88 Plugins 2 08-20-2020 02:09 PM
Getting calibre to detect "Prologue" and "Epilogue" for TOC sherman Calibre 2 09-20-2010 02:21 AM


All times are GMT -4. The time now is 05:03 PM.


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