Page 1 of 1

Customizing dmmCustomizeTopicTitlesAndIcons

Posted: Sat Sep 28, 2019 2:07 pm
by Edomonndo
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

Re: Customizing dmmCustomizeTopicTitlesAndIcons

Posted: Mon Sep 30, 2019 11:30 am
by Radu
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

Re: Customizing dmmCustomizeTopicTitlesAndIcons

Posted: Tue Oct 01, 2019 2:26 pm
by Edomonndo
Hi Radu,

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

Re: Customizing dmmCustomizeTopicTitlesAndIcons

Posted: Wed Feb 19, 2020 8:58 am
by Radu
Hi,

As an update about this:
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
in our recent release of Oxygen 22 we added this new API method:

ro.sync.ecss.extensions.api.node.AuthorNode.getContentIterator()

to allow iteration over a node's text contents.

Regards,
Radu