Page 1 of 1

Cross References and Lists

Posted: Sun Sep 27, 2015 11:23 am
by lizat
Dear Madcaps,

I suspect this still isn't possible but can I get my list number from an ordered list to appear as a cross reference?
I remember years ago having to do a fiddle with autonumbering on a list but it was less than satisfactory. does anyone know of a way?

Thank you............................. liz

Re: Cross References and Lists

Posted: Mon Sep 28, 2015 1:19 am
by ChoccieMuffin
I know you can do it in Word so I remember in previous Flare versions trying to do the same, and I found a resounding NO. So I'll be very interested to see if anyone has since been able to find out how to do this. (As in, "Repeat steps 4 - 7" where 4 and 7 are cross-refs to the step numbers was what I was trying to do.)

Re: Cross References and Lists

Posted: Mon Sep 28, 2015 4:18 pm
by kkelleher
We've got a StepNumber cross-reference type, but you aren't going to like how we got there.....

The install process of our app is very convoluted. In the install docs, we rely heavily on things like "skip step 3 if you use version X of app server Y." This isn't possible with ordered lists in HTML (and I don't think Flare supports it in any output types). Why is that? Because the number shown in the HTML is generated on the fly when the page is loaded, not when Flare writes the XML or HTML itself.

The HTML for an ordered list is:

Code: Select all

<ol>
  <li>Item 1</li>
  <li>Item 2</li>
  <li>Item 3</li>
</ol>
Which renders as:
1. Item 1
2. Item 2
3. Item 3

So the browser interprets the OL and generates a number; at build time, there isn't a step number that Flare can reference; it has no idea whether a step is the first or the fifth.

Instead of OL (which we would prefer to use), we're using Flare's AutoNumber feature. In the XML, it looks like:

Code: Select all

<p class="Numbered" MadCap:autonum="1.">After completing .....</p>
In the output HTML, it looks like:

Code: Select all

 <td class="AutoNumber_p_Bullet" valign="top" data-mc-autonum="1.">After completing .....</td>
In the XML, the cross reference looks like:

Code: Select all

 (<MadCap:xref class="Step_Number" href="#step_add_driver_to_classpath">stepĀ 1</MadCap:xref>)
The HTML for the cross reference looks like:

Code: Select all

(<a class="Step_Number MCXref xref xrefStep_Number selected" href="#step_add_driver_to_classpath">stepĀ 1</a>)
I don't think there is a solution for cross references pointing to the numbers of items in an OL.

One side effect of using the AutoNumber feature is that, under the covers, Flare builds all our procedures as tables, which has some unintended consequences. So this is definitely a kludge.

Thanks, and apolgies if this is tl;dr,

Kristen

Re: Cross References and Lists

Posted: Wed Aug 07, 2024 7:34 am
by Four-States
I have a workaround that has worked well for PDF outputs. I have not tried it for other output types. The idea is to duplicate the list item marker/counter in the child <p> element but prevent the duplicate from rendering in the output. I've found that rather than making these changes within Flare, it is easier to open the stylesheet file in Notepad++ and make the changes there.

Code: Select all

ol.CoolList
{/*Ordered list. Reset the counter for the list item marker.*/
	counter-reset: li-counter;
	list-style: lower-latin;
/*For each new ordered list, reset the para autonumber we bookmark.*/
	mc-auto-number-format: 'X:{a=0}. ';
	mc-auto-number-position: inside-head;
	mc-auto-number-class: NoDisplay;
}

ol.CoolListSub
{/*Nested ordered list. Reset the counter for the list item marker.*/
	counter-reset: subli-counter;
	list-style: decimal;
/*For each new nested ordered list, reset the para autonumber we bookmark. */
	mc-auto-number-format: 'L:{n=0}. ';
	mc-auto-number-position: inside-head;
	mc-auto-number-class: NoDisplay;
}

ol.CoolList > li
{/*Increment the counter ordered list*/
	counter-increment: li-counter;
	list-style: lower-latin;
	padding: 0 0 0 -0.5em;
}

ol.CoolList > li::marker
{/*Set the marker for the ordered list.*/
	content: counter(li-counter) ".";
	color: #4472C4;
	font-weight: bold;
	font-size: 10pt;
	font-family: 'Swis721 BT';
}

ol.CoolListSub > li
{/*Increment the counter nested ordered list*/
	counter-increment: subli-counter;
	list-style: decimal;
	padding: 0 0 0 -0.5em;
}

ol.CoolListSub > li::marker
{/*Set the marker for the nested ordered list.*/
	content: counter(subli-counter) ".";
	list-style-type: decimal;
	color: #4472C4;
	font-weight: bold;
	font-size: 10pt;
	font-family: 'Swis721 BT';
}

ol.CoolList > li > p
{/*This is just preferred formatting and is not required.*/
	padding-left: -1.0em;
}

ol.CoolList > li > p:first-child
{/* Puts a counter on the first-child para so we can bookmark and cross-ref the step */
	mc-auto-number-format: 'X:{a+}. ';
	mc-auto-number-position: inside-head;
	mc-auto-number-class: NoDisplay;
}

ol.CoolList > li > ol.CoolListSub > li > p
{/*This is just preferred formatting and is not required.*/
	padding-left: -1.0em;
}

ol.CoolList > li > ol.CoolListSub > li > p:first-child
{/* Puts a counter on the first-child para so we can bookmark and cross-ref the nested step */
	mc-auto-number-format: 'L:{n+}. ';
	mc-auto-number-position: inside-head;
	mc-auto-number-class: NoDisplay;
}

span.NoDisplay
{/*Tells the para autonumbers needed for bookmark not to render in the output */
	color: red;
	font-weight: bold;
	display: none;	
}

MadCap|xref.OrderedListItem
{/*This is enables you to xref the autonumber of the first-child para*/
	mc-format: '{color #4472C4}Step {paranumonly}{/color}';
}
The following images include what the XML and Text Editor views might look like, as well as the example output. I hope this helps!

Image
Image
Image