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 01-23-2012, 05:26 PM   #1
Sharlene
Member
Sharlene began at the beginning.
 
Posts: 20
Karma: 10
Join Date: Sep 2011
Device: none
regex search/replace

Hey guys,

I couldn't find an answer to my question in the forums, so I figured i'd ask directly.

I have an epub that i need to reformat.

A like like this:

<p>&ldquo;Sorry.&rdquo;</p>

Needs to be changed to this:

<p>
&ldquo;Sorry.&rdquo;
</p>

I have to change all of the instances of this in my document, but i'm not sure how to add a new line break.

I typed in find >& and replace it with >\n& but that clearly doesn't work.

Any and all help is appreciated. Cheers.
Sharlene is offline   Reply With Quote
Old 01-23-2012, 05:44 PM   #2
WS64
WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.WS64 ought to be getting tired of karma fortunes by now.
 
WS64's Avatar
 
Posts: 661
Karma: 506380
Join Date: Aug 2010
Location: Germany
Device: Kobo Aura / PB Lux 2 / Bookeen Frontlight / Kobo Mini / Nook Color
Sigil will convert whatever you try back to <p>&ldquo;Sorry.&rdquo;</p>
If you really want it that way you can't use Sigil.
WS64 is offline   Reply With Quote
Advert
Old 01-23-2012, 05:48 PM   #3
Sharlene
Member
Sharlene began at the beginning.
 
Posts: 20
Karma: 10
Join Date: Sep 2011
Device: none
Ok. Thanks.
Sharlene is offline   Reply With Quote
Old 01-23-2012, 06:25 PM   #4
theducks
Well trained by Cats
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: 30,442
Karma: 58055868
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by Sharlene View Post
Hey guys,

I couldn't find an answer to my question in the forums, so I figured i'd ask directly.

I have an epub that i need to reformat.

A like like this:

<p>&ldquo;Sorry.&rdquo;</p>

Needs to be changed to this:

<p>
&ldquo;Sorry.&rdquo;
</p>

I have to change all of the instances of this in my document, but i'm not sure how to add a new line break.

I typed in find >& and replace it with >\n& but that clearly doesn't work.

Any and all help is appreciated. Cheers.
There is no difference to the Rendering engine between the 2 versions.

If your intent was to add newlines to the ouput:
Code:
<p><br /> &ldquo;Sorry.&rdquo;<br /></p>
theducks is offline   Reply With Quote
Old 01-24-2012, 10:29 AM   #5
huebi
Zealot
huebi , Klaatu Barada Niktu!huebi , Klaatu Barada Niktu!huebi , Klaatu Barada Niktu!huebi , Klaatu Barada Niktu!huebi , Klaatu Barada Niktu!huebi , Klaatu Barada Niktu!huebi , Klaatu Barada Niktu!huebi , Klaatu Barada Niktu!huebi , Klaatu Barada Niktu!huebi , Klaatu Barada Niktu!huebi , Klaatu Barada Niktu!
 
Posts: 121
Karma: 5070
Join Date: Dec 2010
Device: none
Quote:
Originally Posted by Sharlene View Post
A like like this:

<p>&ldquo;Sorry.&rdquo;</p>

Needs to be changed to this:

<p>
&ldquo;Sorry.&rdquo;
</p>
Why? The Book renderer will show the same result.
huebi is offline   Reply With Quote
Advert
Old 01-27-2012, 11:43 AM   #6
Sharlene
Member
Sharlene began at the beginning.
 
Posts: 20
Karma: 10
Join Date: Sep 2011
Device: none
I know that the output will show the same, however, one of the companies that we are sending our books to says that one of our books didn't pass their system test.

please see below as to the wording that they sent to me (to me it doesn't make any sense, but i've got to fix the file and send it to them):

When content files in the epub contain a paragraph tag immediately
followed by the entity &ldquo; there will likely be an error with the
ACS server packaging. Example instance of this:

<p>&ldquo;Sorry.&rdquo;</p>

In many cases, simply following the paragraph tag with a newline will
avoid the problem:

<p>
&ldquo;Sorry.&rdquo;</p>

However, in other cases, both the beginning paragraph tag and the
ending paragraph tag must be on their own lines:

<p>
&ldquo;Sorry.&rdquo;
</p>

