View Single Post
Old 06-18-2011, 04:06 PM   #2
crutledge
eBook FANatic
crutledge ought to be getting tired of karma fortunes by now.crutledge ought to be getting tired of karma fortunes by now.crutledge ought to be getting tired of karma fortunes by now.crutledge ought to be getting tired of karma fortunes by now.crutledge ought to be getting tired of karma fortunes by now.crutledge ought to be getting tired of karma fortunes by now.crutledge ought to be getting tired of karma fortunes by now.crutledge ought to be getting tired of karma fortunes by now.crutledge ought to be getting tired of karma fortunes by now.crutledge ought to be getting tired of karma fortunes by now.crutledge ought to be getting tired of karma fortunes by now.
 
crutledge's Avatar
 
Posts: 18,301
Karma: 16071131
Join Date: Apr 2008
Location: Alabama, USA
Device: HP ipac RX5915 Wife's Kindle
Quote:
Originally Posted by DaleDe View Post
I was cleaning up a book that started out as nearly pure text and was taking advantage of tidy.

Here is some of my experiences: I found a way to identify some text so that I could change an entire book with find and replace:

I made a span around some leading text and tidy make the /span at the end of the paragraph. I made a /span where I really needed it and tidy removed the one it built. Note that the first time I tried to put the /span in first but tidy removed it. the order is important.

Later I need to change certain paragraphs (chapters) to h3 so they would go in the TOC. I searched and replaced <p>Chapter ... with <h3>Chapter ... and expected tidy to fix the /h3 which it did. However, in a retro work around design dating back to html version 3 before css it also decided to add spacing so my file now looks like:



<h3>Chapter text<br />
<br /></h3>

Stupid tidy, a bug that needs fixing. However, now I have all these extra breaks. I am no expert on using regular expressions and this one has to cross a CR/LF sequence on my PC. How can a code the find to find and select both breaks?

Dale
I may be off base, but the following should work (it works in epp )

Find:
Code:
<h3>([^~]+?)<br />
<br /></h3>
Replace:
Code:
<h3>\1></h3>

Last edited by crutledge; 06-18-2011 at 04:15 PM.
crutledge is offline   Reply With Quote