Printing the topichead DITA element in HTML body

70 views
Skip to first unread message

AJ Côté

unread,
Nov 19, 2019, 10:28:33 AM11/19/19
to DITA-OT Users
I customize a HTML5 plugin (based on DITA 3.4) and I want to generate a single HTML page for my ditamap. I use the chunk="to-content" in <map> to generate that single HTML page.

The problem I have: The HTML5 plugin uses the <topichead> navtitle only when the table-of-content is generated (or for the HTML <nav> section). Within the HTML <body> part, the section names are not printed.
In the temporary directory, I found that the topichead's classes are "map/topicref" (same for topicref) and "mapgroup-d/topichead". However, the plugin fetch the title from the single dita files, not from the ditamap.

Someone has an idea?

Julio Vazquez

unread,
Nov 20, 2019, 6:46:32 AM11/20/19
to DITA-OT Users
Topichead is specifically a navigation only conduct and does not generate a file. To achieve what you want, use a title only topic as the parent of the other topics.

AJ Côté

unread,
Nov 21, 2019, 2:34:29 AM11/21/19
to DITA-OT Users
I agree with you that DITA described the <topichead> element is for a navigation purpose. However, when the PDF plugin is used, these titles are printed in the PDF.

I already tried to replace the <topichead> by <topicref> (without .dita file), but for the HTML5 plugin, this does not work. The intermediary .dita file in the temporary folder (I use chunk=to-content) does not contains these titles.

Julio Vazquez

unread,
Nov 21, 2019, 6:38:34 AM11/21/19
to AJ Côté, DITA-OT Users
Then there's a bug. You should get a single HTML file in the output folder with that title as the top level. What version of the OT are you using?

On Thu, Nov 21, 2019, 2:34 AM AJ Côté <ander...@gmail.com> wrote:
I agree with you that DITA described the <topichead> element is for a navigation purpose. However, when the PDF plugin is used, these titles are printed in the PDF.

I already tried to replace the <topichead> by <topicref> (without .dita file), but for the HTML5 plugin, this does not work. The intermediary .dita file in the temporary folder (I use chunk=to-content) does not contains these titles.

--
You received this message because you are subscribed to a topic in the Google Groups "DITA-OT Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dita-ot-users/q2R9ht9X7_4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to dita-ot-user...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/dita-ot-users/2fdeb53e-48af-443c-b909-160ef2177e62%40googlegroups.com.

Julio Vazquez

unread,
Nov 21, 2019, 6:40:00 AM11/21/19
to AJ Côté, DITA-OT Users
I take that back. You need a .dita file with a title element to get the result you want. 

AJ Côté

unread,
Nov 22, 2019, 6:21:03 AM11/22/19
to DITA-OT Users
This is what I've done.

I added a target in my build.xml doing a pre-processing job: It creates a dummy .dita for each <topichead>, convert the <topichead> elements for <topicref> and add a href attribute to the new dummy file.


Le jeudi 21 novembre 2019 12:40:00 UTC+1, Julio Vazquez a écrit :
I take that back. You need a .dita file with a title element to get the result you want. 

On Thu, Nov 21, 2019, 6:38 AM Julio Vazquez <juli...@gmail.com> wrote:
Then there's a bug. You should get a single HTML file in the output folder with that title as the top level. What version of the OT are you using?

On Thu, Nov 21, 2019, 2:34 AM AJ Côté <ander...@gmail.com> wrote:
I agree with you that DITA described the <topichead> element is for a navigation purpose. However, when the PDF plugin is used, these titles are printed in the PDF.

I already tried to replace the <topichead> by <topicref> (without .dita file), but for the HTML5 plugin, this does not work. The intermediary .dita file in the temporary folder (I use chunk=to-content) does not contains these titles.

--
You received this message because you are subscribed to a topic in the Google Groups "DITA-OT Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dita-ot-users/q2R9ht9X7_4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to dita-o...@googlegroups.com.

Julio Vazquez

unread,
Nov 22, 2019, 6:57:40 AM11/22/19
to AJ Côté, DITA-OT Users
I suspect that your processing may be coming after the OT builds its file list. You may need to move that processing earlier in the preprocessing step, or at least move the portion that generates the file names. 

May I ask what your objection is to having a title only topic?

To unsubscribe from this group and all its topics, send an email to dita-ot-user...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/dita-ot-users/1b7b28f3-38b9-4fb0-8748-7a050847e3c5%40googlegroups.com.

AJ Côté

unread,
Nov 22, 2019, 9:16:37 AM11/22/19
to DITA-OT Users
 
You may need to move that processing earlier in the preprocessing step

I plugged my pre-processing target through the "depend.preprocess.pre" extension. However, the problem I have now is to find a way to override the args.input parameter value (I know, it is insane, but org.dita.base read that parameter without possibility to override it through another parameter).

Since my preprocess target write a new ditamap (aside of the current ditamap), and that new ditamap contains new href (i.e. new dita files to add to the chunk), this must be done at the beginning of the dita process. The "depend.preprocess.pre" add my target as the first executed by the org.dita.base plugin (ditaot-preprocess target). The idea behind that method is to create a temporary ditamap with the patched elements to help the pluging to interpret the ditamap as it should.


May I ask what your objection is to having a title only topic?

It is non-sense to maintain a .dita file while it don't have a real payload. Having the title in the ditamap is the good way to have less files to maintain. Since the PDF and the OOXML plugins output that correctly (by using the navtitle as a section title), it proves this is the way to do it.

AJ Côté

unread,
Nov 22, 2019, 9:43:42 AM11/22/19
to DITA-OT Users

I have now is to find a way to override the args.input parameter value (I know, it is insane, but org.dita.base read that parameter without possibility to override it through another parameter).

I solved my "args.input" problem by creating a new "args.inputmap" parameter.
- In org.dita.base, I changed every "args.input" for "args.inputmap"
- In my plugin, I declared both "args.input" and "args.inputmap" as <param>

P.S.: The whole dita-ot folder is under GIT repository, so I track my changes.

So, after my preprocess did its thing: it set args.inputmap with the filepath of the new ditamap, and then, the whole dita-ot process works as expected. My outputted HTML is as I want now.

However, a latter objective would be to customize the chunk process itself, but I prefer to stop there for now.
Reply all
Reply to author
Forward
0 new messages