Page 1 of 1

Conditional text applied automatically to page numbers?

Posted: Fri Sep 18, 2015 2:16 pm
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

Re: Conditional text applied automatically to page numbers?

Posted: Sun Sep 20, 2015 4:15 pm
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})';
	}
}

Re: Conditional text applied automatically to page numbers?

Posted: Mon Sep 21, 2015 2:33 am
by ChoccieMuffin
Don't you have to have {/color} after your page number?

Re: Conditional text applied automatically to page numbers?

Posted: Mon Sep 21, 2015 12:18 pm
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.

Re: Conditional text applied automatically to page numbers?

Posted: Tue Sep 22, 2015 10:38 am
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!

Re: Conditional text applied automatically to page numbers?

Posted: Tue Sep 22, 2015 12:14 pm
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.

Re: Conditional text applied automatically to page numbers?

Posted: Wed Sep 23, 2015 1:43 pm
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!

Re: Conditional text applied automatically to page numbers?

Posted: Wed Sep 23, 2015 3:06 pm
by Nita Beck
No worries, Karen. I have "Duh!" and "Doh!" moments every week! Glad we all got you squared away.

Re: Conditional text applied automatically to page numbers?

Posted: Fri Sep 22, 2023 2:13 pm
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!

Re: Conditional text applied automatically to page numbers?

Posted: Tue Oct 10, 2023 7:23 am
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.