![]() |
#1 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,720
Karma: 1759970
Join Date: Sep 2010
Device: none
|
![]()
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 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. |
![]() |
![]() |
![]() |
#2 |
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 532
Karma: 3293888
Join Date: Oct 2011
Location: Virginia
Device: Nook Simple Touch
|
What do you want the end result to look like?
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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.
|
![]() |
![]() |
![]() |
#4 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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?
|
![]() |
![]() |
![]() |
#5 | |
Jr. - Junior Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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:
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 |
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,720
Karma: 1759970
Join Date: Sep 2010
Device: none
|
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. |
![]() |
![]() |
![]() |
#7 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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.
|
![]() |
![]() |
![]() |
#8 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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 |
![]() |
![]() |
![]() |
#9 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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. ![]() |
![]() |
![]() |
![]() |
#10 | |
Jr. - Junior Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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:
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. |
|
![]() |
![]() |
![]() |
#11 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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:
Now you know which to rename Yo also get to see which images are really repeats ![]() Sigil 5 allow multiple placement of the SAME image ![]() |
|
![]() |
![]() |
![]() |
#12 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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 |
![]() |
![]() |
![]() |
#13 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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. |
![]() |
![]() |
![]() |
#14 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,792
Karma: 30548723
Join Date: Dec 2006
Location: Singapore
Device: Boyue
|
Quote:
|
|
![]() |
![]() |
![]() |
#15 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,720
Karma: 1759970
Join Date: Sep 2010
Device: none
|
Quote:
but that chapter headers are image only |
|
![]() |
![]() |
![]() |
|
![]() |
||||
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 |