Page 1 of 1

Modifying DitaLinkTextResolver

Posted: Fri Nov 13, 2015 6:00 pm
by Patrik
Hi,

I'd like to adapt the text being generated for some special cases of referenced elements. Is there any way to adapt the existing code (probably of DitaLinkTextResolver.resolveElement() and/or DITAAccess.computeLinkText) to deal only with my special cases? Or will I have to re-implement the complete LinkTextResolver?

Thanks and regards,
Patrik

Re: Modifying DitaLinkTextResolver

Posted: Fri Nov 13, 2015 6:30 pm
by mihaela
Hi Patrik,

If you want to update the existing functionality offered by a built-in framework (DITA in your case) is best to create a framework extension rather than change the existing framework. In this way, you will benefit from the new functionality added to the base framework by each Oxygen versions and still use your customization.

So, to extend the DITA framework go to Oxygen -> Preferences -> "Document Type Association" page, select the "DITA" framework and press the "Extend" button placed underneath the list of document types. Save the new extension to an external location like OXYGEN_INSTALL_DIR/frameworks/dita_extended/dita_custom.framework.
In this extension you will be able to set your own implementation of DitaLinkTextResolver. You can start from the default DitaLinkTextResolver implementation and change the resolveReference(AuthorNode) method according to your needs.
The new implementation must be returned by the ro.sync.ecss.extensions.dita.DITAExtensionsBundle.createLinkTextResolver() method.

Re: Modifying DitaLinkTextResolver

Posted: Fri Nov 13, 2015 9:55 pm
by Patrik
Hi Mihaela,
my question was not about modifying part of a framework but about modifying part of the DitaLinkTextResolver.
I only want to modify the link text when the rerefenced element is of some special kind. Overriding the method resolveReference would mean that I have to implement all the functionality including identifying the referenced node, generating the link text for all other cases and caching the results.
So basically I'm wondering if there is some kind of extension point where I can override a method that takes the referenced node as input (instead of the referencing element).

Regards,
Patrik

Re: Modifying DitaLinkTextResolver

Posted: Mon Nov 16, 2015 11:52 am
by mihaela
Hi Patrik,

For the moment there is no other way than modifying a part of the DitaLinkTextResolver (you can extend the DitaLinkTextResolver and change only the resolveReference(AuthorNode) implementation).

Re: Modifying DitaLinkTextResolver

Posted: Mon Nov 16, 2015 10:48 pm
by Patrik
OK, thanks.

Patrik

Re: Modifying DitaLinkTextResolver

Posted: Mon Nov 16, 2015 11:14 pm
by Radu
Hi Patrik,

Maybe you could overwrite the method ro.sync.ecss.extensions.dita.link.DitaLinkTextResolver.resolveReference(AuthorNode) and delegate to the super implementation of the method whenever you are not doing anything special with the node.

Regards,
Radu