![]() |
#1 |
Connoisseur
![]() Posts: 70
Karma: 10
Join Date: May 2016
Device: Koreader running on Kobo Libra 2
|
Find Replace across several pages
Hello
I've got an epub of 1500 html files, made of 15 Chapters named A to 0 and subchapter I've got several TOC in html : one global plus one per each chapter which is is positioned just at the beginning of the chapter. On the global TOC in file_001.html, I've got this an expression which gives the link to the Chapter A, sub 1: a class="text_1" href="../Text/file_003.html#id_ChA__sub_1">Chapter A, subchapter 1</a></p> and in the 002.html file which is the TOC for the chapter A, I've got : <a class="text_2">Chapter A, subchapter 1 : some introductory text to subchapter</a> I want in the file 002.html to introduce the link to Chapter 1, sub 1 in order to have this expression <a class="text_2"href="../Text/file_003.html#id_ChA__sub_1">Chapter A, subchapter 1 : some introductory text to subchapter</a> The difficulty is to get the expression from one file 001. html and to paste it in the 002.html. and to do it for all chapter TOC. How an I do it ? Thanks for your help Villard |
![]() |
![]() |
![]() |
#2 |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,313
Karma: 20171571
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
Hello Villard and welcome to MR!
I don't think Sigil has a built in function that will do that completely automatically. You will have to do some manual setup and copy/paste. However, you can minimize the amount of copy/paste by taking advantage of Sigil's TOC generator. You'll have to prep your epub to make it work: 1) make sure your TOC is not semantically marked as the TOC (it could get overwritten) 2) You need to make sure you are using a heading tag to identify the title of each chapter/sub-chapter. (eg <h2>Chapter A</h2> <h3>Subchapter 1</h3>) You can use regex to Search/Replace and create all those <h2> and <h3> tags. While doing that, I would add the introductory text as part of the title element of the tag like this: <h3 title="Subchapter 1: Some introductory text">Subchapter 1</h3> When you have all that done, run Sigil's TOC generator and it will create a new Global TOC with all the correct links to the correct pages. 3) Copy/Paste from the Global TOC to create your Sub-TOC as you need. Having said all that, I would like to remind you that one of the great benefits of an ebook is that it has built-in Navigation to each of the Chapters/sub-chapters. An html global TOC with html sub-TOCs is not strictly necessary. You should consider having a basic HTML Global TOC that provides Chapter guidance and rely on the built-in Navigation for all your sub-chapters. That will drastically reduce the amount of work. Cheers! |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Connoisseur
![]() Posts: 70
Karma: 10
Join Date: May 2016
Device: Koreader running on Kobo Libra 2
|
Hello
Thanks very much for your suggestion. It gives a good start. I'll work on it in the next days... I am looking for TOC per chapter for 2 reasons - the global TOC is very long and the navigation can be painful - it allows also to give a short introduction for each subchapter. I thought I could in Sigil parse over several files To solve my problem, I would also be happy if I could in Sigil replaceb by using an external file in which each line would have "previous expression to replace" and " new expression". But I don't think Sigil can rely replace on external files. Anyway I will work on your suggestion. Thanks Villard |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Find/Replace ? | Otter | Calibre | 2 | 10-08-2012 08:48 PM |
Find Replace | unrulyguides | Sigil | 5 | 02-17-2012 08:38 PM |
Find/Replace Won't Find | Rand Brittain | Sigil | 7 | 09-24-2011 04:35 AM |
Find / replace | bremler | Sigil | 6 | 12-17-2010 03:26 PM |
Using Find/Replace with BD | Otter | Sony Reader | 7 | 02-28-2009 01:49 PM |