Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 03-24-2012, 06:33 AM   #1
cybmole
Wizard
cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.
 
Posts: 3,720
Karma: 1759970
Join Date: Sep 2010
Device: none
Question how to build toc when chapter headers are just images

I have a book in which images have been used as chapter headers - each chapter has a unique image.

the chapter header code looks like this
Code:
<h1 class="calibre8" id="calibre_pb_13"><span class="calibre9"><a class="calibre10"></a><img alt="" class="calibre11" src="../Images/record-522.jpg" /></span></h1>
the image name changes for each chapter, and the actual chapter number has been embedded into each image.
the id ="calibre_pb-nn" changes its value but nn increments 2 at a time & starts at 09 so would be tricky to extract & adjust that

I cannot think of any way to auto-generate a workable TOC from this - is there one ?
I could manually add text to each chapter header but that would take a long time.

Last edited by cybmole; 03-24-2012 at 06:36 AM.
cybmole is offline   Reply With Quote
Old 03-24-2012, 06:56 AM   #2
Rob Lister
Fanatic
Rob Lister ought to be getting tired of karma fortunes by now.Rob Lister ought to be getting tired of karma fortunes by now.Rob Lister ought to be getting tired of karma fortunes by now.Rob Lister ought to be getting tired of karma fortunes by now.Rob Lister ought to be getting tired of karma fortunes by now.Rob Lister ought to be getting tired of karma fortunes by now.Rob Lister ought to be getting tired of karma fortunes by now.Rob Lister ought to be getting tired of karma fortunes by now.Rob Lister ought to be getting tired of karma fortunes by now.Rob Lister ought to be getting tired of karma fortunes by now.Rob Lister ought to be getting tired of karma fortunes by now.
 
Posts: 532
Karma: 3293888
Join Date: Oct 2011
Location: Virginia
Device: Nook Simple Touch
What do you want the end result to look like?
Rob Lister is offline   Reply With Quote
Advert
Old 03-24-2012, 07:26 AM   #3
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 28,482
Karma: 204127028
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
If something in the id or the image name could be matched up to to the chapter number, you could probably get a regexp to at least add that info to the title attribute. But even then, nothing's going to be able to extract the chapter "name" from the different images. As it is (with the image name starting at 9 and incrementing by twos), I don't think you're going to be able to do either... automatically. Your best bet is to add the ToC entry you prefer to the title attribute of each chapter-header manually.
DiapDealer is offline   Reply With Quote
Old 03-24-2012, 07:43 AM   #4
Perkin
Guru
Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.
 
Perkin's Avatar
 
Posts: 657
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
Isn't there a title attribute you can insert in the h# tags that get recognised?
Perkin is offline   Reply With Quote
Old 03-24-2012, 08:12 AM   #5
Jabby
Jr. - Junior Member
Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.
 
Posts: 586
Karma: 2000358
Join Date: Aug 2010
Location: Alabama
Device: Archos, Asus, HP, Lenovo, Nexus and Samsung tablets in 7,8 and 10"
Quote:
Originally Posted by cybmole View Post
I have a book in which images have been used as chapter headers - each chapter has a unique image.

the chapter header code looks like this
Code:
<h1 class="calibre8" id="calibre_pb_13"><span class="calibre9"><a class="calibre10"></a><img alt="" class="calibre11" src="../Images/record-522.jpg" /></span></h1>
the image name changes for each chapter, and the actual chapter number has been embedded into each image.
the id ="calibre_pb-nn" changes its value but nn increments 2 at a time & starts at 09 so would be tricky to extract & adjust that

I cannot think of any way to auto-generate a workable TOC from this - is there one ?
I could manually add text to each chapter header but that would take a long time.
There are probable more elegant ways to do this, but I would try this:
Find <h1
Replace with <h1 title="Chapter 1"
For me, it beats copying the above to the clipboard and then pasting it one at a time.

You still have to fix the chapter count one-by-one..

Regards - John
Jabby is offline   Reply With Quote
Advert
Old 03-24-2012, 08:59 AM   #6
cybmole
Wizard
cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.
 
