|
|
#1 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,305
Karma: 10259306
Join Date: May 2016
Device: kobo forma, Kobo Libra, Huawei media Tab, fire HD10, PW3 HDX8.9,
|
create a useable TOC when book uses images for chapter headings
so I have a book structured like this - where image000r says Chapter 1...
each chapter starts with a h1 tagged image but no text: <h1 class="calibre10" id="calibre_pb_12"> <a id="_Toc511571660"><img src="../Images/00005.jpeg" alt="" class="calibre11"/></a> </h1> the next chapter will use images/0006 for chapter 2 etc if i ask sigil to create a TOC all entries are blank as there is no text for it to use can anyone suggest a slick tweak so that I can have 1, 2 ,3 ... or chapter 1, chapter 2... etc in a TOC i could "find" the "5" with regex but I don't know how to do subtraction within regex, so that it can be changed into a 1 when i use replace |
|
|
|
|
|
#2 |
|
Obsessively Dedicated...
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,241
Karma: 35158061
Join Date: May 2011
Location: PA {back in the usa!}
Device: Sony PRS-T2, ADE on PC
|
Insert a title tag in the <h>
Code:
<h1 title="Chapter 1" class="calibre10" id="calibre_pb_12"> <a id="_Toc511571660"><img src="../Images/00005.jpeg" alt="" class="calibre11"/></a> </h1>
This is also handy if you want the generated TOC to read differently than the text displayed on the page. For example, the page could display Chapter One - The Beginning, but if the title only includes The Beginning, the TOC will only show The Beginning. I think there might be a Sigil plugin that could help you, but am not sure. I must admit, I use an AutoHotkey script in Notepad++ to create titles for chapter headings, using search and replace combined with pre-set text strings. Last edited by GrannyGrump; 06-03-2019 at 05:43 AM. |
|
|
|
|
|
#3 |
|
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,389
Karma: 20212733
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
|
|
|
|
|
|
|
#4 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,305
Karma: 10259306
Join Date: May 2016
Device: kobo forma, Kobo Libra, Huawei media Tab, fire HD10, PW3 HDX8.9,
|
incremental Ids looks to be what I need, but I will have to study it - thanks.
should be better than in typing in titles for each chapter manually. I am only really fussed about making a usable TOC, for when I am reading the book in MOon reader |
|
|
|
|
|
#5 | ||
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,306
Karma: 13057279
Join Date: Jul 2012
Device: Kobo Forma, Nook
|
Quote:
Quote:
6 months ago I wrote a post discussing why images as chapter headings are a poor idea: https://www.reddit.com/r/selfpublish...il_or/eardjxo/ |
||
|
|
|
|
|
#6 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,305
Karma: 10259306
Join Date: May 2016
Device: kobo forma, Kobo Libra, Huawei media Tab, fire HD10, PW3 HDX8.9,
|
its just a quick tweak for reading myself.
I don't sell books or services, but I like to have a working toc for my own use when I read in reader apps. I had a quick go with the rework chapter headings plug in, and it was suprisingly easy = so thanks again for that. |
|
|
|
|
|
#7 |
|
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,238
Karma: 61360164
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Be sure to set the same/similar text into the alt="" of the img tag, that allows screen readers (TTS) to say the name
|
|
|
|
|
|
#8 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,305
Karma: 10259306
Join Date: May 2016
Device: kobo forma, Kobo Libra, Huawei media Tab, fire HD10, PW3 HDX8.9,
|
that's probably good general advice for sellers, but as i just said " its a quick tweak for reading myself". The tweaked version is not going anywhere & does not have to work for any one else, or for TTS
|
|
|
|
|
|
#9 | |
|
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,238
Karma: 61360164
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
Do it now. Your vision may not last or it may go bad really quickly (experience talking here) You can use as the \1 replacement as many times in the replace term as you need So, set the title="\1" and the alt="\1" in the same pass |
|
|
|
|
|
|
#10 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,305
Karma: 10259306
Join Date: May 2016
Device: kobo forma, Kobo Libra, Huawei media Tab, fire HD10, PW3 HDX8.9,
|
its only 150 pages - i thing my eyes will hold out until I get to the end
![]() but I will probably do as you say, for editing practice. ** but then again, once your vision gets so bad that you need TTS - how do you edit future books anyway ![]() ** update . no can do . after the rework chapter headers plug in had done its thing, all I have now is these headers <h2>Chapter 1</h2> i told it to strip out the image headers then to generate new simple ones I'd have to go back to the original_epub and start over strangely, its book 2 of a quartet and the other 3 don't have this image only chapter headers design. I have not read book 1 yet so I don't even know if I am going to like it and want to continue... I am impressed with the plug in though. I am sure I will find a future use for that - vision permitting
|
|
|
|
|
|
#11 | |
|
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 681
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
|
Quote:
If they are at least numbered in sequence, you can select all the chapter head images in the file list and rename as "Chapter_1" and they will be named in sequence from that. You might use "Chapter_01" to make them sort correctly after renaming if more than 9 chapters. You could then use a simple regex to grab the image name and insert a "title=\1" tag; and/or "alt=\1" tag for each heading. If the image names are random, you can use Tools -- Reports -- Images to see them all together and rename them manually; obviously a bit more tedious. Often though these image titles are not worth the hassle and the bloat they bring to the file. You can replace them with text and maybe a common ornament. Or if I keep them, I run them through Irfanview's batch convert and convert them from 16 million colour jpegs (as they usually are in retail books) to 4 colour GIFs, usually reducing them by 90% in size; adding a sharpen maybe. Usually indistinguishable, sometimes better, than original. Last edited by AlanHK; 06-06-2019 at 04:17 AM. |
|
|
|
|
|
|
#12 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,305
Karma: 10259306
Join Date: May 2016
Device: kobo forma, Kobo Libra, Huawei media Tab, fire HD10, PW3 HDX8.9,
|
they were in sequence but with an offset. So image 00005 = chapter 1, image 00006 = chapter 2...
as I said in post #1 i think I could have regexed the number from each image file name into header text but it was the need to subtract 4 that stumped me. do tell, if I missed a trick there. meanwhile the suggestion of using the chapter headers plug in worked well |
|
|
|
|
|
#13 | |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,306
Karma: 13057279
Join Date: Jul 2012
Device: Kobo Forma, Nook
|
Quote:
https://www.mobileread.com/forums/sh...84#post3816784 1. Select multiple JPG files in the Book Browser (Shift-Click or Ctrl-Click). 2. Right-click highlighted files, then press Rename. 4. Name it something, and Sigil will number them sequentially for you. For example, if you type: Code:
Chapter01 Chapter02.jpg Chapter03.jpg Chapter04.jpg [...] |
|
|
|
|
|
|
#14 | |
|
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 681
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
|
Quote:
Then the regex from filename to text is trivial. |
|
|
|
|
|
|
#15 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,305
Karma: 10259306
Join Date: May 2016
Device: kobo forma, Kobo Libra, Huawei media Tab, fire HD10, PW3 HDX8.9,
|
so a quick clarify please. if I rename most of image file names as you proposed, is Sigil smart enough to track down and change all references to those files, in the HTML code ?
|
|
|
|
![]() |
| Thread Tools | Search this Thread |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| TOC conversion with images as Chapter Heading | cabpp | Conversion | 5 | 04-21-2014 06:36 PM |
| Smashwords formatting issues with headings, TOC and images | amoroso | Writers' Corner | 9 | 06-01-2012 04:59 PM |
| how to build toc when chapter headers are just images | cybmole | Sigil | 17 | 04-02-2012 05:03 AM |
| Issue With Chapter Headings and TOC | yoss15 | Kindle Formats | 5 | 02-07-2012 01:54 PM |
| Managing HTML Link Behavior, From TOC to Chapter Headings | FlooseMan Dave | Calibre | 1 | 03-31-2010 11:55 PM |