Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 06-03-2019, 05:22 AM   #1
stumped
Wizard
stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.
 
Posts: 1,683
Karma: 1667853
Join Date: May 2016
Device: lLenovo Yoya tab plus , fire HD10 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
stumped is offline   Reply With Quote
Old 06-03-2019, 06:33 AM   #2
GrannyGrump
Obsessively Dedicated...
GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.
 
GrannyGrump's Avatar
 
Posts: 2,108
Karma: 19537404
Join Date: May 2011
Location: JAPAN (US expatriate)
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>
When you run the Sigil TOC generator, it will snag the title as you have typed it.

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 06:43 AM.
GrannyGrump is offline   Reply With Quote
Advert
Old 06-03-2019, 09:40 AM   #3
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 1,879
Karma: 12505016
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone X/6/iPad 1,2 & Air/Surface Pro/Kindle PW
Incremental IDs plugin

and

ReworkChapterHeads
Turtle91 is offline   Reply With Quote
Old 06-03-2019, 09:58 AM   #4
stumped
Wizard
stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.
 
Posts: 1,683
Karma: 1667853
Join Date: May 2016
Device: lLenovo Yoya tab plus , fire HD10 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
stumped is offline   Reply With Quote
Old 06-03-2019, 10:13 AM   #5
Tex2002ans
Wizard
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 1,354
Karma: 6839399
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by GrannyGrump View Post
Insert a title tag in the <h>

When you run the Sigil TOC generator, it will snag the title as you have typed it.
Yep, title="" is the way you do it.

Quote:
Originally Posted by stumped View Post
so I have a book structured like this - where image000r says Chapter 1...
each chapter starts with a h1 tagged image but no text:
Is this a book you're tweaking for yourself? Or putting for sale?

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/
Tex2002ans is offline   Reply With Quote
Advert
Old 06-03-2019, 10:18 AM   #6
stumped
Wizard
stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.
 
Posts: 1,683
Karma: 1667853
Join Date: May 2016
Device: lLenovo Yoya tab plus , fire HD10 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.
stumped is offline   Reply With Quote
Old 06-03-2019, 10:41 AM   #7
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 23,998
Karma: 27923385
Join Date: Aug 2009
Location: The Central Coast of California
Device: K4NT, Galaxy Tab A, Kobo Aura2
Be sure to set the same/similar text into the alt="" of the img tag, that allows screen readers (TTS) to say the name
theducks is offline   Reply With Quote
Old 06-03-2019, 11:15 AM   #8
stumped
Wizard
stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.
 
Posts: 1,683
Karma: 1667853
Join Date: May 2016
Device: lLenovo Yoya tab plus , fire HD10 HDX8.9,
Quote:
Originally Posted by theducks View Post
Be sure to set the same/similar text into the alt="" of the img tag, that allows screen readers (TTS) to say the name
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
stumped is offline   Reply With Quote
Old 06-03-2019, 11:31 AM   #9
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 23,998
Karma: 27923385
Join Date: Aug 2009
Location: The Central Coast of California
Device: K4NT, Galaxy Tab A, Kobo Aura2
Quote:
Originally Posted by stumped View Post
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
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
theducks is offline   Reply With Quote
Old 06-03-2019, 02:55 PM   #10
stumped
Wizard
stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.
 
Posts: 1,683
Karma: 1667853
Join Date: May 2016
Device: lLenovo Yoya tab plus , fire HD10 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
stumped is offline   Reply With Quote
Old 06-06-2019, 05:10 AM   #11
AlanHK
Fanatic
AlanHK is slicker than a case of WD-40AlanHK is slicker than a case of WD-40AlanHK is slicker than a case of WD-40AlanHK is slicker than a case of WD-40AlanHK is slicker than a case of WD-40AlanHK is slicker than a case of WD-40AlanHK is slicker than a case of WD-40AlanHK is slicker than a case of WD-40AlanHK is slicker than a case of WD-40AlanHK is slicker than a case of WD-40AlanHK is slicker than a case of WD-40
 
AlanHK's Avatar
 
Posts: 504
Karma: 73392
Join Date: Apr 2014
Device: PW-3, Android phone
Quote:
Originally Posted by stumped View Post
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
One thing that makes code less cryptic is to rename the images to something meaningful.
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 05:17 AM.
AlanHK is offline   Reply With Quote
Old 06-06-2019, 05:39 AM   #12
stumped
Wizard
stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.
 
Posts: 1,683
Karma: 1667853
Join Date: May 2016
Device: lLenovo Yoya tab plus , fire HD10 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
stumped is offline   Reply With Quote
Old 06-06-2019, 03:59 PM   #13
Tex2002ans
Wizard
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 1,354
Karma: 6839399
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by stumped View Post
they were in sequence but with an offset. So image 00005 = chapter 1, image 00006 = chapter 2...
You could use Sigil's mass renaming:

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
Sigil will renumber the rest:

Chapter02.jpg
Chapter03.jpg
Chapter04.jpg
[...]
Tex2002ans is offline   Reply With Quote
Old 06-08-2019, 01:04 AM   #14
AlanHK
Fanatic
AlanHK is slicker than a case of WD-40AlanHK is slicker than a case of WD-40AlanHK is slicker than a case of WD-40AlanHK is slicker than a case of WD-40AlanHK is slicker than a case of WD-40AlanHK is slicker than a case of WD-40AlanHK is slicker than a case of WD-40AlanHK is slicker than a case of WD-40AlanHK is slicker than a case of WD-40AlanHK is slicker than a case of WD-40AlanHK is slicker than a case of WD-40
 
AlanHK's Avatar
 
Posts: 504
Karma: 73392
Join Date: Apr 2014
Device: PW-3, Android phone
Quote:
Originally Posted by stumped View Post
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.l
As I said: 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.

Then the regex from filename to text is trivial.
AlanHK is offline   Reply With Quote
Old 06-08-2019, 01:59 AM   #15
stumped
Wizard
stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.stumped ought to be getting tired of karma fortunes by now.
 
Posts: 1,683
Karma: 1667853
Join Date: May 2016
Device: lLenovo Yoya tab plus , fire HD10 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 ?
stumped is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
TOC conversion with images as Chapter Heading cabpp Conversion 5 04-21-2014 07:36 PM
Smashwords formatting issues with headings, TOC and images amoroso Writers' Corner 9 06-01-2012 05:59 PM
how to build toc when chapter headers are just images cybmole Sigil 17 04-02-2012 06:03 AM
Issue With Chapter Headings and TOC yoss15 Kindle Formats 5 02-07-2012 02:54 PM
Managing HTML Link Behavior, From TOC to Chapter Headings FlooseMan Dave Calibre 1 04-01-2010 12:55 AM


All times are GMT -4. The time now is 01:20 PM.


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