Posts: 3,720
Karma: 1759970
Join Date: Sep 2010
Device: none
Quote:
Originally Posted by Rob Lister View Post
What do you want the end result to look like?
I just want to be able to select a chapter from the toc menu when I put the book onto my Sony reader - but judging from previous comments I either have to do a long winded manual fix or accept that is not going to happen!

if I ask sigil to create a toc there are no visible entries- I guess it finds the h1 tags OK but because there is no text it then gives up

John's solution is the best so far.

if I weren't so OCD about tweaking books to meet my idealised requirement then 'twould not be an issue as I expect I'll only read it once; but I use challenges like this to improve my regex / book layout skills & I get frustrated when I cannot find an elegant solution

Last edited by cybmole; 03-24-2012 at 09:09 AM.
cybmole is offline   Reply With Quote
Old 03-24-2012, 09:27 AM   #7
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 28,482
Karma: 204127028
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Yeah, you're just going to have to bite the bullet and manually add a title="Chapter XX - The Beginning" attribute to each of your chapter <h> tags. Then... you'll be able to generate a ToC by clicking the button.
DiapDealer is offline   Reply With Quote
Old 03-24-2012, 10:24 AM   #8
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: 30,934
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Seeing the Images have unrecognisable generic names
Make them meaningful (eg. ..\Images\chapter_1), hopefully using the great Bulk renamer Meme built.
(Sigil adjusts the references )

Now that is done,
REGEX time

Code fragments

your search term: will include:
<h1 class="calibre8" id="calibre_pb_(\d+)">
Images\\chapter (\d+) <- note the SECOND forward reference

You are going to replace

<h1 class="calibre8" title="Chapter \2" > The Bold is what will be in the TOC

and repair the captured text

Images\chapter \2

I just threw away the id tag as Sigil's TOC generator will make a new one if missing
theducks is offline   Reply With Quote
Old 03-24-2012, 10:31 AM   #9
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 28,482
Karma: 204127028
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Nice catch on the mass image renaming!

It won't help getting the chapter name/title from the image, but it will get things a lot closer a lot quicker.
DiapDealer is offline   Reply With Quote
Old 03-24-2012, 02:42 PM   #10
Jabby
Jr. - Junior Member
Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.Jabby ought to be getting tired of karma fortunes by now.
 
Posts: 586
Karma: 2000358
Join Date: Aug 2010
Location: Alabama
Device: Archos, Asus, HP, Lenovo, Nexus and Samsung tablets in 7,8 and 10"
Quote:
Originally Posted by theducks View Post
Seeing the Images have unrecognisable generic names
Make them meaningful (eg. ..\Images\chapter_1), hopefully using the great Bulk renamer Meme built.
(Sigil adjusts the references )

Now that is done,
REGEX time

Code fragments

your search term: will include:
<h1 class="calibre8" id="calibre_pb_(\d+)">
Images\\chapter (\d+) <- note the SECOND forward reference

You are going to replace

<h1 class="calibre8" title="Chapter \2" > The Bold is what will be in the TOC

and repair the captured text

Images\chapter \2

I just threw away the id tag as Sigil's TOC generator will make a new one if missing
If you have books that come from Calibre and your book has other images scattered around, you could have a problem.

Calibre assigns a starting image number and increments as it goes. So,you could have a chapter 5 (00005.jpg) image followed by a photo image (00006.jpg) followed by a chapter 6 (00007.jpg) image. This sequence would put a photo to depict chapter 6 and all after would be off.

This works just fine if the chapters are in strict sequential order. You needn't ask how I know.

Regards - John

Last edited by Jabby; 03-24-2012 at 05:06 PM.
Jabby is offline   Reply With Quote
Old 03-24-2012, 07:56 PM   #11
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: 30,934
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by Jabby View Post
If you have books that come from Calibre and your book has other images scattered around, you could have a problem.

Calibre assigns a starting image number and increments as it goes. So,you could have a chapter 5 (00005.jpg) image followed by a photo image (00006.jpg) followed by a chapter 6 (00007.jpg) image. This sequence would put a photo to depict chapter 6 and all after would be off.

