Page 1 of 1

workaround to CSS @counter-style

Posted: Fri Oct 12, 2018 1:21 pm
by Bruno.Ballarin
I am under the impression that the rule @counter-style is not supported (yet?) in dita framework CSSs.

I understand this rule would allow (when supported) to modify the rendering of a counter from the default numeric suite 0 1 2 ... to (for instance) a literal suite A B C.

Would there be a workaround to this feature like for instance being able to test the value of a counter and use the result of the test to render one or another hard coded character. For prefixing appendix titles for instance I would only need A B and C since we likely not have more than 3 appendix main sections.

Cheers,

Bruno

Re: workaround to CSS @counter-style

Posted: Fri Oct 12, 2018 1:37 pm
by Radu
Hi Bruno,

I'm not sure exactly what your CSS looks like.
A possible solution is something like:

Code: Select all

:root{
counter-reset:appendixCounter;
}

appendix {
counter-increment:appendixCounter;
}

appendix title:before {
content:"Appendix " counter(appendixCounter, upper-alpha) ": ";
}
Regards,
Radu

Re: workaround to CSS @counter-style

Posted: Mon Oct 15, 2018 8:45 am
by Bruno.Ballarin
Thank you very much Radu.

It does precisely what I was looking for :-).

Cheers,

Bruno

Re: workaround to CSS @counter-style

Posted: Mon Oct 15, 2018 9:42 am
by Radu
Hi Bruno,

Thanks for the confirmation. We'll probably add a similar improvement to the CSSs bundled by default in Oxygen for DocBook editing support.

Regards,
Radu