Easy way to remove span class?
-
straygoat
- Sr. Propeller Head
- Posts: 153
- Joined: Wed Apr 04, 2012 3:39 am
- Location: The Midlands, UK.
- Contact:
Easy way to remove span class?
Hello everyone,
I'm sure this is a really dumb-ass question, but I don't normally use <span>...
Today, I was asked to add some styles that can be used to indicate new content that needs to be reviewed. All that was needed was some background colour behind the text, so I created 3 different span classes (Review1, Review2, and Review3, each with a different background colour). It works fine, but the authors want to be able to remove the background colour at a later date...and they don't want to go into the text editor at all if possible. Is there a way to remove a span class from the XML editor?
I'm sure this is a really dumb-ass question, but I don't normally use <span>...
Today, I was asked to add some styles that can be used to indicate new content that needs to be reviewed. All that was needed was some background colour behind the text, so I created 3 different span classes (Review1, Review2, and Review3, each with a different background colour). It works fine, but the authors want to be able to remove the background colour at a later date...and they don't want to go into the text editor at all if possible. Is there a way to remove a span class from the XML editor?
Craig Wright
Freelance Technical Author and SEO Copywriter
Midlands, UK
http://www.straygoat-technicalauthor.co.uk
Freelance Technical Author and SEO Copywriter
Midlands, UK
http://www.straygoat-technicalauthor.co.uk
Re: Easy way to remove span class?
Depends on if you mean remove them all at once or just a few of them. If it's just a few of them, then the only option is to open the topic(s) in the Internal Text Editor and unbind the span tag from the text. Unless the topics are all in the same folder, in which case I believe you can follow the step below, but set it to find-and-replace in a the same folder instead of the whole project.
If it's to remove all of them in a project, then you can do a find-and-replace with regular expressions (if you know how to do that) to strip out span tags with that class from all the topics in the project while leaving the text between the tags behind.
If it's to remove all of them in a project, then you can do a find-and-replace with regular expressions (if you know how to do that) to strip out span tags with that class from all the topics in the project while leaving the text between the tags behind.
Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
-
straygoat
- Sr. Propeller Head
- Posts: 153
- Joined: Wed Apr 04, 2012 3:39 am
- Location: The Midlands, UK.
- Contact:
Re: Easy way to remove span class?
Thanks Lisa,
The project I am working on at the moment is pretty big, so I'm loathe to do anything that finds and replaces across the whole project. Internal Text Editor it will have to be!
The project I am working on at the moment is pretty big, so I'm loathe to do anything that finds and replaces across the whole project. Internal Text Editor it will have to be!
Craig Wright
Freelance Technical Author and SEO Copywriter
Midlands, UK
http://www.straygoat-technicalauthor.co.uk
Freelance Technical Author and SEO Copywriter
Midlands, UK
http://www.straygoat-technicalauthor.co.uk
-
Craig.Prichard
- Propeller Head
- Posts: 62
- Joined: Sat Dec 10, 2005 8:06 pm
- Location: Calgary, AB Canada
Re: Easy way to remove span class?
Why not revise the CSS and change the background-color for these classes? No HTML editing is required.
Elaboration of simple suggestion: in your CSS create a new media, e.g. colorless, set the background-color for those classes for that media, and apply whichever media is appropriate to the target.
Elaboration of elaborated suggestion: Create a target that uses the colored-background media and an identical target that uses the colorless-background media.
Elaboration of simple suggestion: in your CSS create a new media, e.g. colorless, set the background-color for those classes for that media, and apply whichever media is appropriate to the target.
Elaboration of elaborated suggestion: Create a target that uses the colored-background media and an identical target that uses the colorless-background media.
Craig Prichard
craig.prichard@gmail.com
craig.prichard@gmail.com
-
straygoat
- Sr. Propeller Head
- Posts: 153
- Joined: Wed Apr 04, 2012 3:39 am
- Location: The Midlands, UK.
- Contact:
Re: Easy way to remove span class?
I'm not sure what you mean by 'media'. Creating a css style with the different background colour doesn't work because there is a need to apply the style to a single word within a paragraph. The authors need the developers to review new/altered content only, and sometimes this might just be a couple of changed words in a paragraph rather than an entirely new section.
Craig Wright
Freelance Technical Author and SEO Copywriter
Midlands, UK
http://www.straygoat-technicalauthor.co.uk
Freelance Technical Author and SEO Copywriter
Midlands, UK
http://www.straygoat-technicalauthor.co.uk
-
straygoat
- Sr. Propeller Head
- Posts: 153
- Joined: Wed Apr 04, 2012 3:39 am
- Location: The Midlands, UK.
- Contact:
Re: Easy way to remove span class?
Wouldn't the easiest way be to just use the inline text colour button in Flare?
Craig Wright
Freelance Technical Author and SEO Copywriter
Midlands, UK
http://www.straygoat-technicalauthor.co.uk
Freelance Technical Author and SEO Copywriter
Midlands, UK
http://www.straygoat-technicalauthor.co.uk
-
kwag_myers
- Propellus Maximus
- Posts: 810
- Joined: Wed Jul 25, 2012 11:36 am
- Location: Ann Arbor, MI
Re: Easy way to remove span class?
How would you do that? If you doLTinker68 wrote:... you can do a find-and-replace with regular expressions (if you know how to do that) to strip out span tags with that class from all the topics in the project while leaving the text between the tags behind.
Code: Select all
<span class"Review1">*</span>Code: Select all
<span class"Review1">Unless I'm mistaken (which is a real possibility), the only way I can see to remove the syntax is to search for the Review classes
Code: Select all
<span class"ReviewCode: Select all
<span class"Review*">"I'm tryin' to think, but nothin' happens!" - Curly Joe Howard
Re: Easy way to remove span class?
Yes, because that looks like it's the wildcard option, not a regular expression. A regular expression, if properly composed, would leave the text between the tags in place. However, and this is a big however, I forgot that Flare can find using regular expression, but it can't replace using regular expressions. Unless that changed in v8, and I don't remember anyone excitedly reporting that, so it probably hasn't changed. So you'd have to use a third-party tool (a lot of people like FarHTML, I think it's called) to do the find-and-replace.kwag_myers wrote:How would you do that? If you dowon't you lose your bound text?Code: Select all
<span class"Review1">*</span>
That will remove the color for generating the output, sure, but it doesn't remove the tags. So say they remove the colors and release the output as "rev A". Then later they go back to make changes for another rev, and re-add the background color. All the items from rev A are now back to being colored, but you've already implemented those changes, so you don't want them. You'd still have to go in and remove all those tags from rev A so you can start marking the items that are appropriate to rev B. Unless you use a new class and background color for rev B, but if you continue doing that, you're going to have a lot of tags in the project that are useless and your topic code will keep getting more and more cluttered over the years.Craig.Prichard wrote:Why not revise the CSS and change the background-color for these classes? No HTML editing is required.
Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
-
straygoat
- Sr. Propeller Head
- Posts: 153
- Joined: Wed Apr 04, 2012 3:39 am
- Location: The Midlands, UK.
- Contact:
Re: Easy way to remove span class?
In the end, it was decided to try and rely on the track changes feature. We are going to have a policy of saving a backup of every package received from the developers so there is an audit trail of changes. Whether this will work is anyone's guess.
The other proposed option is to generate the changed content as a PDF, have that reviewed with comments etc., then apply those comments in Flare with Track Changes on. Then all the developer has to do is accept the track changes. Personally, I don't like this proposed solution as I'm not a fan of PDFs at all and it just seems a lot of extra, unnecessary outputting. But I'm a contractor, so I will be overruled!
Thanks everyone.
The other proposed option is to generate the changed content as a PDF, have that reviewed with comments etc., then apply those comments in Flare with Track Changes on. Then all the developer has to do is accept the track changes. Personally, I don't like this proposed solution as I'm not a fan of PDFs at all and it just seems a lot of extra, unnecessary outputting. But I'm a contractor, so I will be overruled!
Thanks everyone.
Craig Wright
Freelance Technical Author and SEO Copywriter
Midlands, UK
http://www.straygoat-technicalauthor.co.uk
Freelance Technical Author and SEO Copywriter
Midlands, UK
http://www.straygoat-technicalauthor.co.uk
-
nickatwork
- Sr. Propeller Head
- Posts: 457
- Joined: Thu Sep 16, 2010 6:31 am
- Location: London
Re: Easy way to remove span class?
Using regular expressions for this is pretty straight forward. In fact you only need to use one regular expression and just a normal find/replace.
First find the </span> tag, as it's easier to find this while the span="Review" code is still in there - this would require a regular expression.
(?<=<span class="Review">.+)</span>
Then just a normal find/replace on the span="Review" code and you're done.
First find the </span> tag, as it's easier to find this while the span="Review" code is still in there - this would require a regular expression.
(?<=<span class="Review">.+)</span>
Then just a normal find/replace on the span="Review" code and you're done.
-
straygoat
- Sr. Propeller Head
- Posts: 153
- Joined: Wed Apr 04, 2012 3:39 am
- Location: The Midlands, UK.
- Contact:
Re: Easy way to remove span class?
Can you elaborate on that last answer please? I don't follow where I am supposed to enter the expression. Could you explain the syntax of that expression too? (Or is it in the MC Flare help somewhere?).
Craig Wright
Freelance Technical Author and SEO Copywriter
Midlands, UK
http://www.straygoat-technicalauthor.co.uk
Freelance Technical Author and SEO Copywriter
Midlands, UK
http://www.straygoat-technicalauthor.co.uk
-
nickatwork
- Sr. Propeller Head
- Posts: 457
- Joined: Thu Sep 16, 2010 6:31 am
- Location: London
Re: Easy way to remove span class?
See the screenshot. But basically.
1. Put the code in the Find what field.
2. Leave Replace with blank so it effectively deletes the code (replaces it with no text)
3. Set your Find in option. Maybe a topic by topic, or topics in same folder, or whole project.
4. Change this drop-down from Wild Card to Regular Expressions
5. Hit Start
6. After you hit start you'll have to option to Replace in All Files - this will replace all instances across all topics (based on what you selected in the Find in box [step 3]) or Replace All will just replace the instances in the open topic, use Find Next to skip a match and go to the next instance.
Depending on how cautious you are, and to start with it won't hurt to be, I'd use Replace instead of Replace All or Replace in All Files just to check the regular expression is picking up everything you require and nothing that you don't.
Once that's done, you have to then run the normal find/replace on the <span class="Review"> tag. Until you've done this your topics will all be broken according to Flare becuase your html will all be invalid as the closing </span> tags are missing.
The code for the expression basically says find <span class="Review"> but don't include it in the results then ignore blank space and line breaks until you hit </span> and highlight it.
Remeber to back up before you run these, I have never had an issue with them, but I'm always cautious to start with - I end up replaces hundreds on instances of code in a lot of topics so if it goes wrong it can break a lot.
If you want to know more, I use this site a lot for helping me with regular expressions http://gskinner.com/RegExr/
Let me know if you need more help.
Nick
1. Put the code in the Find what field.
2. Leave Replace with blank so it effectively deletes the code (replaces it with no text)
3. Set your Find in option. Maybe a topic by topic, or topics in same folder, or whole project.
4. Change this drop-down from Wild Card to Regular Expressions
5. Hit Start
6. After you hit start you'll have to option to Replace in All Files - this will replace all instances across all topics (based on what you selected in the Find in box [step 3]) or Replace All will just replace the instances in the open topic, use Find Next to skip a match and go to the next instance.
Depending on how cautious you are, and to start with it won't hurt to be, I'd use Replace instead of Replace All or Replace in All Files just to check the regular expression is picking up everything you require and nothing that you don't.
Once that's done, you have to then run the normal find/replace on the <span class="Review"> tag. Until you've done this your topics will all be broken according to Flare becuase your html will all be invalid as the closing </span> tags are missing.
The code for the expression basically says find <span class="Review"> but don't include it in the results then ignore blank space and line breaks until you hit </span> and highlight it.
Remeber to back up before you run these, I have never had an issue with them, but I'm always cautious to start with - I end up replaces hundreds on instances of code in a lot of topics so if it goes wrong it can break a lot.
If you want to know more, I use this site a lot for helping me with regular expressions http://gskinner.com/RegExr/
Let me know if you need more help.
Nick
You do not have the required permissions to view the files attached to this post.
-
jasonsmith
- Sr. Propeller Head
- Posts: 205
- Joined: Wed Apr 28, 2010 2:51 am
Re: Easy way to remove span class?
You can use the Remove inline formatting button in the toolbar to "turn off" a span effect.
-
kwag_myers
- Propellus Maximus
- Posts: 810
- Joined: Wed Jul 25, 2012 11:36 am
- Location: Ann Arbor, MI
Re: Easy way to remove span class?
But does that remove the syntax, or just override it?jasonsmith wrote:You can use the Remove inline formatting button in the toolbar to "turn off" a span effect.
"I'm tryin' to think, but nothin' happens!" - Curly Joe Howard
-
jasonsmith
- Sr. Propeller Head
- Posts: 205
- Joined: Wed Apr 28, 2010 2:51 am
Re: Easy way to remove span class?
Using this button removes the span tags from the code (you can check this in the source code view)