jelovirt / pdf-generator

DITA-OT PDF plug-in generator
https://dita-generator.elovirta.com/
Apache License 2.0
12 stars 5 forks source link

sub-topics are not numbered #6

Open norweis opened 8 years ago

norweis commented 8 years ago

When having topics at the end of a topic file (within the topic file, not within the map file), their headings are not numbered, although I checked "title numbering" on all Heading n formats. But sub-topic are influenced by the Heading n formats, e.g. Italics and fonts for sub-topics works, only numbering does not work.

PS: in our application, we generate DITA files dynamically, and it would be difficult to generate seperate files for each topic in these cases.

therealmrcharly commented 7 years ago

This is something I'm interested in - I, too have this as a desired feature. It impacts output from .MD (markdown) as well as from DITA files. The standard way of producing numbering counts from the map.

An approach was suggested on the DITA list, but I lack the knowledge to implement it:

  1. Create a copy of $map where you decorate the topicref elements with section numbers (for example, <topicref id="xyz" ... sect-number="2.3.1">. Use a dedicated template mode to do this. For example,

    This should contain all of the numbers that can be derived directly from non-reltable, linking topicrefs that are outside of frontmatter. At this point, you still will not have accounted for the nested topics.
  2. Enhance the mode="section-numbers" topicref template so that it will process each corresponding topic in the stage1! .xml file. In other words, find the topic element with the matching @id and create topicref nodes in variable number-tree for it and each of its topic descendants. Make sure to populate @sect-number and to copy @id.

  3. Define a xsl:key

  4. Use $number-tree with the key:

    Notice that the $number-tree variable is being used in key() as the content source.