Flare wraps variables in spans, any way to prevent this?

This forum is for all Flare issues related to styles, stylesheets and XML.
Post Reply
0Qq5Ew538tV
Propeller Head
Posts: 19
Joined: Wed Jun 06, 2018 11:51 am

Flare wraps variables in spans, any way to prevent this?

Post by 0Qq5Ew538tV »

When you build content that contains variables, the output has the variable wrapped in a span tag.

Code: Select all

<span class="ProductName">Widget</span>
Is there any way to prevent Flare from wrapping variables in span tags? I just want Flare to insert my variable without wrapping it in span tags since this is interfering with some custom CSS.
NorthEast
Master Propellus Maximus
Posts: 6426
Joined: Mon Mar 05, 2007 8:33 am

Re: Flare wraps variables in spans, any way to prevent this?

Post by NorthEast »

There's no option in Flare to change that behaviour.

It shouldn't really interfere with your CSS as such though, as these spans are not styled in any way - unless you have a variable name that's the same as an exisiting class name in your CSS.
bgo
Jr. Propeller Head
Posts: 6
Joined: Mon Sep 09, 2019 8:39 am

Re: Flare wraps variables in spans, any way to prevent this?

Post by bgo »

We're using Flare variables in JavaScript on our master page. Now that Flare output wraps variables with a <span> tag, we'll have to find a workaround.

We tried using a snippet instead of a variable, but Flare doesn't seem to evaluate snippets inside of <script> tags. Adding JavaScript to extract the value of the variable from the <span> tag should work.

Any other ideas?

Thanks,
Brent
NorthEast
Master Propellus Maximus
Posts: 6426
Joined: Mon Mar 05, 2007 8:33 am

Re: Flare wraps variables in spans, any way to prevent this?

Post by NorthEast »

bgo wrote:We're using Flare variables in JavaScript on our master page. Now that Flare output wraps variables with a <span> tag, we'll have to find a workaround.

We tried using a snippet instead of a variable, but Flare doesn't seem to evaluate snippets inside of <script> tags. Adding JavaScript to extract the value of the variable from the <span> tag should work.

Any other ideas?

Thanks,
Brent
Depends how you inserted your variable.

If you insert it as HTML, then it won't work.

Code: Select all

<MadCap:variable name="Variables.Something" />
If you insert it in this format, then it should work.

Code: Select all

[%=Variables.Something%]
bgo
Jr. Propeller Head
Posts: 6
Joined: Mon Sep 09, 2019 8:39 am

Re: Flare wraps variables in spans, any way to prevent this?

Post by bgo »

Oh, yes! Thanks for pointing that out. We shouldn't have been using <MadCap:Variable> in JavaScript anyway. So it's only when using <MadCap:variable name="Variables.Something" /> that the variable in the output is within a <span> tag starting in 2020 r2. If you use the [%=Variables.Something%] form, the output is still the literal value of the variable.

Thanks,
Brent
Post Reply