Can I change a p with a class to a h?

This forum is for all Flare issues related to styles, stylesheets and XML.
Post Reply
ChoccieMuffin
Senior Propellus Maximus
Posts: 2634
Joined: Wed Apr 14, 2010 8:01 am
Location: Surrey, UK

Can I change a p with a class to a h?

Post by ChoccieMuffin »

I have some legacy stuff I'd like to tidy up, that for some reason has what ought to be headings (a very low heading like h6) but they've been formatted as a p with a class.

Is there any moderately painless way to do a global change from paragraphs with p.pHeading8 to h6?

I fear the answer is going to be a distinctive NO, but there's no harm in asking... (Please can someone say there's a YES answer possible...)

Thanks, with crossed fingers

CM
Started as a newbie with Flare 6.1, now using Flare 2023.
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
kwag_myers
Propellus Maximus
Posts: 810
Joined: Wed Jul 25, 2012 11:36 am
Location: Ann Arbor, MI

Re: Can I change a p with a class to a h?

Post by kwag_myers »

If the paragraph has a specific class, you can use the Find and Replace feature on the Home tab:

1. Open a topic containing the paragraph style in the Text Editor.
2. Copy the paragraph tag and paste into the Find what text field. Example: <p.pHeading8>
3. Type <h6> in the Replace with text box.
4. In the Options section, set the Find in menu to (whole project) and click the Find in source code check box.
5. (this next part is from memory, and it's Monday morning, so...) Click Replace All for the open topic, then Start to open the remaining topics which contain the syntax.

I can't remember if you have to click Replace All for each topic, but Flare looks for and opens each topic containing the syntax.
"I'm tryin' to think, but nothin' happens!" - Curly Joe Howard
NorthEast
Master Propellus Maximus
Posts: 6375
Joined: Mon Mar 05, 2007 8:33 am

Re: Can I change a p with a class to a h?

Post by NorthEast »

Don't try that at home!

It's not as simple as just replacing <p class="pHeading8"> with <h6>.

If you just do that, your topics will have invalid code, since you also need to change the corresponding closing tag </p> to </h6>.
And unfortunately, you can't just do a simple replace all for the </p> tags (unless you want a bigger mess).

Myself, I use FAR HTML for jobs like this, which I find relatively painless.

Although Flare does support regular expressions, I'm not sure they could be used in this scenario. From discussions on these forums, I understand that they can be only used for find and not replace (e.g. so you can't use back-references).
SteveS
Senior Propellus Maximus
Posts: 2089
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: Can I change a p with a class to a h?

Post by SteveS »

You could set the heading level for the style to heading level 6.

It won't tidy up the code, but if you're trying to get it to behave as a heading could save a bit of work.
Image
Steve
Life's too short for bad coffee, bad chocolate, and bad red wine.
ChoccieMuffin
Senior Propellus Maximus
Posts: 2634
Joined: Wed Apr 14, 2010 8:01 am
Location: Surrey, UK

Re: Can I change a p with a class to a h?

Post by ChoccieMuffin »

Cheers Dave, that's exactly why I asked the question as I knew already that Kwag's suggestion would break stuff.

Now to investigate FAR...
Started as a newbie with Flare 6.1, now using Flare 2023.
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
NorthEast
Master Propellus Maximus
Posts: 6375
Joined: Mon Mar 05, 2007 8:33 am

Re: Can I change a p with a class to a h?

Post by NorthEast »

ChoccieMuffin wrote:Now to investigate FAR...
You can find FAR here: http://www.helpwaregroup.com/products/far

It's not free, but I'm fairly sure the download has a long-ish trial period.

I find it quite easy - your example above would take about 2 minutes to set up.
Nita Beck
Senior Propellus Maximus
Posts: 3672
Joined: Thu Feb 02, 2006 9:57 am
Location: Pittsford, NY

Re: Can I change a p with a class to a h?

Post by Nita Beck »

I second (or is it third) the nomination of FAR HTML. Another particularly useful feature is that one can save find-and-replace strings in a file. Say I import a project from RoboHelp. I can do a lot of the clean up using FAR, and save the strings in a file. Then, many months later, perhaps I import another project from RoboHelp. I can clean that project up even faster because I can re-use the strings in the saved files. FAR is SUCH a timesaver.

If you do use FAR, two pieces of advice:
-- Make a backup of your Flare project, as you can do serious damage to it. I tend to make multiple backups as I go.
-- Work in FAR only when the Flare project is closed. Flare will complain mightily if you're messing with its files while the project is open.
Nita
Image
RETIRED, but still fond of all the Flare friends I've made. See you around now and then!
ChoccieMuffin
Senior Propellus Maximus
Posts: 2634
Joined: Wed Apr 14, 2010 8:01 am
Location: Surrey, UK

Re: Can I change a p with a class to a h?

Post by ChoccieMuffin »

Yup, good program, and used it today. Wouldn't it be nice if Flare's find and replace could do just a tenth of what FAR's can.
Started as a newbie with Flare 6.1, now using Flare 2023.
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
Thomas Tregner
Propeller Head
Posts: 56
Joined: Mon Apr 05, 2010 6:51 pm
Location: Charleston
Contact:

Re: Can I change a p with a class to a h?

Post by Thomas Tregner »

Would a plug-in to change element tags be useful?
Nita Beck
Senior Propellus Maximus
Posts: 3672
Joined: Thu Feb 02, 2006 9:57 am
Location: Pittsford, NY

Re: Can I change a p with a class to a h?

Post by Nita Beck »

Thomas, speaking only for myself, such a plug-in would be golden!
Nita
Image
RETIRED, but still fond of all the Flare friends I've made. See you around now and then!
SteveS
Senior Propellus Maximus
Posts: 2089
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: Can I change a p with a class to a h?

Post by SteveS »

Given the number of topics rerlating to find and replace I am sure there are a swag of people who would find such a plugin invaluable :!:
Image
Steve
Life's too short for bad coffee, bad chocolate, and bad red wine.
Post Reply