View Single Post
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