In my view, one of the most interesting and useful changes in the 2020 release of MadCap Flare was the enhanced Find Elements tab of the Find and Replace in Files window. This tab existed in the previous version of Flare, and you could use it to easily locate specific structural elements such as html tags and classes within your content. The significant change in Flare 2020 is that you can now automatically replace or take other specified actions on the items that you find. Also new is the ability to combine search criteria in order to narrow down the results for example, you can find a certain tag that has a specific attribute.
The following sections describe a range of different use cases for this powerful new feature.
Removing inline formatting
You can use Find Elements to remove all spans that have been used to apply inline formatting. To do this, you would find all span tags that have an attribute of style, and specify a Replace/Action of Unbind Tag, as shown below.
Finding and replacing h3 with h2
This task is quite straightforward
you would find a tag of h3 and the
Replace/Action would be Set Tag
h2. You can be selective about the
replacements by clicking Find Next
for some occurrences of h3 and
Replace on others. Flare will, of course,
take care of the closing
automatically as well.
Removing all inline font-family style attributes
It is not uncommon for these style attributes (specifying a font such as Arial) to be present in content that has been imported into Flare, and they can cause problems if you need to change your default fonts by updating your stylesheet.
Using Find Elements, you could find Inline Formatting of font-family: and specify a Replace/Action of Remove Inline Formatting font-family: (as shown below).
The risk here is that you could be left with redundant span tags with no attributes, if font-family were the only inline format set by the span. Here is an example of what you could end up with:
<p><span>This text previously had inline formatting that set the font to Arial</span></p>
Although the span tag is not causing any harm, it is now completely redundant, and it would be nice if there were some easy and automated way of unbinding these redundant tags. I can't see a way to do this using Find and Replace Elements, and would probably have to resort to using Regular Expressions in the Find and Replace Text tab.
Removing inline list-style-type property from lists
Inline list-style-type attributes are undesirable as they override the liststyle- type attribute specified by your style sheet. This can lead to inconsistent use of bullets or numbering.
You can remove these inline liststyle- type properties by finding Inline formatting of list-style-type: and removing it (you need to type the same code into the Remove Inline Formatting field), as shown below.
If you wanted to remove all inline formatting (including any of the properties available in XHTML) from lists, then, somewhat surprisingly, it is not possible to do this by finding and removing inline formatting. This is because Flare requires you to specify the inline formatting properties that you are looking for. However, you can remove all inline formatting from lists by finding ul and ol tags that have an attribute of style, and removing the style attribute.
Removing a specific condition tag
Condition tags are applied to content within the XHTML source code by the special MadCap:conditions attribute. So, for example, you could remove a condition tag of HOLD (defined within the Primary condition tagset) by finding an attribute of MadCap:conditions Primary. HOLD and using a Replace/Action of Remove Attribute MadCap:conditions as shown below.
Note that this will not work for instances where another condition has been applied to the same content as the HOLD condition. To remove the HOLD condition from these items, you would have to find every possible combination of HOLD and other conditions (for example: "Primary.HOLD,Primary. AudienceA") and replace the attribute with the other condition on its own (for example: "Primary.AudienceA").
I was thinking that it would be useful to be able to automate the process of wrapping an image and its associated caption paragraph within a div, but I couldn't see a way to do this using Find Elements. This is because I would need to be able to find a specific combination of two different tags. Perhaps this will be possible in a future release?
Training and Consulting in MadCap Flare