Page 1 of 1

Customize chapter in toc

Posted: Thu Apr 05, 2018 12:29 pm
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

Re: Customize chapter in toc

Posted: Thu Apr 05, 2018 4:13 pm
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

Re: Customize chapter in toc

Posted: Thu Apr 05, 2018 5:30 pm
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

Re: Customize chapter in toc

Posted: Wed Apr 11, 2018 10:07 am
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

Re: Customize chapter in toc

Posted: Thu Apr 12, 2018 10:49 am
by arnaud
It's working :D

Big thanks