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

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 11-13-2011, 07:40 PM   #1
ElMiko
Addict
ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.
 
ElMiko's Avatar
 
Posts: 297
Karma: 56788
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:

<p class="calibre1"><span class="calibre2 calibre3">She who had been Florence Flannery noted with a careless eye the stains</span></p>

<p class="calibre1"><span class="calibre2 calibre3">of wet on the dusty stairs, and with a glance ill used to observance of</span></p>

<p class="calibre1"><span class="calibre2 calibre3">domesticities looked up for damp or dripping ceilings. The dim-walled</span></p>

<p class="calibre1"><span class="calibre2 calibre3">staircase revealed nothing but more dust, yet this would serve as a peg</span></p>

<p class="calibre1"><span class="calibre2 calibre3">for ill-humor to hang on, so Florence pouted. "An ill, muddy place,"</span></p>

<p class="calibre1"><span class="calibre2 calibre3">said she, who loved gilding and gimcracks and mirrors reflecting velvet</span></p>

<p class="calibre1"><span class="calibre2 calibre3">chairs, and flounced away to the upper chamber, lifting frilled skirts</span></p>

<p class="calibre1"><span class="calibre2 calibre3">contemptuously high. Her husband followed; they had been married a week</span></p>

<p class="calibre1"><span class="calibre2 calibre3">and there had never been any happiness in their wilful passion. Daniel</span></p>

<p class="calibre1"><span class="calibre2 calibre3">Shute did not now look for any; in the disgust of this draggled</span></p>

<p class="calibre1"><span class="calibre2 calibre3">homecoming he wondered what had induced him to marry the woman and how</span></p>

<p class="calibre1"><span class="calibre2 calibre3">soon he would come to hate her.</span></p>

<p class="calibre1"><br class="calibre4" /></p>

<p class="calibre1"><span class="calibre2 calibre3">As she stood in the big bedroom he watched her with dislike; her tawdry</span></p>

<p class="calibre1"><span class="calibre2 calibre3">charms of vulgar prettiness had once been delightful to his dazed senses</span></p>

<p class="calibre1"><span class="calibre2 calibre3">and muddled wits, but here, in his old home, washed by the fine Devon</span></p>

<p class="calibre1"><span class="calibre2 calibre3">air, his sight was clearer and she appeared coarse as a poppy at the far</span></p>

<p class="calibre1"><span class="calibre2 calibre3">end of August.</span></p>


Anyone have any advice?
ElMiko is offline   Reply With Quote
Old 11-13-2011, 08:26 PM   #2
Serpentine
Evangelist
Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.
 
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.
Serpentine is offline   Reply With Quote
Old 11-13-2011, 08:35 PM   #3
alansplace
Wizard
alansplace ought to be getting tired of karma fortunes by now.alansplace ought to be getting tired of karma fortunes by now.alansplace ought to be getting tired of karma fortunes by now.alansplace ought to be getting tired of karma fortunes by now.alansplace ought to be getting tired of karma fortunes by now.alansplace ought to be getting tired of karma fortunes by now.alansplace ought to be getting tired of karma fortunes by now.alansplace ought to be getting tired of karma fortunes by now.alansplace ought to be getting tired of karma fortunes by now.alansplace ought to be getting tired of karma fortunes by now.alansplace ought to be getting tired of karma fortunes by now.
 
alansplace's Avatar
 
Posts: 3,572
Karma: 17589982
Join Date: Feb 2010
Location: USA, 33.938556° N, -117.271334° W
Device: Kindle 2, Kindle KB, Kindle PW 1 & 2, Kindle Fire 2nd Gen
Cool yup

Quote:
Originally Posted by Serpentine View Post
I don't have Sigil on this box, so I haven't tested that this will work with the regex engine used by the current version. However this should do what you want (It is specific to your example - you could make the tags conditional to be more accepting)

Code:
Find: </span></p>\s+<p[^<>]*><span[^<>]*>
Replace : // a space character, i.e hit spacebar
yep, works fine with ElMikos sample
alansplace is offline   Reply With Quote
Old 11-13-2011, 09:16 PM   #4
ElMiko
Addict
ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.
 
ElMiko's Avatar
 
Posts: 297
Karma: 56788
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.
ElMiko is offline   Reply With Quote
Old 11-13-2011, 09:23 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,096
Karma: 5468860
Join Date: Aug 2009
Location: The (original) Silicon Valley, USA
Device: Galaxy Tab 2, Astak Pocket Pro, K4NT
Quote:
Originally Posted by ElMiko View Post
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.
one or more 'whitespace' characters. space (all flavors),tab,CRLF

Read the REGEX tutorial by Manichean in the Calibre forum.
I had avoided REGEX pain for years. He made it clear and (mostly) simple.
theducks is offline   Reply With Quote
Old 11-13-2011, 09:46 PM   #6
ElMiko
Addict
ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.
 
ElMiko's Avatar
 
Posts: 297
Karma: 56788
Join Date: Jun 2011
Device: Kindle
Thanks to all!
ElMiko is offline   Reply With Quote
Old 11-14-2011, 12:59 AM   #7
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
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.
ldolse is offline   Reply With Quote
Old 03-27-2013, 11:43 AM   #8
tsolignani
Connoisseur
tsolignani knows the difference between 'who' and 'whom'tsolignani knows the difference between 'who' and 'whom'tsolignani knows the difference between 'who' and 'whom'tsolignani knows the difference between 'who' and 'whom'tsolignani knows the difference between 'who' and 'whom'tsolignani knows the difference between 'who' and 'whom'tsolignani knows the difference between 'who' and 'whom'tsolignani knows the difference between 'who' and 'whom'tsolignani knows the difference between 'who' and 'whom'tsolignani knows the difference between 'who' and 'whom'tsolignani knows the difference between 'who' and 'whom'
 
tsolignani's Avatar
 
Posts: 76
Karma: 10290
Join Date: May 2012
Location: Vignola, Modena, Italy
Device: iPad
Smile

Quote:
Originally Posted by ldolse View Post
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.
Wonderful! That did the trick for me!

Thank you.


–
cordialmente,
[Promotion deleted - MODERATOR]

Last edited by Dr. Drib; 01-07-2014 at 11:06 AM.
tsolignani 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
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


All times are GMT -4. The time now is 07:37 AM.


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