How to customize appendix titles

gloryman21
Posts: 11
Joined: Mon Feb 18, 2019 10:07 am

How to customize appendix titles

Post by gloryman21 » Tue Mar 19, 2019 1:05 pm

Hello!
I'm using a dita-css-pdf transformation (deprecated) and dita bookmap.
I want the application to look like "A Appendix title 1", "B Appendix title 2"
How to customize the appendix titles in toc and in content?

Code: Select all

*[class ~= "map/map"] {
counter-reset: page 1
toc-appendixcount 0
appendixcount 0;
}
*[class ~= "bookmap/appendix"] *[class ~= "map/topicref"] {
counter-increment:toc-appendixcount;
}
*[class ~= "bookmap/appendix"] *[class ~= "map/topicref"] > *[class ~= "map/topicmeta"]:before {
content: counter(toc-appendixcount, upper-alpha) " ";
}
*[class ~= "bookmap/appendix"] > *[class ~= "topic/topic"]{
counter-increment:appendixcount;
}
*[class ~= "bookmap/appendix"] > *[class ~= "topic/topic"] > *[class ~= "topic/title"]:before {
content: counter(appendixcount, upper-alpha) " ";
}

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

Re: How to customize appendix titles

Post by Dan » Tue Mar 19, 2019 4:17 pm

Hello,

There are some counters that are managed already by the builtin CSS: toc-section1, section1.

You can use them like this:

Code: Select all



@namespace oxy "http://www.oxygenxml.com/extensions/author";

/* TOC */

/*
* Start with a cleanup: remove all befores for all topicrefs in the appendix, no matter the depth.
*/
*[class ~= "bookmap/appendix"] *[class ~= "map/topicref"] > *[class ~= "map/topicmeta"]:before {
content: none !important;
}

/*
* Add a :before only on the first level topicrefs in the appendix.
*
* Use the counter 'toc-section1' that is already* managed by the default CSS.
*/
*[class ~= "bookmap/appendix"] > *[class ~= "map/topicref"] > *[class ~= "map/topicmeta"]:before {
content: counter(toc-section1, upper-alpha) " " !important;
}

/* CONTENT */

/*
* Remove all befores for all titles of the topics in the appendix - main content.
* Please note that the oxy:topicref-class attribute is set on the topic from the content
* and contains the class value of the topicref that points to the current topic.
* We can use this to match the appendix element in the content.
*/
*[oxy|topicref-class ~= "bookmap/appendix"][class ~= "topic/topic"] > *[class ~= "topic/title"]:before,
*[oxy|topicref-class ~= "bookmap/appendix"][class ~= "topic/topic"] *[class ~= "topic/topic"] > *[class ~= "topic/title"]:before {
content: none !important;
}

/*
* Add a counter only on the first level titles in the appendix content.
*
* Use the counter 'section1' that is already* managed by the default CSS.
*/
*[oxy|topicref-class ~= "bookmap/appendix"][class ~= "topic/topic"] > *[class ~= "topic/topic"] > *[class ~= "topic/title"]:before {
content: counter(section1, upper-alpha) " " !important;
}
For other topics and help on customization, please see the documentation:
https://www.oxygenxml.com/doc/versions/ ... e_css.html

Many regards,
Dan

gloryman21
Posts: 11
Joined: Mon Feb 18, 2019 10:07 am

Re: How to customize appendix titles

Post by gloryman21 » Thu Mar 21, 2019 9:15 am

Thanks for the answer, Dan!

The counter section1 does not fit because it is used in numbering, and it is reset on each chapter.
I solved this problem by setting additional counters and using part of your code.

Thank You!

chrispitude
Posts: 79
Joined: Thu May 02, 2019 2:32 pm

Re: How to customize appendix titles

Post by chrispitude » Mon May 06, 2019 12:02 am

oxy|topicref-class is great for getting a handle on objects in the original bookmap hierarchy, but it doesn't seem to be honored by the browsers when previewing or debugging the intermediate HTML file. When I use it to apply styles, it's only reflected in the output PDF.

Is there a trick to getting the browsers to "see" oxy|topicref-class?

I'm setting the @media rendering to "print" in the browser, and I'm declaring the "oxy" namespace at the top of my CSS file.

Costin
Posts: 638
Joined: Mon Dec 05, 2011 6:04 pm

Re: How to customize appendix titles

Post by Costin » Mon May 06, 2019 4:25 pm

Hi Chris,

In our internal development stream, we improved this by implementing support for the "topicrefclass" attribute instead of "oxy:topicref-class", so the internet browsers should match it correctly.
The support will be implemented in the next release of oXygen / PDF Chemistry.

If you cannot wait until the next stable release, I could provide you access to an internal nightly build of the oXygen publishing engine, to test this out.
Please note that the nightly build is meant for testing and evaluation purposes only, it should not be used for production work, as it is not an official stable release.
Also, if you decide you want access to it, you should keep it confidential and use it at your own discretion for the purpose of testing specifically the features / improvements in discussion.

Regards,
Costin
Costin Sandoi
oXygen XML Editor and Author Support

Post Reply