Find and Replace, and apply formatting

This forum is for all Flare issues not related to any of the other categories.
Post Reply
jessemds
Propeller Head
Posts: 57
Joined: Mon Oct 06, 2008 1:19 pm

Find and Replace, and apply formatting

Post by jessemds »

Fellow madcappers,

Is there anyway to do a Find and Replace and to apply formatting to the words that it finds? For example, I want it to search for the word "Building" and then apply italics to every instance of the word. Preferably it should apply a style, but I will settle for local formatting..

Thanks

Jesse
RamonS
Senior Propellus Maximus
Posts: 4293
Joined: Thu Feb 02, 2006 9:29 am
Location: The Electric City

Re: Find and Replace, and apply formatting

Post by RamonS »

You can do a global find&replace in the source code. Search for "Building" and then have it replaced with the appropriate XHTML formatting tags around it.
KevinDAmery
Propellus Maximus
Posts: 1985
Joined: Tue Jan 23, 2007 8:18 am
Location: Darn, I knew I was around here somewhere...

Re: Find and Replace, and apply formatting

Post by KevinDAmery »

To add to RamonS's suggestion, here's an example syntax. Again, make sure that Find in Source Code is checked on.

Find:
Building

Replace:
<span class="foundstuff">Building</span>

(the foundstuff class is just an example - use whatever class makes sense given your stylesheet.)

This will add span tags around the found words with the specified class. Then you just need to create a span class or general class that adds the desired formatting and you're off to the races.
Until next time....
Image
Kevin Amery
Certified MAD for Flare
SteveS
Senior Propellus Maximus
Posts: 2090
Joined: Tue Mar 07, 2006 5:06 pm
Location: Adelaide, far side of the world ( 34°56'0.78\"S 138°46'44.28\"E).
Contact:

Re: Find and Replace, and apply formatting

Post by SteveS »

To add to Kevin's and RamonS's suggestions...

You could do a simple find and replace with <em>building</em> (or <i></i>) but creating a class will give you the flexibility to reformat all the occurences at a later date (if it ever becomes necessary).
Image
Steve
Life's too short for bad coffee, bad chocolate, and bad red wine.
royj
Propeller Head
Posts: 71
Joined: Mon Feb 13, 2006 1:19 pm
Location: Fargo, ND
Contact:

Re: Find and Replace, and apply formatting

Post by royj »

To add to Ramon's and Kevin's and Steve's excellent information...

Check first to see if any of the current instances of the word you want formatted like this already have formatting applied. You might end up with a span wrapped around another span.
Roy Jacobsen
Writing, Clear and Simple
Fargo, ND
royj@writingclearandsimple.com
http://rmjacobsen.squarespace.com
jessemds
Propeller Head
Posts: 57
Joined: Mon Oct 06, 2008 1:19 pm

Re: Find and Replace, and apply formatting

Post by jessemds »

[/quote]
royj wrote:To add to Ramon's and Kevin's and Steve's excellent information...

Check first to see if any of the current instances of the word you want formatted like this already have formatting applied. You might end up with a span wrapped around another span.
I thought of that. I know for a fact that some of the current instances have the formatting. I guess I am out of luck?
royj
Propeller Head
Posts: 71
Joined: Mon Feb 13, 2006 1:19 pm
Location: Fargo, ND
Contact:

Re: Find and Replace, and apply formatting

Post by royj »

jessemds wrote:
royj wrote:To add to Ramon's and Kevin's and Steve's excellent information...

Check first to see if any of the current instances of the word you want formatted like this already have formatting applied. You might end up with a span wrapped around another span.
I thought of that. I know for a fact that some of the current instances have the formatting. I guess I am out of luck?
Not necessarily. If all the current instances with formatting are consistent, then you can search for that string in the source, and replace it with the unformatted word. Then go the other way: search for the word and replace it with the formatted word.

For example:
1. If some of the instances of "Building" have the span class "foundstuff" applied, then search for "<span class="foundstuff">Building</span>" and replace with "Building". This clears the existing formatting that is applied to those instances.
2. Next, search for "Building" and replace with "<span class="foundstuff">Building</span>". Now, all instances of "Building" will have the span applied.
Roy Jacobsen
Writing, Clear and Simple
Fargo, ND
royj@writingclearandsimple.com
http://rmjacobsen.squarespace.com
wijnand
Propeller Head
Posts: 55
Joined: Fri Nov 03, 2006 1:22 am
Location: Netherlands
Contact:

Re: Find and Replace, and apply formatting

Post by wijnand »

I use the tool QuickSR You can give him all the HTML files in one go and tell him what to do when he finds the word so for example:

I have a building

Will become

I have a <i> Building</i>

Be aware though that a search and replace is very dangerous as you have no idea how the syntax is of where the word building is.
Post Reply