Custom text for cross references (xrefs)

This forum is for all Flare issues not related to any of the other categories.
Post Reply
sunil_panchal
Jr. Propeller Head
Posts: 4
Joined: Wed Jul 17, 2019 8:15 am

Custom text for cross references (xrefs)

Post by sunil_panchal »

Hi all,

I publish documents to PDF and web help format, and have had a long-standing requirement to use custom text with cross references in PDF output.

For example, I want the web help to contain:
You can create a widget.

And I want the PDF to contain:
You can create a widget (see page 54).

Both are references to widget.htm and I want them to have the same text ("You can create a widget"). I don't mind whether the PDF reference is clickable or not, because as a printed doc the reader has the page number to navigate with.

In the past, the only way I'd found of achieving this involved two conditional text tags and repeated text (which was really not ideal, because it often confused translators):

Code: Select all

<MadCap:conditionalText MadCap:conditions="Default.PrintOnly"><a href="widget.htm">You can create a widget</a></MadCap:conditionalText><MadCap:conditionalText MadCap:conditions="Default.ScreenOnly">You can create a widget <MadCap:xref href="widget.htm" class="inline"></MadCap:xref></MadCap:conditionalText>.
I also had to create the following class (in the "@media print" section of the .css file):

Code: Select all

MadCap|xref.inline
{
	mc-format: '(see page {page})';
}
The repeated text was a problem because of the possibility of consistency errors, and it made the solution feel pretty unsatisfactory.

However, yesterday I came up with the following code to implement the links, which seems to achieve the same outcome without repeating text:

Code: Select all

<a href="widget.htm" MadCap:conditions="Default.ScreenOnly" MadCap:excludeAction="unbind">You can create a widget</a><MadCap:conditionalText MadCap:conditions="Default.PrintOnly"> <MadCap:xref href="widget.htm" class="inline"> /></MadCap:conditionalText>.
I hope this helps anyone who need to achieve the same goal. If anybody spots any problems, let me know.
Chicago_HPT
Sr. Propeller Head
Posts: 133
Joined: Sun Feb 03, 2013 6:01 pm

Re: Custom text for cross references (xrefs)

Post by Chicago_HPT »

You can also edit the Xref in the CSS Editor (or in the text editor) to display different text for different media. For example, the default xref looks like this (I may have added italics and changed the color, I don't recall), Here it is in the Advanced Editor:
css-xref-diff-media.png
In the actual CSS file, it looks like this for my default medium:

Code: Select all

MadCap|xref
{
	font-weight: normal;
	text-decoration: none;
	mc-format: '{para}';
	color: #0e3aa1;
}

And like this for my print medium:

Code: Select all

@media print
{
   MadCap|xref
	{
		mc-format: '{i}{para}{/i}{color #464646} {pageref}{/color}';
	}
}
If desired, you can also set the mc-exclusion-action attribute in the CSS. In the Advanced Editor, it's under the Unclassified group. In the text editor, you'd just type mc-exclusion-action: unbind;.

Cheers,
-jeff
You do not have the required permissions to view the files attached to this post.
Post Reply