![]() |
#1 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 383
Karma: 65460
Join Date: Jun 2011
Device: Kindle
|
Help! How do I remove unwanted paragraph breaks?
I have an epub file where at the end of each line, there is a carriage return. Obviously, this makes reflow a gigantic mess. Now, I could go through and delete every single carriage return manually in an .rtf, but what I'd really like to be able to do is remove the unwanted carriage returns as batch via an HTML editor (ie Sigil). Unfortunately, I can't figure out how to do it.
Here's are two sample paragraphs of what I have: Spoiler:
Anyone have any advice? |
![]() |
![]() |
![]() |
#2 |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 416
Karma: 1045911
Join Date: Sep 2011
Location: Cape Town, South Africa
Device: Kindle 3
|
This should do what you want. It is very specific to your example. If it butchers other formatting, well provide more sample text, but this is the easiest way to do it:
Code:
Find: </span></p>\s+<p[^<>]*><span[^<>]*> Replace : // a space character, i.e hit spacebar once Last edited by Serpentine; 11-13-2011 at 08:36 PM. |
![]() |
![]() |
Advert | |
|
![]() |
#3 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,895
Karma: 464403178
Join Date: Feb 2010
Location: 33.9388° N, 117.2716° W
Device: Kindles K-2, K-KB, PW 1 & 2, Voyage, Fire 2, 5 & HD 8, Surface 3, iPad
|
![]() Quote:
![]() |
|
![]() |
![]() |
![]() |
#4 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 383
Karma: 65460
Join Date: Jun 2011
Device: Kindle
|
You're awesome. I'm not even going to guess at how many hours you've saved me (or how many of my precious few remaining threads of sanity)
At the risk of trying your patience, could either of you please break down for me what that expression meant? specifically, this part "\s+". I've tried several times to get a working understanding of regex and come up woefully short. |
![]() |
![]() |
![]() |
#5 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,903
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
Read the REGEX tutorial by Manichean in the Calibre forum. I had avoided REGEX pain for years. He made it clear and (mostly) simple. |
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 383
Karma: 65460
Join Date: Jun 2011
Device: Kindle
|
Thanks to all!
|
![]() |
![]() |
![]() |
#7 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
|
As an FYI this logic is built into Calibre's Heuristics functions, with a number of expansions and safeguards to prevent false positives. Just do an ePub->ePub conversion with Heuristics' 'Unwrap lines' enabled.
|
![]() |
![]() |
![]() |
#8 | |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 117
Karma: 38608
Join Date: May 2012
Location: Vignola, Modena, Italy
Device: iPad
|
![]() Quote:
Thank you. – cordialmente, [Promotion deleted - MODERATOR] Last edited by Dr. Drib; 01-07-2014 at 11:06 AM. |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Continuous text with no paragraph breaks | midlifec | Calibre | 1 | 12-26-2010 04:09 PM |
Paragraph breaks in ePub? | rocalisa | Calibre | 3 | 10-29-2010 03:53 PM |
Calibre making unwanted chapter breaks | PatNY | Calibre | 6 | 10-08-2010 09:58 PM |
Paragraph breaks | thedevilsjester | Calibre | 2 | 09-07-2010 12:26 PM |
utility to eliminate unwanted line breaks in txt | profnachos | Workshop | 11 | 11-27-2007 06:24 PM |