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 01-21-2012, 12:33 AM   #1
Y|yukichigai
Junior Member
Y|yukichigai ought to be getting tired of karma fortunes by now.Y|yukichigai ought to be getting tired of karma fortunes by now.Y|yukichigai ought to be getting tired of karma fortunes by now.Y|yukichigai ought to be getting tired of karma fortunes by now.Y|yukichigai ought to be getting tired of karma fortunes by now.Y|yukichigai ought to be getting tired of karma fortunes by now.Y|yukichigai ought to be getting tired of karma fortunes by now.Y|yukichigai ought to be getting tired of karma fortunes by now.Y|yukichigai ought to be getting tired of karma fortunes by now.Y|yukichigai ought to be getting tired of karma fortunes by now.Y|yukichigai ought to be getting tired of karma fortunes by now.
 
Posts: 5
Karma: 472332
Join Date: Jul 2010
Device: iPhone
Can't get rid of &nbsp "paragraphs" when converting

I'm having a rather frustrating problem converting a few HTML ebooks I have. I'm converting them to ePub, but this happens with almost any format I convert to.

The problem I'm having is that the converted ePub has triple-spacing between each paragraph. I checked the source HTML file and discovered the cause: each paragraph has an extra "spacing" paragraph containing only one non-breaking space (&nbsp). The spacing paragraphs are all identical:

Code:
<p style='margin:0mm;margin-bottom:.0001pt;text-indent:36.0pt'><span
style='font-size:14.0pt;font-family:"Calibri","sans-serif"'>&nbsp;</span></p>
I figured I could strip this out easily using Search and Replace, so I set up a quick regex to find the paragraphs in question. When tested it worked just as intended... at least in test:

Code:
<p .*>\s*</span></p>
Unfortunately, that didn't work. For whatever reason the rule doesn't trigger during conversion at all, and yes I've tried with something other than a blank space in the Replacement Text field. I've tried replacing \s* with &nbsp; to no effect. I've even tried copying the entire paragraph code into the Search field: no luck. I'm at a loss here. Any ideas?

Oh, and using the "remove spacing between paragraphs" option does nothing, before someone suggests it.
Y|yukichigai is offline   Reply With Quote
Old 01-21-2012, 06:34 PM   #2
user_none
Sigil & calibre developer
user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.
 
user_none's Avatar
 
Posts: 2,460
Karma: 986493
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
Most likely the &nbsp; is being converted to the Unicode character it represents. \s will not match this. Try copying and pasting the character from the book viewer into the regex.
user_none is offline   Reply With Quote
 
Enthusiast
Old 01-21-2012, 10:15 PM   #3
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 26,125
Karma: 5381911
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Do not look at the source html, that is not what the search and replace rules run on, use the wizard in calibre to look at the actual html that the rules run on.
kovidgoyal is offline   Reply With Quote
Old 01-23-2012, 11:20 PM   #4
Y|yukichigai
Junior Member
Y|yukichigai ought to be getting tired of karma fortunes by now.Y|yukichigai ought to be getting tired of karma fortunes by now.Y|yukichigai ought to be getting tired of karma fortunes by now.Y|yukichigai ought to be getting tired of karma fortunes by now.Y|yukichigai ought to be getting tired of karma fortunes by now.Y|yukichigai ought to be getting tired of karma fortunes by now.Y|yukichigai ought to be getting tired of karma fortunes by now.Y|yukichigai ought to be getting tired of karma fortunes by now.Y|yukichigai ought to be getting tired of karma fortunes by now.Y|yukichigai ought to be getting tired of karma fortunes by now.Y|yukichigai ought to be getting tired of karma fortunes by now.
 
Posts: 5
Karma: 472332
Join Date: Jul 2010
Device: iPhone
Quote:
Originally Posted by kovidgoyal View Post
Do not look at the source html, that is not what the search and replace rules run on, use the wizard in calibre to look at the actual html that the rules run on.
I have. Like I said, when I test my regex the wizard finds all of the &nbsp; paragraphs just fine, but on conversion it misses every last one. This is true even if I use the unicode version of the non-breaking space (i.e. cut-paste from character viewer).
Y|yukichigai 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
Use Calibre to get rid of "real" page information lunixer Calibre 2 08-29-2011 07:07 PM
Feature Request: configurable space setting for "Insert blank line" in "Look & Feel" therealjoeblow Calibre 15 07-25-2011 03:14 PM
How to get rid of the "Why not start with your first post today ... " reminder? (n/t) Marshal Kilgore Introduce Yourself 11 07-24-2009 02:28 PM
Question - Does iLiab have the "search" & "annotation, highlighting" features? HiSoC8Y iRex 5 07-01-2009 04:37 PM
Mobiperl &nbsp; lost when converting to mobi Jellby Kindle Formats 19 08-26-2008 03:10 PM


All times are GMT -4. The time now is 09:54 PM.


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