TOC levels 5+ ignored/demoted

This forum is for all Flare issues related to PDF, eBook, Microsoft Word, Adobe FrameMaker, XPS, and XHTML book targets.
Post Reply
chuck_agari
Sr. Propeller Head
Posts: 225
Joined: Wed May 30, 2018 2:40 pm

TOC levels 5+ ignored/demoted

Post by chuck_agari »

In a PDF output with the "Use TOC depth for heading levels" setting selected, TOC entries that should be at level 5 are instead styled as if they are at level 2. I also have at least 1 topic that is not appearing in the TOC at all, although the content is in the PDF.

I did not have the mc-heading-level definition in the CSS TOC selectors. I added it, but it made no difference. (Also, adding it in the default CSS view added it only to the base styles, not the media: print-specific styles.)

I ran a test, color coding each p.TOC# style, and it's clear that what should be rendered as p.TOC5 is using the p.TOC2 style.

I am at a loss here.
Nita Beck
Senior Propellus Maximus
Posts: 3667
Joined: Thu Feb 02, 2006 9:57 am
Location: Pittsford, NY

Re: TOC levels 5+ ignored/demoted

Post by Nita Beck »

If I understand you, you've set the mc-heading-level attribute to 0 for some of the p.TOC# selectors, yes? Those are the wrong selectors to use that attribute in. Use it in the heading selectors. So, say, if you want something that ends up as an h5 (once the "TOC depth" operation is complete) not to be included in the generated table of contents of the PDF, you'd add that attribute to the h5 class.

Also, based on recent personal experience, look for any inline formatting that be in play in the headings that are not behaving as you expect in the generated PDF. I banged my head against the wall on this myself in recent weeks only to discover that the mc-heading-level attribute was being applied INLINE for a handful of headings, so those ended up overriding the "TOC depth" operation.
Nita
Image
RETIRED, but still fond of all the Flare friends I've made. See you around now and then!
chuck_agari
Sr. Propeller Head
Posts: 225
Joined: Wed May 30, 2018 2:40 pm

Re: TOC levels 5+ ignored/demoted

Post by chuck_agari »

Nita Beck wrote:If I understand you, you've set the mc-heading-level attribute to 0 for some of the p.TOC# selectors, yes? Those are the wrong selectors to use that attribute in. Use it in the heading selectors. So, say, if you want something that ends up as an h5 (once the "TOC depth" operation is complete) not to be included in the generated table of contents of the PDF, you'd add that attribute to the h5 class.

Also, based on recent personal experience, look for any inline formatting that be in play in the headings that are not behaving as you expect in the generated PDF. I banged my head against the wall on this myself in recent weeks only to discover that the mc-heading-level attribute was being applied INLINE for a handful of headings, so those ended up overriding the "TOC depth" operation.
No. I specifically set mc-heading-levels to match the TOC levels: mc-heading-level: 1 for p.TOC1, mc-heading-level: 2 for p.TOC2, etc.

There is no inline formatting in the topic headings.

However, I did find this burind in the CSS:

Code: Select all

h5
	{
		mc-heading-level: 0;
	}

	h6
	{
		mc-heading-level: 0;
	}
From what you're saying, this might be the issue. I'm gonna change it and give it a try.

What's bothering me here now is that it looks like I may have set these separately sometime back, but Flare did not add these definitions to the existing h5 and h6 selectors. Flare seems to be doing this with other selectors as well when I edit in the Flare CSS editor (something I rarely do), and it's making a mess of my CSS.
chuck_agari
Sr. Propeller Head
Posts: 225
Joined: Wed May 30, 2018 2:40 pm

Re: TOC levels 5+ ignored/demoted

Post by chuck_agari »

So adding mc-heading-level definitions to the heading selectors in the CSS rather than the TOC selectors got me the rest of the headings in the TOC. But I'm still having one annoying issue. Here is the start of one topic:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<html xmlns:MadCap="http://www.madcapsoftware.com/Schemas/MadCap.xsd" class="reference" style="mc-master-page: url('../../../../Resources/MasterPages/AgariMasterPage.flmsp');">
    <head>
    </head>
    <body>
        <h1>Values for the How Much Have I Saved By Deploying  <MadCap:variable name="Variables.Product Name (short)" /> Report</h1>
        <p>If you enter values that are below the default, you will see a warning indicator. In general, values below the default values, values that are backed by extensive, world-wide research, may give you a result that does not reflect real-world data.</p>
        <h2>Currency</h2>
        <p>You can select <span class="UI_label">Dollar</span> or <span class="UI_label">Euro</span>.</p>
        <h2>Breach Cost Savings</h2>
        <p>You can define the values that you believe one breach costs your organization specifically. </p>
The h2 elements in this topic still render at the wrong level in the TOC. In the TOC the h1 element is at level 7. The h2s end up being rendered at level 3. How can I tell? Well, here's the CSS:

Code: Select all

