How to apply style to variables?

This forum is for all Flare issues related to styles, stylesheets and XML.
Post Reply
TeamOnlineWriter
Propeller Head
Posts: 16
Joined: Tue Aug 06, 2013 6:28 am

How to apply style to variables?

Post by TeamOnlineWriter »

Hi

I need to apply the style "Strong" to one of my variables. When I do this, the value of the variable is not displayed in bold, as would normally be the case when I apply the style Strong.

Can anyone help me out?

Cheers,
Anders
ChoccieMuffin
Senior Propellus Maximus
Posts: 2634
Joined: Wed Apr 14, 2010 8:01 am
Location: Surrey, UK

Re: How to apply style to variables?

Post by ChoccieMuffin »

As far as I'm aware, THAT'S A BUG! I'm sure someone will be along shortly to show how to report bugs, and it would be good if lots of us do so it gets higher up the list of priorities for being fixed.

HOWEVER, in the meantime I can suggest a workaround. Pain in the rear end, but it can be done.

Insert the variable.
Highlight it, including its markers, and apply the span. You will probably find you get a new (empty) pair of markers beside the variable. This is the SPAN pair.
Highlight the variable and drag it inside the empty pair of markers.
You may need to adjust the spaces, so you don't end up with too many or too few.

Clunky and a bloomin' nuisance to do, but it should get you by.

HTH.
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
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: How to apply style to variables?

Post by LTinker68 »

And if you always want that variable to be bold, then do what Choccie said, but do it in a snippet file. Then instead of inserting the variable in the topic, insert the snippet.

And you can report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
TeamOnlineWriter
Propeller Head
Posts: 16
Joined: Tue Aug 06, 2013 6:28 am

Re: How to apply style to variables?

Post by TeamOnlineWriter »

Hi Lisa and ChoccieMuffin.

Thanks for your feedback. I have created a bug on this, and later I will try out the workaround - at least until this has been fixed.

And regarding the snippet suggestion, I will give it a go too. However, as in the near future I will be teaching my colleagues how to use Flare (they are not tech writers), I will try to keep things as simple as possible. Afraid this might "overwhelm" them :)

Thanks again,
Anders
denisehale
Jr. Propeller Head
Posts: 5
Joined: Thu Dec 23, 2010 8:16 am

Re: How to apply style to variables?

Post by denisehale »

Hi there,
Does anyone know if there's a fix for this?
It's a pain to use a snippet and not the best to apply the style each time we use the variable.
Thanks.
NorthEast
Master Propellus Maximus
Posts: 6375
Joined: Mon Mar 05, 2007 8:33 am

Re: How to apply style to variables?

Post by NorthEast »

Yes, you can style variables, but it's an 'undocumented feature' that only works for the HTML5 output.

In HTML5 output, variables are enclosed in a span tag, and will have a class name based on the variable name.

For example, the variable Variables.CompanyName will appear in the output as:

Code: Select all

<span class="VariablesCompanyName">MadCap Software</span>
(Note the class name is the file and tag name without the '.' )

So all you need to do is add a style for that in your stylesheet; e.g.

Code: Select all

span.VariablesCompanyName
{
	color: blue;
}
Paulie
Sr. Propeller Head
Posts: 140
Joined: Sun Mar 01, 2015 3:01 pm

Re: How to apply style to variables?

Post by Paulie »

You can also style variables for Word outputs using the MadCap|variable css classes.

Code: Select all

MadCap|variable
{
	font-weight: bold;
}

MadCap|variable.Normal
{
	font-weight: normal;
}
Note: MadCap have confirmed that this is a bug, as these classes are only intended to style the variable in Flare's WYSIOP viewer and not in external outputs.
"In an ideal world, software should be simple, well designed, and completely intuitive to end users. In the real world, good documentation is king."
Paulie
Sr. Propeller Head
Posts: 140
Joined: Sun Mar 01, 2015 3:01 pm

Re: How to apply style to variables?

Post by Paulie »

I should also note that I logged a feature request recently asking MadCap to add an extra field to the Variables grid, allowing users to map variables to a specific style in the style sheet.
"In an ideal world, software should be simple, well designed, and completely intuitive to end users. In the real world, good documentation is king."
MattyQ
Sr. Propeller Head
Posts: 136
Joined: Tue Sep 30, 2014 7:10 am
Location: Roanoke, VA

Re: How to apply style to variables?

Post by MattyQ »

One of the other things you can do, playing off of Dave's method -- if you include spaces in the variable name, it will include each space-separated word as a class. For example, if the variable name was "ThisVariable Strong", when you generated the output you would see two classes applied to the variable, ThisVariable and Strong.

So, if you had a couple classes defined, like:

Code: Select all

.red {
    color: red;
}

.strong {
    font-weight: strong;
}
You could create a variable with the name, "thisvariable1 red strong", and the definition, "Example" -- in the final output, it would appear as: Example

I wouldn't advocate this as the BEST method, but it's another way.
ChoccieMuffin
Senior Propellus Maximus
Posts: 2634
Joined: Wed Apr 14, 2010 8:01 am
Location: Surrey, UK

Re: How to apply style to variables?

Post by ChoccieMuffin »

I have managed to apply styles to variables, but it's a faff.
  • 1. In Flare, type the sentence, including the variable.

    2. Place the cursor in front of the variable and type "x" (or something - anything!) then apply the span to the "x".

    3. Highlight the variable and drag it inside the applied span.

    4. Delete the "x".

    5. Check that the variable has actually ended up inside the span. If not, repeat steps 1-4 while pulling out handfuls of hair.
I've been doing this since I first started using Flare at version 6, and although I don't need to apply spans to variables in my current work I'm disappointed that there isn't an easier way.
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
Paulie
Sr. Propeller Head
Posts: 140
Joined: Sun Mar 01, 2015 3:01 pm

Re: How to apply style to variables?

Post by Paulie »

ChoccieMuffin wrote:I have managed to apply styles to variables, but it's a faff....
Funnily enough, that's what MapCap Support advised me to do when I asked for a method of styling variables!
"In an ideal world, software should be simple, well designed, and completely intuitive to end users. In the real world, good documentation is king."
ChoccieMuffin
Senior Propellus Maximus
Posts: 2634
Joined: Wed Apr 14, 2010 8:01 am
Location: Surrey, UK

Re: How to apply style to variables?

Post by ChoccieMuffin »

It does actually make sense that you should have to manually style variables in the topics where they're used, as there's no guarantee that you always want your variables to use the same styling whatever the output. But I wish I could JUST highlight the variable in the topic and apply a span without having to mess around quite so much. Ho hum, feel free to raise a feature request (or is it a bug?)
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
Post Reply