Plugin Dita - possible to modify referenced content?

Post here questions and problems related to editing and publishing DITA content.
JustinH
Posts: 1
Joined: Tue Mar 22, 2022 12:01 pm

Plugin Dita - possible to modify referenced content?

Post by JustinH »

Hello everyone,

I thought about creating plugin that makes changes to the text in referenced content of dita files from the file that uses the content.
I have read "how to extend oXygen" and think what I want to do would be a Workspace Access Plugin Extension.
But the documentation states that:
This type of plugin allows you to contribute actions to the main menu and toolbars, create custom views, interact with the application workspace, make modifications to opened documents, and add listeners for various events.
And since the files that contain the content with the refs - might not be opened I fear that then I will not be able to change this content from the file which is referencing. Do you know if referenced content generally can be changed from the file that is referencing another? Do you maybe know a plugin that can do that or have a link to some sample code?

Thanks for your help beforehand!
image.png
You do not have the required permissions to view the files attached to this post.
Radu
Posts: 9473
Joined: Fri Jul 09, 2004 5:18 pm

Re: Plugin Dita - possible to modify referenced content?

Post by Radu »

Hi Justin,

We investigated in the past providing such a feature directly in Oxygen. This is not trivial to achieve, conrefs may be nested inside each other, when you make the change you want to change only a small portion of the conreffed XML document and leave the rest as it is, so we did not invest further time in this. With enough time and human resources this could probably be implemented, but I estimate it would take a lot of time to do this.
Right now when you right click inside a conreffed content you have an "Edit Reference" contextual action which takes you directly to the place where you should edit.

So could this be done with a plugin? A Java-based Oxygen plugin could also load and modify other XML resources, not necessarily the ones opened in Oxygen. Sometime in Oxygen 24.0 we added support to load in-memory the content of an XML document and make changes to it.
But right now conrefs are read-only in the Author visual editor, you would need to also provide a custom CSS to overwrite our read-only content styles, find precisely what needs to be changed in the referenced file when the conreffed content gets edited, then decide when you want the referenced file to be modified and changed on disk, whenever any trivial change is made in the opened topic (on each pressed character) or maybe when the original document gets saved. Again this is not impossible but I would estimate somebody maybe working 1-2 months on this to make it work in all cases.

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