06-15-2011, 10:11 PM | #1 |
Junior Member
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. |
06-16-2011, 01:38 AM | #2 |
Wizard
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. |
Advert | |
|
06-16-2011, 07:22 AM | #3 |
Junior Member
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. |
06-16-2011, 01:53 PM | #4 |
Grand Sorcerer
Posts: 6,205
Karma: 16228558
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
|
I'm no Regex expert, but you could try:
Code:
Search: (<p style="text-align:center;">)(.*?)(</p>) Replace: \1<br />\2<br />\3 |
06-16-2011, 02:07 PM | #5 |
Well trained by Cats
Posts: 29,768
Karma: 54401244
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
|
Advert | |
|
06-16-2011, 03:48 PM | #6 |
Grand Sorcerer
Posts: 6,205
Karma: 16228558
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
|
|
06-16-2011, 04:05 PM | #7 |
Well trained by Cats
Posts: 29,768
Karma: 54401244
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
|
06-16-2011, 04:08 PM | #8 |
Grand Sorcerer
Posts: 6,205
Karma: 16228558
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
|
|
06-17-2011, 09:38 AM | #9 |
Junior Member
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! |
Thread Tools | Search this Thread |
|
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 |