|
|
Thread Tools | Search this Thread |
05-23-2012, 05:32 PM | #1 |
Junior Member
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? \.) Replacement: Code:
<div class="mbp_pagebreak"/></div><p class="mojrozdz1"><span>\1 Generally the above search/replace reg.exp. fails in two ways:
Please help me to understand what is wrong in my procedure as regards aforementioned failures 1. and 2. ? Calibre 0.8.52 |
05-24-2012, 12:55 AM | #2 |
Wizard
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
|
The pagebreak you're trying to insert is specific to mobi, not ePub. Try this:
Search Pattern: Code:
<p[^>]*>\s*<span[^>]*>\s*(\.\s*\d+\s*\.)\s*</span>\s*</p> Code:
<h2>\1</h2> Code:
//h:h2 Calbre probably flattens the css in a way that mojrozdz1 disappears from your perspective (although it's also possible your regex was bad) - the correct way to do a custom style is to use extra css under Look and Feel. So take whatever you styles you want in mojrozdz1 and add them there for h2: Code:
h2{text-align:center;} Last edited by ldolse; 05-24-2012 at 01:04 AM. |
Advert | |
|
05-24-2012, 07:04 AM | #3 |
Junior Member
Posts: 4
Karma: 10
Join Date: May 2012
Device: Sony PRS-T1
|
Hi, Thanks a lot, your solution works! Now I think I will study a bit about xpath syntax.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Help with regular expression search/replace | bfollowell | Sigil | 12 | 06-20-2013 07:36 PM |
Regular Expression: does not replace with spaces | murphycc | Conversion | 3 | 02-11-2012 01:31 PM |
Search & Replace - Regular expression | oldbwl | Calibre | 2 | 01-09-2011 09:33 AM |
Regular expression for chapter combining | bremler | Sigil | 2 | 12-23-2010 09:06 AM |
Find/Replace with regular expression | hydrolith | Sigil | 6 | 03-01-2010 08:42 PM |