Customize chapter in toc

Post here questions and problems related to editing and publishing DITA content.
arnaud
Posts: 7
Joined: Fri Mar 23, 2018 1:16 pm

Customize chapter in toc

Post by arnaud »

Hello,

Context : Oxygen XML Editor 20, transformation WYSIWYG with custom CSS and Oxygen PDF Chemistry.

I got some informations about the toc customization here : https://www.oxygenxml.com/doc/versions/ ... %2Ccontent

1) Is it possible to customize only every chapter of the toc and not all the toc?

2) Is it possible to add, below each chapter in the toc, the short description of the topic?

Regards
Dan
Posts: 501
Joined: Mon Feb 03, 2003 10:56 am

Re: Customize chapter in toc

Post by Dan »

Hello,

1) The following is an example of customizing the font size for the items representing chapters. The chapters are level one topics and are marked in the merged DITA document TOC with the "is-chapter" attribute:

Code: Select all


*[class ~= "map/topicref"][is-chapter = "true"]  > *[class ~= "map/topicmeta"] > *[class ~= "topic/navtitle"]{
font-size:2em;
}
2) You need to make a change in the XSL pipeline as we filter shortdesc information from the TOC. For this open the OXYGEN_INSTALL_DIR/frameworks/dita/DITA-OT2.x/plugins/com.oxygenxml.pdf.css/xsl/post-process-toc.xsl and remove the XSL template:

Code: Select all

<xsl:template match="opentopic:map//*[contains(@class, ' map/shortdesc ')]"/>
In the next oXygen release, this template will be deactivated by default.
Then, in your customization css add the following CSS selector:

Code: Select all


*[class ~= "map/topicref"][is-chapter = "true"] > *[class ~= "map/topicmeta"] > *[class ~= "map/shortdesc"] {
display:block; /* The default is none - the shortesc is hidden. */
color:gray;
}
In case you need all the TOC items short descriptions to be visible, remove the "is-chapter" condition.

Many regards,
Dan
arnaud
Posts: 7
Joined: Fri Mar 23, 2018 1:16 pm

Re: Customize chapter in toc

Post by arnaud »

Hello,

1) Works perfectly

2) Works also but a strange problem appears : all the <ph> tag in the shortdesc induce a line break. Is there a reason ? I also tried with <text> but same behaviour.

Thanks,

Arnaud
Dan
Posts: 501
Joined: Mon Feb 03, 2003 10:56 am

Re: Customize chapter in toc

Post by Dan »

Hello,
Indeed, the children of the shortdesc are considered blocks. This is a bug - a side effect from the fact we considered the topicmeta elements at any level to be blocks.
I corrected it, the fix will enter the next oXygen version.
As a workaround, please add to your CSS the following snippet:

Code: Select all


*[class ~= "map/shortdesc"] * { 
display:inline;
margin:0;
}
Many regards,
Dan
arnaud
Posts: 7
Joined: Fri Mar 23, 2018 1:16 pm

Re: Customize chapter in toc

Post by arnaud »

It's working :D

Big thanks
Post Reply