View Single Post
Old 05-23-2012, 05:32 PM   #1
Ravenik
Junior Member
Ravenik began at the beginning.
 
Posts: 4
Karma: 10
Join Date: May 2012
Device: Sony PRS-T1
How to obtain a new page for every chapter in regular expression (search/replace)?

Hi, I am a beginner in Calibre. I convert .epub -> .epub in order to break to a new page for every chapter.
I have chapters' heads in the format: ". XX ." where XX is a number.
My question is if I can force a new page for the destination epub before every chapter, using regular expression? What will I put in Replacement Text to result in a new page?

Currently I have:

Search:
Code:
<p class="calibre2"><span>[\s]*(\. \d\d? \.)
The Test search results OK, finding 77 occurances (correctly=the number of chapters)!!!!!

Replacement:
Code:
<div class="mbp_pagebreak"/></div><p class="mojrozdz1"><span>\1
I thought that <div class="mbp_pagebreak"/></div> will result in new pages (probably also in separate 77 .html files), but it does not.

Generally the above search/replace reg.exp. fails in two ways:
  1. "calibre2" class name is not replaced with "mojrozdz". "mojrozdz" does not occur in the result html files!
  2. <div class="mbp_pagebreak"/></div> does not occur in result file and furthermore there is no new page and no new .html file for each chapter

Please help me to understand what is wrong in my procedure as regards aforementioned failures 1. and 2. ? Calibre 0.8.52
Ravenik is offline   Reply With Quote