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 10-19-2012, 02:35 PM   #1
calimero66
Major ignoramus member
calimero66 began at the beginning.
 
calimero66's Avatar
 
Posts: 3
Karma: 10
Join Date: Oct 2012
Location: Germany
Device: Bookeen Cybook Odyssey
'search & replace' - problem

Hello,

I want to replace 'no-break space' following </p> in an epub-document.
It is possible to search for \s</p> to find this passage in the text with the assistent (Calibre-> search& replace).
But it is not possible to replace \s</p> (the order will be ignored ).

By the way it is not possible to search for 'no-break space' alone (Search: \s) ...

How is it possible to replace them?

Please
calimero66 is offline   Reply With Quote
Old 10-20-2012, 04:57 PM   #2
Agama
Guru
Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.
 
Agama's Avatar
 
Posts: 667
Karma: 436517
Join Date: Jul 2010
Location: UK
Device: PRS-300 (R.I.P.), PW2, Nexus7
I'd like to help but I'm struggling to understand the issue that you are having, so maybe if you could clarify then you would get some responses.

In regex \s matches ANY whitespace type characters, but you mention 'no-break spaces'.

What do you mean by \s</p> cannot be replaced?

Could you give some examples of the problem and what you are trying to achieve? Maybe some snippets from your source would help.
Agama is offline   Reply With Quote
Old 10-21-2012, 10:06 AM   #3
calimero66
Major ignoramus member
calimero66 began at the beginning.
 
calimero66's Avatar
 
Posts: 3
Karma: 10
Join Date: Oct 2012
Location: Germany
Device: Bookeen Cybook Odyssey
Here is an example with an annoying line-break after "Ein Haufen":

At first the original (german) e-book:
Quote:
Ein Haufen

aus Knochen und verwesendem Fleisch
This is the view with SIGIL:
Quote:
Ein Haufen&nbsp;</p>

<p class="calibre5"></p>

<p class="calibre4">aus Knochen und verwesendem Fleisch
Now I want to delete the '&nbsp' with the following </p>.
In Calibre it is not a problem to find the text position:
Quote:
But if I use \s</p> as Search Regular Expression, it will be ignored (irrespective of the Replacement Text)

By the way, it is no problem to replace </p> or <p class ... without the &nbsp;
calimero66 is offline   Reply With Quote
Old 10-21-2012, 12:30 PM   #4
Agama
Guru
Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.
 
Agama's Avatar
 
Posts: 667
Karma: 436517
Join Date: Jul 2010
Location: UK
Device: PRS-300 (R.I.P.), PW2, Nexus7
It would not be valid xml to remove the &nbsp;</p> since you would leave an unclosed paragraph in your document. This would cause problems with some reading systems, (I've caused such problems before in Adobe Digital Editions by using similar, badly formed xml.)

The calibre generated code looks as though it should faithfully display the text as shown in your original, (which appears to have a line break), so, on this basis perhaps your source needs a bit of a tidy up if you want to achieve a different result on conversion.

What format is your original document in? (Plain text?).
Agama is offline   Reply With Quote
Old 10-23-2012, 05:43 AM   #5
calimero66
Major ignoramus member
calimero66 began at the beginning.
 
calimero66's Avatar
 
Posts: 3
Karma: 10
Join Date: Oct 2012
Location: Germany
Device: Bookeen Cybook Odyssey
I think the source document was an pdf - but I deleted it by mistake.
Thereby I have got only the epub document.

Is there any other way to eliminate this problem with calibre?
calimero66 is offline   Reply With Quote
Old 10-23-2012, 10:26 AM   #6
Agama
Guru
Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.
 
Agama's Avatar
 
Posts: 667
Karma: 436517
Join Date: Jul 2010
Location: UK
Device: PRS-300 (R.I.P.), PW2, Nexus7
You could use calibre's "Tweak Book" option available on the book's right-click menu, then do whatever you like to your book using your preferred text editor; or you could edit the ePub with Sigil.

I would suggest taking a backup of the book before any 'raw' editing, just in case things go wrong. I copy books to a separate calibre library, (Work In Progress), for just such purposes. When you're happy with the result you simply copy it back to your main library and delete from WIP. (Copy functions are also available on the right-click for a book.)

For more details on "Tweak Book" see the Calibre for Beginners Guide* at:

http://stu.wccnet.edu/~rprice/Eng218/CalibreHelp/

then go to: Other Fun Stuff > Editing an eBook with Tweak Books.


*Courtesy of calibre user and mobileread member BeccaPrice

Last edited by Agama; 10-23-2012 at 10:36 AM. Reason: Added * footnote
Agama 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
Search & Replace Problem mapline Calibre 3 08-04-2012 08:18 PM
A Search and Replace problem AJ Starr Library Management 2 10-21-2011 12:06 AM
Search and Replace Problem FrozenInferno Conversion 11 08-13-2011 02:29 PM
Search and Replace Problem FrozenInferno Calibre 0 08-05-2011 09:47 PM
Search and Replace problem naro_c Conversion 5 02-25-2011 01:59 AM


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


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