Register Guidelines E-Books Search Today's Posts Mark Forums Read

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

Notices

Reply
 
Thread Tools Search this Thread
Old 06-15-2011, 10:11 PM   #1
Nathan0015
Junior Member
Nathan0015 began at the beginning.
 
Posts: 3
Karma: 10
Join Date: May 2009
Device: PRS-505
Managing Scene Breaks during Conversion

Hi Everyone,

I was hoping to get a little help on managing my scene breaks during the conversion process. My primary use for the kindle is reading all of my fanfiction away from my computer, and as such I end up converting primarily HTML files to Mobi format. Every writer has a different preferred method for identifying their scene breaks from ######### to ****E E ****, so I'm trying to find a good way to identify a scene break and then ensure there is a space above and below the break.

The best way I have thought of to do this is using the search and replace function to identify which items are centered using this regular expression:

<p style="text-align:center;">.*?</p>

This works beautifully for selecting every scene break an author can come up with. Now that I can find them though I'm not sure about how to add the breaks above and below them. Also, this unfortunetley finds Chapters as well as scene breaks, so if I could figure out a way to exclude any center aligned text that uses the word chapter, that would be incredibly helpful as well.

Hopefully I managed to accuretley describe what I am striving towards, and if clarification is needed I would be happy to expound further. I would greatly appreciate any help anyone could give.
Nathan0015 is offline   Reply With Quote
Old 06-16-2011, 01:38 AM   #2
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
Have you tried the 'format scene breaks' option under heuristics? It automatically handles/formats the most common types of scene breaks. You could tie this with the 'markup chapters' option to avoid chapters being screwed up, or use a combination of markup chapters with your regex.

You'll also need to use extra css under look and feel to re-center your chapter headings if you use the markup chapters option.
ldolse is offline   Reply With Quote
Old 06-16-2011, 07:22 AM   #3
Nathan0015
Junior Member
Nathan0015 began at the beginning.
 
Posts: 3
Karma: 10
Join Date: May 2009
Device: PRS-505
I have tried using the 'format scene breaks' during conversion, but it does not seem to do anything. I am unclear on exactly what that option looks for to determine whether or not something is a scene break, or how to adjust that determination (if that is possible).

*Edit*

I think I found a way to do what I want using the search and replace, If I can copy the data found in the first search. For Example:

<p style="text-align:center;">.*?</p>

This searches for anything contained in my center aligned tags (which is what I want it to do). When It goes to the replace option is there a way for me to reuse the information it found between the tags? Ideally I would just want to replace the searched for information with the same information, plus <br/> before and after, so:

Search:
<p style="text-align:center;">.*?</p>
Replace:
<br/><p style="text-align:center;">.*?</p><br/>

while hopefully preserving whatever the .*? was

Last edited by Nathan0015; 06-16-2011 at 08:09 AM.
Nathan0015 is offline   Reply With Quote
Old 06-16-2011, 01:53 PM   #4
jackie_w
Wizard
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: 2,700
Karma: 3818505
Join Date: Sep 2009
Location: UK
Device: Sony PRS-350, PB360, Kobo Glo/AuraHD/Aura6"
I'm no Regex expert, but you could try:

Code:
Search:
(<p style="text-align:center;">)(.*?)(</p>)

Replace:
\1<br />\2<br />\3
I think the line-breaks should be inside the <p> tags, not outside.
jackie_w is online now   Reply With Quote
Old 06-16-2011, 02:07 PM   #5
theducks
Grand Sorcerer
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: 14,251
Karma: 5495470
Join Date: Aug 2009
Location: The (original) Silicon Valley, USA
Device: Galaxy Tab 2, Astak Pocket Pro, K4NT
Quote:
Originally Posted by jackie_w View Post
I'm no Regex expert, but you could try:

Code:
Search:
(<p style="text-align:center;">)(.*?)(</p>)

Replace:
\1<br />\2<br />\3
I think the line-breaks should be inside the <p> tags, not outside.
Flightcrew would scream about naked <br />
theducks is offline   Reply With Quote
Old 06-16-2011, 03:48 PM   #6
jackie_w
Wizard
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: 2,700
Karma: 3818505
Join Date: Sep 2009
Location: UK
Device: Sony PRS-350, PB360, Kobo Glo/AuraHD/Aura6"
Quote:
Originally Posted by theducks View Post
Flightcrew would scream about naked <br />
Are you saying that my suggested solution is invalid?
jackie_w is online now   Reply With Quote
Old 06-16-2011, 04:05 PM   #7
theducks
Grand Sorcerer
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: 14,251
Karma: 5495470
Join Date: Aug 2009
Location: The (original) Silicon Valley, USA
Device: Galaxy Tab 2, Astak Pocket Pro, K4NT
Quote:
Originally Posted by jackie_w View Post
Are you saying that my suggested solution is invalid?
No
I agree the <br /> must be within <P> tags
theducks is offline   Reply With Quote
Old 06-16-2011, 04:08 PM   #8
jackie_w
Wizard
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: 2,700
Karma: 3818505
Join Date: Sep 2009
Location: UK
Device: Sony PRS-350, PB360, Kobo Glo/AuraHD/Aura6"
Quote:
Originally Posted by theducks View Post
No
I agree the <br /> must be within <P> tags
Oh good, that's a relief
jackie_w is online now   Reply With Quote
Old 06-17-2011, 09:38 AM   #9
Nathan0015
Junior Member
Nathan0015 began at the beginning.
 
Posts: 3
Karma: 10
Join Date: May 2009
Device: PRS-505
Thanks so much guys! That code worked great, and with a couple of minor modifications my conversion process is almost seamless.

Thanks again for your help!
Nathan0015 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Scene Breaks - Using more than one type ghostyjack Workshop 7 04-07-2011 07:33 AM
Scene breaks within a chapter. How do you guys format them? bfollowell Workshop 5 11-18-2010 02:24 AM
Maintaining scene breaks wellington Calibre 6 07-18-2010 08:43 PM
Scene breaks at page top/bottom radius Workshop 20 12-15-2009 06:59 PM
New to the scene, libprs500 / conversion questions mflood Calibre 3 11-26-2007 10:43 PM


All times are GMT -4. The time now is 06:47 AM.


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