So the best practice for avoiding this problem is to always place
opening and closing paragraph tags on their own lines, in every
content document. For most developers, this is a simple find and
replace operation across all the content files. In cases where we have
these problems, the epub file will have to be edited in this way in
order to work with the ACS server and be successfully processed in our
system.
Sharlene is offline   Reply With Quote
Old 01-27-2012, 11:53 AM   #7
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 28,039
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
That's just an insane requirement.

I'm afraid you'll have to accomplish it with some other regex-capable editor. And know that Sigil will just change it back again if you ever edit the epub with Sigil in the future.

Last edited by DiapDealer; 01-27-2012 at 12:02 PM.
DiapDealer is offline   Reply With Quote
Old 01-27-2012, 12:01 PM   #8
st_albert
Guru
st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'
 
Posts: 697
Karma: 150000
Join Date: Feb 2010
Device: none
As others have noted, within Sigil, even if you make the changes your client suggests, Sigil will remove the extra linefeeds when you save the file and you'll be back where you started. I don't know how to turn off this behavior.

The hard way to get around this would be, after you are completely done with everything, outside of Sigil, unzip the epub and use some other text editor to make the suggested changes. Save and re-zip. Don't load into Sigil again.

But as kludge, you could avoid the occurrence of <p>&ldquo; by doing a global find & replace as follows (within Sigil):

find: <p>&ldquo;

replace: <p><span>&ldquo;</span>

or something to that effect.
st_albert is offline   Reply With Quote
Old 01-27-2012, 01:37 PM   #9
theducks
Well trained by Cats
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: 30,442
Karma: 58055868
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by DiapDealer View Post
That's just an insane requirement.

I'm afraid you'll have to accomplish it with some other regex-capable editor. And know that Sigil will just change it back again if you ever edit the epub with Sigil in the future.

nobody else write code like that. dump those dweebs
theducks is offline   Reply With Quote
Old 01-27-2012, 03:52 PM   #10
Timur
Connoisseur
Timur can name that ebook in five wordsTimur can name that ebook in five wordsTimur can name that ebook in five wordsTimur can name that ebook in five wordsTimur can name that ebook in five wordsTimur can name that ebook in five wordsTimur can name that ebook in five wordsTimur can name that ebook in five wordsTimur can name that ebook in five wordsTimur can name that ebook in five wordsTimur can name that ebook in five words
 
Posts: 54
Karma: 37363
Join Date: Aug 2011
Location: Istanbul
Device: EBW1150, Nook STR
If you can not dump them, you can use these patterns in any editor that supports regexps(e.g. Notepad++ in Windows, jEdit in Win/Mac/Linux). Just extract all files and folders from epub, open all the html/xhtml files in the editor, and use replace operation on all opened files:

Find:
Code:
^(\s*)(<p[^>]*>)(.*)</p>\s*$
Replace:
Code:
\1\2\n\1\3\n\1</p>
Timur is offline   Reply With Quote
Old 01-28-2012, 05:14 AM   #11
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
Posts: 11,494
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
Quote:
Originally Posted by theducks View Post

nobody else write code like that. dump those dweebs
Ducky:

Some moron is attempting to use Adobe Content Server (to encrypt the file) without knowing HOW it actually works--that's why she's getting those idiotic messages. I have lost track of the countless hours of nonsense crapola we used to experience (back when I started up) from total jackasses at "retail" eBook companies who tried to use ACS, and, not having paid the thousands of dollars to actually learn how to use it, kept getting ingestion errors and blaming the ePUBs.

I've now made it our company policy that if B&N or Amazon has an intake issue, we'll address it. I won't jump through hoops for Apple's insanely bizarre error messages (oh, no! you have a MOBI ISBN typed in your file! You've MENTIONED Amazon! You set a book on the AMAZON River! We'll take you out and shoot you!) or any small-world retailer that doesn't know how to use Content Server.

THAT is why she's getting this amazingly ridiculous error message. I mean, hello? You can't have an OPENING quote following an opening p tag? Moses on a Pony! And people wonder this biz has such a fast burn-through rate...

Hitch
Hitch 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/Regex help!! millertime13 Conversion 4 07-22-2011 03:40 AM
search and replace - drops blanks in replace ? cybmole Conversion 10 03-13-2011 04:07 AM
regex replace??? schuster Conversion 14 01-29-2011 10:02 AM
RegEx find and replace iblesq Sigil 1 01-10-2011 10:26 PM
need regex help search and replace schuster Calibre 4 01-10-2011 10:00 AM


All times are GMT -4. The time now is 10:12 AM.


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