Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Conversion

Notices

Reply
 
Thread Tools Search this Thread
Old 04-21-2014, 01:28 PM   #1
cabpp
Junior Member
cabpp began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Apr 2014
Device: Kindle
TOC conversion with images as Chapter Heading

I want to create a TOC in Mobi and ePub when converting through Calibre. My chapter headings in file are images, no actual text headers.

<p class="chapter" align="right">

<img src="/Users/Desktop/book/Chapter 2.jpg" alt="Chapter 2" width="236" height="148"/></p>

This is the format in file. I am not sure how to create, or force create a TOC with images as headings. I'm using Textmate as editor.

Any thoughts would be appreciated. I've tried unsuccessfully using XPath - book starts with Chapter 7, and then list TOC as all unnamed.

Thanks
cabpp is offline   Reply With Quote
Old 04-21-2014, 01:51 PM   #2
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,212
Karma: 16534894
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
Try <p title="Chapter 2" class="... etc> in your source html before calibre conversion.
jackie_w is offline   Reply With Quote
Advert
Old 04-21-2014, 02:35 PM   #3
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: 29,809
Karma: 54830978
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 cabpp View Post
I want to create a TOC in Mobi and ePub when converting through Calibre. My chapter headings in file are images, no actual text headers.

<p class="chapter" align="right">

<img src="/Users/Desktop/book/Chapter 2.jpg" alt="Chapter 2" width="236" height="148"/></p>

This is the format in file. I am not sure how to create, or force create a TOC with images as headings. I'm using Textmate as editor.

Any thoughts would be appreciated. I've tried unsuccessfully using XPath - book starts with Chapter 7, and then list TOC as all unnamed.

Thanks


You want to convert and modify<p class="chapter"

to a <p class="chapter" title="\2"


I suggest the book-editor
Not tested
(REGEX)Search:
Code:
 <p class="chapter" align="right">\s+(<img src="/Users/Desktop/book/.+.jpg"  alt=)"(.+?)" (.+?)/>)</p>
Replace:
Code:
<p class="chapter" align="right" title="\2">\1"\2" \3</p>
The therory: Capture the Alt value, use that to construct and insert the title=" "

Second phase is to replace the P tag pair with a H# pair

Note I would also move the align right to .chapter in the CSS

BIG NOTE: src="/Users/Desktop

That path will break your book as soon as you move the book
theducks is offline   Reply With Quote
Old 04-21-2014, 05:32 PM   #4
cabpp
Junior Member
cabpp began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Apr 2014
Device: Kindle
Hi. Thanks for the replies. I actually inserted

<p class="chapter hidden">Chapter 1</p> before each image, with the settings :

p.hidden

{
display: none;
visibility: hidden;
}

Then I entered the path for Chapter creation in Calibre, and it worked. I emailed G. Henkel (big help), and he provided me with this solution.

As far as the location of the picture file,

BIG NOTE: src="/Users/Desktop

That path will break your book as soon as you move the book:

I am a newbie to this html / css coding, and am learning on the fly. I don't know all the tips, tricks, and "the right way to do things", but I sure appreciate you more experienced / knowledgeable people helping me and others out.

I'm not sure what you mean by break the book, I assume you mean it won't work unless it is in that folder location (correct)? I thought after converting the book to a mobi / ePub I wouldn't need that original folder / file anymore.??

You want to convert and modify<p class="chapter"

to a <p class="chapter" title="\2"

I have been scouring the internet for tips and tricks, and solutions to all the issues I have come up with in the past few days. I'm not sure what the title="/2" does? I'm just trying to figure out what all the different classes, div, etc. mean and how they work.

Do you have a trusted website or book that you would recommend I read.

Thanks again.
cabpp is offline   Reply With Quote
Old 04-21-2014, 06:24 PM   #5
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: 29,809
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
\2 is (whatever was in) the second capture group replacement

Read the REGEX sicky at the top of THIS forum group

Search (This)\s+(is)\s+(fine)

Replace: \3 \2 \1 =fine is This
theducks is offline   Reply With Quote
Advert
Old 04-21-2014, 06:36 PM   #6
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,572
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by cabpp View Post
Do you have a trusted website or book that you would recommend I read.
The Mobileread Wiki has good introductory sections - https://wiki.mobileread.com/ (use search)

Also have a look at http://www.w3schools.com/ a lot of the 'stuff' that's used on websites is not applicable to ebooks - so you don't need to know all that's at W3C.

BR
BetterRed is offline   Reply With Quote
Reply

Tags
toc creation, toc images


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to build toc when chapter headers are just images cybmole Sigil 17 04-02-2012 05:03 AM
Conversion turns chapter heading BOLD Bobosmite Conversion 5 03-05-2012 12:12 PM
Images resizing in epub to pdf conversion + TOC not creating brontus Conversion 2 10-30-2011 12:30 AM
the toc goto next chapter feature disappears on conversion alansplace Calibre 5 08-06-2011 03:58 PM
Controlling chapter heading sizes? Djehuty Calibre 3 04-27-2009 08:02 PM


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


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