how to limit the toc depth to 2 (css-based PDF)
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 115
- Joined: Mon Jul 10, 2023 11:49 am
how to limit the toc depth to 2 (css-based PDF)
Hi I'm modifying the css so that only level 1 and 2 topics are displayed in the TOC.
I took a reference from here:https://www.oxygenxml.com/doc/versions/ ... tents.html
and modify it like this:
/* Hide sections below level 2. */
*[class ~= "map/topicref"][is-chapter] >
*[class ~= "map/topicref"][is-chapter] >
*[class ~= "map/topicref"]:not([is-chapter]) >
*[class ~= "map/topicref"] >
*[class ~= "map/topicref"] {
display: none;
}
It doesn't work.
And I also tried with the following generic css rules:
.toc-entry.toc-h1,
.toc-entry.toc-h2
{
display: block;
}
.toc-entry.toc-h3,
.toc-entry.toc-h4,
.toc-entry.toc-h5,
.toc-entry.toc-h6
{
display: none;
}
They don't work either.
By the way, in the publishing template, I have the following parameter specified: <parameter name="args.css.param.numbering" value="shallow"/>. Being shallow means to have only level 1 topic titles included in the TOC, but changing to "deep" doesn't make sense either, as it will include all nested topic titles in the TOC.
Any hint? Thanks!
I took a reference from here:https://www.oxygenxml.com/doc/versions/ ... tents.html
and modify it like this:
/* Hide sections below level 2. */
*[class ~= "map/topicref"][is-chapter] >
*[class ~= "map/topicref"][is-chapter] >
*[class ~= "map/topicref"]:not([is-chapter]) >
*[class ~= "map/topicref"] >
*[class ~= "map/topicref"] {
display: none;
}
It doesn't work.
And I also tried with the following generic css rules:
.toc-entry.toc-h1,
.toc-entry.toc-h2
{
display: block;
}
.toc-entry.toc-h3,
.toc-entry.toc-h4,
.toc-entry.toc-h5,
.toc-entry.toc-h6
{
display: none;
}
They don't work either.
By the way, in the publishing template, I have the following parameter specified: <parameter name="args.css.param.numbering" value="shallow"/>. Being shallow means to have only level 1 topic titles included in the TOC, but changing to "deep" doesn't make sense either, as it will include all nested topic titles in the TOC.
Any hint? Thanks!
-
- Posts: 39
- Joined: Mon Jul 25, 2022 11:18 am
Re: how to limit the toc depth to 2 (css-based PDF)
Post by andrei_pomacu »
Hi,
In order to have shallow numbering and in TOC be displayed level 1 and level 2, use this CSS rule which i have created using CSS debugging topic.
I was looking to the elements which need to be hide, level 3 and below and saw that the class on that element is "map/topicref".
The I was looking to the rule that styles the parent of that element and find *[class ~= "map/topicref"][is-chapter]:not([is-part]) > *[class ~= "map/topicref"]:not(is-chapter).
I combined this 2 element to create a rule which will display:none any element that is children of the parent element and contains topicref.
Regards,
Andrei
In order to have shallow numbering and in TOC be displayed level 1 and level 2, use this CSS rule which i have created using CSS debugging topic.
I was looking to the elements which need to be hide, level 3 and below and saw that the class on that element is "map/topicref".
The I was looking to the rule that styles the parent of that element and find *[class ~= "map/topicref"][is-chapter]:not([is-part]) > *[class ~= "map/topicref"]:not(is-chapter).
I combined this 2 element to create a rule which will display:none any element that is children of the parent element and contains topicref.
Code: Select all
*[class ~= "map/topicref"][is-chapter]:not([is-part]) > *[class ~= "map/topicref"]:not(is-chapter) > *[class ~= "map/topicref"]{
display: none;
}
Andrei
-
- Posts: 115
- Joined: Mon Jul 10, 2023 11:49 am
Re: how to limit the toc depth to 2 (css-based PDF)
Thanks Andrei, it doesn't work, was it because I didn't include these rules within @media print {} , or is it a must to claim the usage by specifying @media and print?
-
- Posts: 39
- Joined: Mon Jul 25, 2022 11:18 am
Re: how to limit the toc depth to 2 (css-based PDF)
Post by andrei_pomacu »
Hi,
Could you sent me your CSS customization file on our support email, support@oxygenxml.com ?
I will to try to debug it in order to see why the rule that I gave you is not working.
Regards,
Andrei
Could you sent me your CSS customization file on our support email, support@oxygenxml.com ?
I will to try to debug it in order to see why the rule that I gave you is not working.
Regards,
Andrei
-
- Posts: 115
- Joined: Mon Jul 10, 2023 11:49 am
Re: how to limit the toc depth to 2 (css-based PDF)
Hi Andrei,
I've sent an email to the support account with subject starts with "To Andrei:". Also, the attachment includes a sample project which I used for testing yesterday.
Thank you!
Regards,
Galano
I've sent an email to the support account with subject starts with "To Andrei:". Also, the attachment includes a sample project which I used for testing yesterday.
Thank you!
Regards,
Galano
Return to “DITA (Editing and Publishing DITA Content)”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service