Swap Style Tag From H2 to P

This forum is for all Flare issues related to styles, stylesheets and XML.
Post Reply
mechartrand
Propeller Head
Posts: 15
Joined: Thu Jul 12, 2012 7:08 pm

Swap Style Tag From H2 to P

Post by mechartrand »

Hi!

I have done a mistake when creating my stylesheet.
We have set a tag as H2 for something that as to be a P tag.
Now the H2 style has been assigned in over 2000 topics.
Is there a way I can swap the H2 style or change H2 style to be a P style?

Thanks !

Marie-Eve
i-tietz
Propellus Maximus
Posts: 1219
Joined: Wed Oct 24, 2007 4:13 am
Location: Fürth, Germany

Re: Swap Style Tag From H2 to P

Post by i-tietz »

You have something like this <h2 class="dummy"> in the source code of your topics and you want to change it to <p class="dummy">?
You will need to develop a regular expression for a projectwide Find & Replace ... what Flare version do you use?

Why regular expressions? Because the following algorithm changes the starts of the tags only, e.g.:
You change <h2 class="dummy">Heading here</h2> into <p class="dummy">Heading here</h2> by:
1. CTRL + f
2. Find what: <h2 class="dummy">
3. Replace with: <p class="dummy">
4. Find in: Whole project
5. Find in source code
6. Start
7. Replace in all files

BUT: You need to change the closing tag too!! Otherwise Flare won't let you save those topics.

You enter the strings with regular expressions in steps 2 and 3 and set Use to 'Regular Expressions'. Some RegEx experts here will be able to give you the strings you need.
Inge____________________________
"I need input! - Have you got input?"
nickatwork
Sr. Propeller Head
Posts: 457
Joined: Thu Sep 16, 2010 6:31 am
Location: London

Re: Swap Style Tag From H2 to P

Post by nickatwork »

To find that </h2> tag the following should work.

Find: (?<=<p class="dummy">.+)</h2>
Replace: </p>

Just make sure you back your project up first incase it all goes wrong. Start the find/replace and check the first few topics to make sure its working as expected, then just do replace all.
GinnyR
Propeller Head
Posts: 24
Joined: Mon Apr 27, 2009 5:07 pm

Re: Swap Style Tag From H2 to P

Post by GinnyR »

Tools like FAR HTML make jobs like this much easier. You can run a global search and replace and update both the start and end tags in one step.
mechartrand
Propeller Head
Posts: 15
Joined: Thu Jul 12, 2012 7:08 pm

Re: Swap Style Tag From H2 to P

Post by mechartrand »

I love you guys! It works!
Thank you everyone for your answers.

The regular expression worked like a charm. :)
You avoided me 898 manual operations :P

You saved our lives here :)
Post Reply