Keep text together

This forum is for all Flare issues related to styles, stylesheets and XML.
Post Reply
Boone
Propeller Head
Posts: 44
Joined: Thu Jan 31, 2008 10:24 am

Keep text together

Post by Boone »

In my Flare project, whenever a product name is used in a topic - regardless of whether the topic is output to an online or pdf format - the product name has to be kept together on the same line. I have many product names defined as snippets: for example product a v2.

I haven't been able to find the correct attribute, or attribute combination, to make sure that the product name always stays together on the same line. My question is: how do I do this? I need to do it not only for snippets, but for selected chunks of text as well.

Help!?!
:?:
AlexFox
Sr. Propeller Head
Posts: 159
Joined: Thu Oct 19, 2017 1:56 am

Re: Keep text together

Post by AlexFox »

Put the product name in a span class and add the attribute white-space: nowrap;
Boone
Propeller Head
Posts: 44
Joined: Thu Jan 31, 2008 10:24 am

Re: Keep text together

Post by Boone »

Fabulous - thanks Alex! After my post, I was thinking that nowrap was the thing to look into, I just hadn't been able to find where it was. Thanks for your answer!
Boone
Propeller Head
Posts: 44
Joined: Thu Jan 31, 2008 10:24 am

Re: Keep text together

Post by Boone »

Almost there: here's a new tidbit - this solution works great as long as there is not a period "." right after the snippet. If there is, then the snippet still wraps.
AlexFox
Sr. Propeller Head
Posts: 159
Joined: Thu Oct 19, 2017 1:56 am

Re: Keep text together

Post by AlexFox »

Ahhh, a lovely Flareism. Can I ask if there's a particular reason you use a snippet over a variable here?
Boone
Propeller Head
Posts: 44
Joined: Thu Jan 31, 2008 10:24 am

Re: Keep text together

Post by Boone »

Of course you may ask - I'm grateful for your help! The reason I'm using a snippet instead of a variable is because I need a portion of the text in the snippet to be bold. My understanding is that you can't apply formatting to variables.
AlexFox
Sr. Propeller Head
Posts: 159
Joined: Thu Oct 19, 2017 1:56 am

Re: Keep text together

Post by AlexFox »

You can insert a Variable inline by using [%=Variableset.Variablename%] - you can use this in a span class with whatever formatting you need. Give that a try in conjunction with your white-space fix and see how that works out.
Boone
Propeller Head
Posts: 44
Joined: Thu Jan 31, 2008 10:24 am

Re: Keep text together

Post by Boone »

Sounded very promising, but is working the same way: it doesn't respect the nowrap if the period is right after the [%Variableset.Variablename%] text. It does work if I put a space before the period, but of course, I can't do that.

The other complication is that "TM" is included in my product name, and needs to be superscript. So if I insert [%Variableset.Product TM%], then I select and superscript the TM, it doesn't work at all.

I think I need to contact Flare support about why neither of these options work correctly when followed by a period. :(
AlexFox
Sr. Propeller Head
Posts: 159
Joined: Thu Oct 19, 2017 1:56 am

Re: Keep text together

Post by AlexFox »

As far as the TM goes, you'd place that outside of the variable, i.e. [%=Variables.Product%]<sup>TM</sup>. I'm at a lost as to why you're having this problem, just ensure you're doing something along the lines of the following:

Code: Select all

<span class="nowrap">[%=Variables.Product%]<sup>TM</sup>.</span>
mrklln
Jr. Propeller Head
Posts: 2
Joined: Tue Nov 19, 2019 5:46 am

Re: Keep text together. Thank you.

Post by mrklln »

Hello,
this solution was posted a while ago.
I found it this morning, used it, and it helped.
Thanks very much.
Mark
ClanMoffat
Jr. Propeller Head
Posts: 8
Joined: Thu Jun 22, 2023 2:34 am

Re: Keep text together

Post by ClanMoffat »

The solution works-ish...

I have PDF output built from an imported HTML file with a table...
Sadly, a variable is referenced in the description of an item within the table...
  • Without the solution, the variable is shown split at the end of the column... :(
  • When using the solution, the variable is not wrapped! :D
    • But the column in that particular row is extended to include the variable! :o
    • The column width is fixed...
Simply the solution doesn't work inside tables... :roll:

I guess I'm pushing my luck ~ importing HTML files, using tables, variables inside tables, and now wanting variables inside tables to behave nicely!!! :D
Post Reply