Customizing dmmCustomizeTopicTitlesAndIcons

Post here questions and problems related to oXygen frameworks/document types.
Edomonndo
Posts: 4
Joined: Sat Sep 28, 2019 1:38 pm

Customizing dmmCustomizeTopicTitlesAndIcons

Post by Edomonndo » Sat Sep 28, 2019 2:07 pm

Hi,

I want to customize DITA map manager view based on dmmCustomizeTopicTitlesAndIcon posted on https://github.com/oxygenxml/wsaccess-j ... le-plugins.

My requirements are following:
  1. The displayed title text is computed without some specific element such as "title/data."
  2. If a chapter references submap, then do not render number prefix. The title of a child topicref in the submap is rendered as like the topicref referenced by chapter. (The submap should only have one topicref as child.)
  3. The conditional attributes specialized from @props and its value are also rendered without coding these attributes directly.
Could you give me a help?

Thanks,
Edomonndo

Radu
Posts: 6539
Joined: Fri Jul 09, 2004 5:18 pm

Re: Customizing dmmCustomizeTopicTitlesAndIcons

Post by Radu » Mon Sep 30, 2019 11:30 am

Hi,

I will assume you are using as a staring point this Javascript-based plugin which calls our Java-based API to customize the rendering:

https://github.com/oxygenxml/wsaccess-j ... sAccess.js

Please see some suggestions below:
The displayed title text is computed without some specific element such as "title/data."
On the "customizeComputedTopicrefTitle" callback function you receive the "defaultComputedTitle" (the title Oxygen computes by default) and the "targetTopicOrMap" variable which is the target document parsed as an AuthorNode tree:

https://www.oxygenxml.com/InstData/Edit ... rNode.html

Once you gain access to the root element:

Code: Select all

rootElement = targetTopicOrMap.getRootElement();
from that root element using the "getContentNodes()" method you can iterate its child nodes and find the <title> element:

https://www.oxygenxml.com/InstData/Edit ... tNode.html

In this structure of AuthorNode's the text is stored separtely in a large text buffer, like in the image here:

https://www.oxygenxml.com/InstData/Edit ... rNode.html

Unfortunately you only have access to the "getTextContent()" method for the title element which returns all the text from all sub elements. I will add an internal issue to add some more API for what you need.
If a chapter references submap, then do not render number prefix. The title of a child topicref in the submap is rendered as like the topicref referenced by chapter. (The submap should only have one topicref as child.)
On the same "DITAMapNodeRendererCustomizer.customizeComputedTopicrefTitle(AuthorNode, AuthorNode, String)" callback:

https://www.oxygenxml.com/InstData/Edit ... mizer.html

the received "topicref" element has both "getParent()" and "getContentNodes()" methods allowing you to identify this particular case.
The conditional attributes specialized from @props and its value are also rendered without coding these attributes directly.
Again on the "customizeComputedTopicrefTitle" API callback once you gain access to the root element:

Code: Select all

rootElement = targetTopicOrMap.getRootElement();
you can request the value of the "domains" attribute something like this:

Code: Select all

rootElement.getAttribute("domains").getValue();
https://www.oxygenxml.com/InstData/Edit ... ng.String-

You will need to parse that value and if the DITA specialization is properly done you will find in that value all definitions for extra profiling attributes contributed by the DITA specification:

https://www.oxygenxml.com/dita/1.3/spec ... te-domains

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Edomonndo
Posts: 4
Joined: Sat Sep 28, 2019 1:38 pm

Re: Customizing dmmCustomizeTopicTitlesAndIcons

Post by Edomonndo » Tue Oct 01, 2019 2:26 pm

Hi Radu,

Thank you for your support! I'll try the coding.

Post Reply