Highlight on a snippet (or other re-usable)?

This forum is for all Flare issues not related to any of the other categories.
Post Reply
kevinmcl
Sr. Propeller Head
Posts: 252
Joined: Mon Sep 11, 2006 10:58 am

Highlight on a snippet (or other re-usable)?

Post by kevinmcl »

I reproduce the output of a few "show" commands (showinfo, showpolicies, etc.) in several places throughout my customer docs, as appropriate to the task the customer is performing, or the background info they are perusing.
I might be discussing the output in general terms, or I might be discussing specific items within it, and how/why/when they would change... and what it means if they show one or another condition.

In several cases, I use snippets, so I can update in just one place when the product changes from release to release.

It would be useful if I could somehow HIGHLIGHT specific text in SOME presentations, while not having to highlight the snippet itself - which would be inappropriate for the majority of the situations where it was called.

Is there a way to, perhaps, overlay some sort of highlighting or some kind of pointer on top of an occurrence of a snippet, not the source/original snippet itself, but one [of many] places where it is called in the docs?

Or, is there a way to achieve the kind of re-use that I want, in combination with the occasional uniqueness that I want, using some feature other than snippets?
De gustibus non disputandum est
Nita Beck
Senior Propellus Maximus
Posts: 3672
Joined: Thu Feb 02, 2006 9:57 am
Location: Pittsford, NY

Re: Highlight on a snippet (or other re-usable)?

Post by Nita Beck »

Could you achieve what you're after with styles?

If the snippet doesn't standalone by itself, but is inserted within some other block, then you could use a span style (perhaps calling it "span.Highlight") that applies a background color to the snippet. (I'm not sure, but you might have to go into the code to wrap the snippet in the span tag.)

If the snippet does standalone, you could apply a "p.Highlight" style. Or if you put the snippet in a div, you could apply a "div.Highlight" style.

Maybe a generic ".Highlight" style could work for all or most instances.
Nita
Image
RETIRED, but still fond of all the Flare friends I've made. See you around now and then!
Msquared
Propellus Maximus
Posts: 848
Joined: Mon Aug 06, 2012 10:19 am
Location: Southampton, UK

Re: Highlight on a snippet (or other re-usable)?

Post by Msquared »

Just clarifying, you want to highlight some text within the snippet in some snippet placements only? It's not the whole snippet you want to highlight in some placements and not others?

If it's just some text in the snippet, I can think of a way, provided you don't want the same snippet to appear more than once in the same topic with different highlight options. In that case, you could use snippet conditions to include all the various highlight/non-highlight options in a single snippet. Snippet conditions are just ordinary conditions, but you can set the condition options on a topic (rather than to a target), so that allows you to control how a snippet looks when it is placed in a topic. Go to Topic > Properties > Snippet Conditions.

But, but, but, be very careful and don't get too clever. Because in Flare snippet conditions are also normal conditions, so you can set them in targets too. And then you get a really messy interaction, for example, if you have a snippet condition A, and set it to be INCLUDED for a snippet placed in a topic, but EXCLUDED in the target, you will exclude that content in the final output

You will need to think it through carefully to make sure you don't trip yourself up, and perhaps do some experiments to make sure I've remembered this correctly (I've not got any snippet conditions in my current projects). I created completely separate condition tag sets for snippet conditions, and named each snippet condition with a name that obviously includes "SNIPPET" so I don't ever use it anywhere else by mistake. I then make sure that these are always set to be INCLUDED in all my targets - I don't ever want the target setting to exclude something I thought I'd included. I think you'll find that if you exclude the snippet condition in a topic, it won't ever get as far as the target, but if you include the snippet condition in a topic, you can still exclude it at the target. :-(

This does mean that you will need to duplicate each instance of text in your snippet that is sometimes highlighted and sometimes not. But at least the two occurrences will be side by side, so if you modify one, you will notice to modify both.

Something else you could consider if you are highlighting whole blocks of text in the snippet, rather than one or two words. You could make the whole block a snippet too, and place that snippet in the original snippet twice, once highlighted and once not, controlled by conditionals as before. That way you would only have one place to change the source content of the sometimes-highlighted block, although you would still have to control which highlighting option you wanted by snippet conditions applies to the topic. But again, I'd advise against making things too complicated, since you or someone else may have to remember what you've done some day in years to come!

Finally, it's not the end of the world if you have multiple duplicated snippets with various highlighted sections, so long as you can easily see what is going on. My solution for remembering what is going on is to define a "Comment" condition that is always excluded from the final output. I use that to add any notes to myself (or to anyone who may work on my projects in the future). So if you have multiple almost identical snippets, you could just add a "Comment" at the top, saying something like "The content in this snippet is duplicated in sippets X, Y, Z"
Marjorie

My goal in life is to be as good a person as my dogs already think I am.
Nita Beck
Senior Propellus Maximus
Posts: 3672
Joined: Thu Feb 02, 2006 9:57 am
Location: Pittsford, NY

Re: Highlight on a snippet (or other re-usable)?

Post by Nita Beck »

To clarify my post, I'm not suggesting adding the highlighting within the snippet file. I'm not suggesting having two versions of the same snippetized content, with one snippet having highlighting and the other not having highlighting. Rather, I'm suggesting applying the highlighting in the topic where the snippet has been inserted. It would be totally under your control whether or not to apply the highlighting to the snippet at its point of use.

(Hi Msquared! ;) Stop workin' already. It's the weekend where you are!)
Nita
Image
RETIRED, but still fond of all the Flare friends I've made. See you around now and then!
Post Reply