h1,
	h2,
	h3,
	h4,
	h5,
	h6,
	h7,
	h8
	{
		margin-left: 0in;
		font-weight: bold;
		page-break-after: avoid;
		hyphens: none;
		mc-hyphenate: never;
	}

	h1
	{
		font-size: 24pt;
		mc-heading-level: 1;
	}

	h2
	{
		font-size: 20pt;
		mc-heading-level: 2;
	}

	h3
	{
		font-size: 16pt;
		mc-heading-level: 3;
	}

	h4
	{
		font-size: 14pt;
		mc-heading-level: 4;
	}

	h5
	{
		font-size: 12pt;
		mc-heading-level: 5;
	}
	
	h6 {
		mc-heading-level: 6;
	}
	
	h7 {
		mc-heading-level: 7;
	}
	
	h8 {
		mc-heading-level: 8;
	}

	h1.chapter
	{
		font-size: 28pt;
		line-height: 36pt;
		margin-left: 0.5in;
		margin-top: 24pt;
		margin-bottom: 36pt;
		text-indent: -1.0in;
		mc-auto-number-class: ChapAutoNum;
		/* mc-auto-number-format: 'CH:CHAPTER {chapnum} '; */
		mc-auto-number-format: 'CH: {chapnum} ';
		padding-left: 0;
		padding-top: 0;
		hyphens: none;
		mc-hyphenate: never;
	}
and

Code: Select all

p.TOC1
	{
		color: red;
		font-size: 12pt;
		font-weight: bold;
		margin-bottom: 3px;
		margin-top: 6px;
		page-break-after: avoid;
	}

	p.TOC2
	{
		color: orange;
		font-size: 10pt;
		font-weight: normal;
		margin-bottom: 2px;
		margin-left: 0.2in;
		margin-top: 2px;
	}

	p.TOC3
	{
		color: yellow;
		font-size: 8pt;
		font-weight: normal;
		margin-bottom: 2px;
		margin-left: 0.4in;
		margin-top: 2px;
	}

	p.TOC4
	{
		color: green;
		font-size: 8pt;
		font-weight: normal;
		margin-bottom: 2px;
		margin-left: 0.6in;
		margin-top: 2px;
	}

	p.TOC5
	{
		color: blue;
		font-size: 8pt;
		font-weight: normal;
		margin-bottom: 2px;
		margin-left: 0.8in;
		margin-top: 2px;
	}

	p.TOC6
	{
		color: purple;
		font-size: 8pt;
		font-weight: normal;
		margin-bottom: 2px;
		margin-left: 0.9in;
		margin-top: 2px;
	}

	p.TOC7
	{
		color: black;
		font-size: 8pt;
		font-weight: normal;
		margin-bottom: 2px;
		margin-left: 1.0in;
		margin-top: 2px;
	}
	
	p.TOC8
	{
		color: magenta;
		font-size: 8pt;
		font-weight: normal;
		margin-bottom: 2px;
		margin-left: 1.1in;
		margin-top: 2px;
	}

	p.TOCHeading
	{
		color: #f68d39;
		font-size: 36pt;
		font-weight: bold;
		letter-spacing: -1px;
		line-height: 60pt;
		margin: 0;
		text-align: center;
	}
As you can see, the h2 elements in this case should be in black. They are not. They are orange, and at the same level as the other orange entries in the TOC (which, BTW, seem to be OK). The h1 is rendered in purple, which matches where it is in the hierarchy in the TOC file. The TOC up to this point looks OK, and after the mis-rendered h2 headings, the next TOC entries are back at the correct levels.
Nita Beck
Senior Propellus Maximus
Posts: 3667
Joined: Thu Feb 02, 2006 9:57 am
Location: Pittsford, NY

Re: TOC levels 5+ ignored/demoted

Post by Nita Beck »

Glad we could help getting one of your issues fixed or on its way to being fixed.

Regarding h7 & h8, I'm not a CSS expert by any means, but I'm pretty sure there are no such things. I'm pretty sure (though could be wrong ;)) that there are only h1 thru h6 in CSS.
Nita
Image
RETIRED, but still fond of all the Flare friends I've made. See you around now and then!
chuck_agari
Sr. Propeller Head
Posts: 225
Joined: Wed May 30, 2018 2:40 pm

Re: TOC levels 5+ ignored/demoted

Post by chuck_agari »

Hah! the HTML spec defines 6 heading levels: https://www.w3.org/MarkUp/html3/headings.html

I'd be willing to bet that because Flare is almost certainly validating against the XHTML DTD, that it doesn't "know" what to do if a selector is defined past that.

But it also means that if you use TOC depth for heading levels, then everything breaks if you have a document structure that goes deeper than 6 levels, which is not entirely unreasonable. It's really why that mc-heading-level definition should be attached to the p.TOC# selectors, not the heading selectors.

I moved that topic up one in the hierarchy, and I got the sub-headings where they were supposed to be.
Post Reply