This works just fine if the chapters are in strict sequential order. You needn't ask how I know.

Regards - John
If you use Calibre. Open the EPUB with TweaK, Locate the images (easy if the have been touched by Sigil, they will be in the Images folder), Select All (images): Print (the photo wizard should start): Print a Proof sheet (thumbnails)
Now you know which to rename
Yo also get to see which images are really repeats (usually scene breakes and chapter logo's that are not numbered) and pick just one to use, making the book smaller, less bloat
Sigil 5 allow multiple placement of the SAME image
theducks is offline   Reply With Quote
Old 03-24-2012, 07:57 PM   #12
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: 30,934
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
deleted duplicate answer

Last edited by theducks; 03-31-2012 at 03:20 PM. Reason: Duplicate
theducks is offline   Reply With Quote
Old 03-26-2012, 01:47 AM   #13
cybmole
Wizard
cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.
 
Posts: 3,720
Karma: 1759970
Join Date: Sep 2010
Device: none
thanks but I went instead with a variation of John's solution, I regexed in some place holder text into each h1 tag, so that sigil could build a toc. I then edited the toc page , adding chapter numbers 1, 2, 3 etc into title field & then regexed the placeholder text back out again.

it will be find now so long as a don't touch the recreate to button!

messing with the images would have taken much longer as ever image contained a chapter number & they look good as-is.
cybmole is offline   Reply With Quote
Old 03-31-2012, 11:21 AM   #14
Dopedangel
Wizard
Dopedangel ought to be getting tired of karma fortunes by now.Dopedangel ought to be getting tired of karma fortunes by now.Dopedangel ought to be getting tired of karma fortunes by now.Dopedangel ought to be getting tired of karma fortunes by now.Dopedangel ought to be getting tired of karma fortunes by now.Dopedangel ought to be getting tired of karma fortunes by now.Dopedangel ought to be getting tired of karma fortunes by now.Dopedangel ought to be getting tired of karma fortunes by now.Dopedangel ought to be getting tired of karma fortunes by now.Dopedangel ought to be getting tired of karma fortunes by now.Dopedangel ought to be getting tired of karma fortunes by now.
 
Dopedangel's Avatar
 
Posts: 1,792
Karma: 30548723
Join Date: Dec 2006
Location: Singapore
Device: Boyue
Quote:
Originally Posted by cybmole View Post
thanks but I went instead with a variation of John's solution, I regexed in some place holder text into each h1 tag, so that sigil could build a toc. I then edited the toc page , adding chapter numbers 1, 2, 3 etc into title field & then regexed the placeholder text back out again.

it will be find now so long as a don't touch the recreate to button!

messing with the images would have taken much longer as ever image contained a chapter number & they look good as-is.
If the chapters are split properly using epub fixer you can just select all the chapters add and then rename them automatically I know I am a bit late in giving an answer but for future use.
Dopedangel is offline   Reply With Quote
Old 03-31-2012, 02:12 PM   #15
cybmole
Wizard
cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.
 
Posts: 3,720
Karma: 1759970
Join Date: Sep 2010
Device: none
Quote:
Originally Posted by Dopedangel View Post
If the chapters are split properly using epub fixer you can just select all the chapters add and then rename them automatically I know I am a bit late in giving an answer but for future use.
please explain how to do that, given that chapters are split ( = 1 x xhtlml per chapter)
but that chapter headers are image only
cybmole is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
what to do when chapter headers are images ?s cybmole Conversion 5 04-06-2011 03:02 PM
Hiding headers in images Paddlin ePub 9 01-06-2011 02:40 PM
Images don't show up after build angbrown Kindle Formats 3 09-25-2009 09:06 AM
html2epub TOC and chapter detection help ilovejedd Calibre 6 02-22-2009 05:58 PM
Pielrf - Text to LRF with Easy TOC, Headers, Curly-Quotes, etc. (Mac!) EatingPie LRF 104 01-12-2009 12:35 PM


All times are GMT -4. The time now is 11:33 PM.


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