09-06-2023, 06:58 AM | #1 |
Connoisseur
Posts: 66
Karma: 10
Join Date: Jul 2023
Device: None
|
Removing all TOC info and generating a new TOC
Greetings,
How do I remove all TOC tags from all files? Such as: <h3 id="sigil_toc_id_15">text</h3> I would like to remove all TOC info and generate a new TOC. Thanks, WV-Mike |
09-06-2023, 08:30 AM | #2 |
Grand Sorcerer
Posts: 27,621
Karma: 194727102
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Generating a new toc WILL remove any unnecessary toc ids and add any necessary new ones. There is no need to remove them all first before regenerating.
|
Advert | |
|
09-06-2023, 10:02 AM | #3 |
Connoisseur
Posts: 66
Karma: 10
Join Date: Jul 2023
Device: None
|
|
09-06-2023, 10:11 AM | #4 |
Sigil Developer
Posts: 7,739
Karma: 5446592
Join Date: Nov 2009
Device: many
|
What kind of toc? Are you talking about an epub3 nav or an epub2 ncx? If so those are required elements. An simple html toc can be deleted by deleting that particular file.
Otherwise recreating/regenerating it will replace it contents. |
09-06-2023, 10:15 AM | #5 |
Connoisseur
Posts: 66
Karma: 10
Join Date: Jul 2023
Device: None
|
|
Advert | |
|
09-06-2023, 10:20 AM | #6 |
Grand Sorcerer
Posts: 27,621
Karma: 194727102
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
You also said you wished to regenerate a new ToC. As I said, removing the old one is not necessary before generating a new one with the automated tools. A newly generated Toc will need those ids as well.
If you wish to manually create your own toc, with your own ids, for some reason, there is no automated way to remove the old ids. You'll need to do that manually with some sort of regex and Find & Replace or something. |
09-06-2023, 11:32 AM | #7 |
Sigil Developer
Posts: 7,739
Karma: 5446592
Join Date: Nov 2009
Device: many
|
You can not delete the ncx in an epub2. It is required by the spec. How did you try to delete it? What exactly were you doing when Sigil crashed? I would like to prevent the crash from happening.
|
09-06-2023, 11:34 AM | #8 |
Sigil Developer
Posts: 7,739
Karma: 5446592
Join Date: Nov 2009
Device: many
|
Did you try editing the NCX in CodeView by chance?
|
09-06-2023, 12:27 PM | #9 |
Connoisseur
Posts: 66
Karma: 10
Join Date: Jul 2023
Device: None
|
|
09-06-2023, 12:27 PM | #10 | |
Connoisseur
Posts: 66
Karma: 10
Join Date: Jul 2023
Device: None
|
Quote:
Thanks, WV-Mike |
|
09-06-2023, 12:53 PM | #11 |
Sigil Developer
Posts: 7,739
Karma: 5446592
Join Date: Nov 2009
Device: many
|
How? By remving the file from the unzipped epub? ByRight Clicking on the ncx file in Sigil's BookBrowser and selecting delete? Or by opening the NCX in CodeView and manually selecting and deleting all content?
OnceI know what you did to cause the crash I can try to prevent the crash from happening at all. |
09-06-2023, 01:54 PM | #12 |
Guru
Posts: 704
Karma: 2180740
Join Date: Jan 2017
Location: Poland
Device: Misc
|
Test:
* New EPUB2 * Insert <h1>test</h1> * Create TOC * Open NCX file in Code View * Select all content and delete it Result: crash |
09-06-2023, 02:06 PM | #13 |
Sigil Developer
Posts: 7,739
Karma: 5446592
Join Date: Nov 2009
Device: many
|
@BeckyEbook Thanks. That was what I needed to know to start to track that one down.
|
09-06-2023, 02:44 PM | #14 |
Sigil Developer
Posts: 7,739
Karma: 5446592
Join Date: Nov 2009
Device: many
|
I just tried this with 2.0.1 and it crashes. I tried it with Sigil-1.9.30 and the crash is successfully caught but I still get:
Sigil has encountered a problem. Sigil may need to close. Error info: std::exception Sigil version: 1.9.30 Runtime Qt: 5.12.9 Compiled Qt: 5.12.9 System: macOS 13.5 Architecture: x86_64 So this is not a new bug. No one should be manually deleting the required ncx. I am tempted to prevent the ncx from being hand edited in CodeView at all, but some people do like to tweak things by hand. I will need to see what if anything can be done. |
09-06-2023, 02:52 PM | #15 |
Sigil Developer
Posts: 7,739
Karma: 5446592
Join Date: Nov 2009
Device: many
|
And it seems very resilient in that as long as it finds the ncx opening tag it will not crash.
I will try to precheck the string for the ncx opening tag and if not present add it. That should prevent the crash. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Problem Generating Toc | DKCrotty | Sigil | 42 | 10-03-2016 06:48 AM |
calibre not generating toc | nsfwaa2 | Conversion | 4 | 09-18-2016 02:55 AM |
p.Heading3 is ignored when generating ToC? | Panel | Calibre | 2 | 03-28-2016 05:52 AM |
Generating HTML ToC | Katsunami | Editor | 5 | 02-12-2014 03:02 PM |
Help generating TOC | Diabolikul | Conversion | 3 | 01-26-2012 10:42 AM |