Modifying DitaLinkTextResolver

Post here questions and problems related to editing and publishing DITA content.
Patrik
Posts: 280
Joined: Thu Nov 28, 2013 9:32 am
Location: Hamburg/Germany
Contact:

Modifying DitaLinkTextResolver

Post 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
mihaela
Posts: 490
Joined: Wed May 20, 2009 2:40 pm

Re: Modifying DitaLinkTextResolver

Post 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.
Mihaela Calotescu
http://www.oxygenxml.com
Patrik
Posts: 280
Joined: Thu Nov 28, 2013 9:32 am
Location: Hamburg/Germany
Contact:

Re: Modifying DitaLinkTextResolver

Post 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
mihaela
Posts: 490
Joined: Wed May 20, 2009 2:40 pm

Re: Modifying DitaLinkTextResolver

Post 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).
Mihaela Calotescu
http://www.oxygenxml.com
Patrik
Posts: 280
Joined: Thu Nov 28, 2013 9:32 am
Location: Hamburg/Germany
Contact:

Re: Modifying DitaLinkTextResolver

Post by Patrik »

OK, thanks.

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

Re: Modifying DitaLinkTextResolver

Post 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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply