Conditional text applied automatically to page numbers?

This forum is for Single-Sourcing your Flare content to multiple outputs.
Post Reply
ksharkey9414
Propeller Head
Posts: 18
Joined: Wed May 20, 2015 2:29 pm

Conditional text applied automatically to page numbers?

Post by ksharkey9414 »

I'm single-sourcing my HTML5 output with PDF output. I created a cross reference style that lists the page number along with the term. Here's what I put for the properties:

{color blue}{paratext}{/color} {color black}(page {page})

The end result is something like this: allowFileOpens (page 1)

I've been going back through the lists of terms and manually conditioning the page numbers and their parens for PDF output. But with hundreds of terms this process is tedious at best. Is there a way to indicate in the code above that the page numbers are for PDF output only? Or, is there a better way to do this?

Thanks,

Karen
Paulie
Sr. Propeller Head
Posts: 140
Joined: Sun Mar 01, 2015 3:01 pm

Re: Conditional text applied automatically to page numbers?

Post by Paulie »

Hi Karen,

You are on the right track. The solution is to create different cross reference text for the different mediums in your style sheet:

For example:

Code: Select all

@media print
{
     MadCap|xref
     {
	     mc-format: '{color blue}{paratext}{/color} {color black}(page {page}{/color})';
     }
}

@media non-print
{
     MadCap|xref
	{
		mc-format: '{color blue}{paratext}{/color})';
	}
}
Last edited by Paulie on Mon Sep 21, 2015 12:18 pm, edited 1 time in total.
"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: 2632
Joined: Wed Apr 14, 2010 8:01 am
Location: Surrey, UK

Re: Conditional text applied automatically to page numbers?

Post by ChoccieMuffin »

Don't you have to have {/color} after your page number?
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: Conditional text applied automatically to page numbers?

Post by Paulie »

ChoccieMuffin wrote:Don't you have to have {/color} after your page number?
I would have thought so. I've added the extra tag to the above suggestion.
"In an ideal world, software should be simple, well designed, and completely intuitive to end users. In the real world, good documentation is king."
ksharkey9414
Propeller Head
Posts: 18
Joined: Wed May 20, 2015 2:29 pm

Re: Conditional text applied automatically to page numbers?

Post by ksharkey9414 »

Thanks everyone for your great ideas! But I have a question about the code example: the print example shows the two colors being used (blue and black), but doesn't appear to address the conditional text issue. Is there additional code I can use to make the page numbers conditional for print only?
Thanks!
Nita Beck
Senior Propellus Maximus
Posts: 3669
Joined: Thu Feb 02, 2006 9:57 am
Location: Pittsford, NY

Re: Conditional text applied automatically to page numbers?

Post by Nita Beck »

You don't need to do conditioning whatsoever. It's the format of the particular MadCap|xref style as defined in the stylesheet. You online output will use the format defined in the default medium (which I assume is the medium associated with your online targets), while your PDF output will use the format defined in the medium you use for your PDF targets.
Nita
Image
RETIRED, but still fond of all the Flare friends I've made. See you around now and then!
ksharkey9414
Propeller Head
Posts: 18
Joined: Wed May 20, 2015 2:29 pm

Re: Conditional text applied automatically to page numbers?

Post by ksharkey9414 »

Nita,

All I can say is "duh." Of course I can include the page number in my print style and not in my online style! :oops:

Thanks a million!
Nita Beck
Senior Propellus Maximus
Posts: 3669
Joined: Thu Feb 02, 2006 9:57 am
Location: Pittsford, NY

Re: Conditional text applied automatically to page numbers?

Post by Nita Beck »

No worries, Karen. I have "Duh!" and "Doh!" moments every week! Glad we all got you squared away.
Nita
Image
RETIRED, but still fond of all the Flare friends I've made. See you around now and then!
MunchMan
Propeller Head
Posts: 28
Joined: Mon Oct 19, 2015 9:35 am
Location: near Dallas, TX

Re: Conditional text applied automatically to page numbers?

Post by MunchMan »

To beat this a little further to death, I have a xref called "on page" which inserts " on page #":

MadCap|xref.on-page
{
mc-format: ' on page {page}';
color: #000000;
text-decoration: none;
}

I wanted it conditionaled for print automatically so I can quit having to flag it manually every time. On the advice above, I found it in my CSS and moved it into the Print medium section. Easy! I have nothing for on-page in my Web medium. But when I build for Web, instead of disappearing, it renders as the topic name :(. Instead of "See (topic) on page #", I get:

See Get started - Ev-LocalGet started - Ev-Local.

where "Get started - Ev-Local" is the topic title. The first one is correct. The second one is supposed to be the " on page #" that drops out. Not only is it not dropping out, it's rendering wrong. This is in my local output, before it even gets mangled by Salesforce :). It builds like it should for PDF. Super appreciate any help with this!
trent the thief
Propellus Maximus
Posts: 613
Joined: Wed Feb 01, 2006 6:21 am
Location: Off in the dark....

Re: Conditional text applied automatically to page numbers?

Post by trent the thief »

Slight misunderstanding, there.

Flare always outputs everything, even if a style or class is invalid. Flare just displays it with default formatting. If you want to be rid of that line in your online output, you'll need to exclude it with a condition.
Trent.

Certifiable.

Image

umm...
I meant MAD Certified.

Official Propeller Beanie Owner :-)

:flare: Are you on Flare's Slack channels? PM me for an invitation! :flare:
Post Reply