Find and replacing style classes in a topic or project?

This forum is for all Flare issues related to styles, stylesheets and XML.
Post Reply
jcoria
Propeller Head
Posts: 83
Joined: Mon Oct 22, 2007 12:57 pm

Find and replacing style classes in a topic or project?

Post by jcoria »

I have a situation where I have learned to create a div class that makes a change for encapsualting text with a border and has an inline title. "Thanks Dave Lee :lol: " I have been accomplishing the task with using a paragraph class to get close to the desired effect. Now that I am able to create exactly what I want visually, is there a way to search out all of uses of the old paragraph class and replace them with the div class within the stylesheet?

Thank you .

JCoria
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 replacing style classes in a topic or project?

Post by KevinDAmery »

It's relatively easy to find the class, but replacing the <p> with a <div> is tougher because of the closing tag (the closing </p> will never have the class statement in it, so changing them to </div> without affecting <p> tags that aren't of the class in question would be tough). There might be some trick using regular expressions that would do it, but I couldn't begin to suggest how.

However, to find it is pretty easy, so if you don't mind having Flare find the class and then manually updating the topic the process is straightforward.

- In your find and replace window, set the Find What to class="MyClass" (replace MyClass with the name of the class you've been using)
- Set the Find In to (Whole Project)
- Turn on Find in Source Code
- Click Start
- When it finds a topic, open the topic in the XML editor and manually change the content as required, remembering to save the topic when you're done
- Click Start in the Find and Replace window again. Rinse and repeat

HTH - and if someone knows how to write a regular expression to automate the whole thing, then cool!
Until next time....
Image
Kevin Amery
Certified MAD for Flare
jcoria
Propeller Head
Posts: 83
Joined: Mon Oct 22, 2007 12:57 pm

Re: Find and replacing style classes in a topic or project?

Post by jcoria »

Thanks Kevin,

I was hoping for that automated thing :) Maybe a good enhancement tool for new Flare version? Nothing saves time like using the CSS, and if there is a robust toolset with it, makes it even more convenient.

JC
Post Reply