Auto-insertion of p in entry when new table is inserted - WEB AUTHOR

Post here questions and problems related to editing and publishing DITA content.
mu258770
Posts: 157
Joined: Mon Aug 18, 2014 4:11 pm

Auto-insertion of p in entry when new table is inserted - WEB AUTHOR

Post by mu258770 »

Hi team,

This is also regarding oXygen 19.1 Web Author customization.

When I insert a CALS table using toolbar icon, I should be able to get <entry> element with <p> inside. ie I want to add content inside <p> only, not directly in <entry>. Currently I will get table with <entry> elements only. I have configured cc_config.xml to get <p> element when we insert a new <entry> using content completion. But this will work only if I insert a new <entry> using content completion.

In the eclipse client, we made it work by using dita.framework. Same change does not work here.

Could you please let me know how we can make it work in the oXygen Web Author 19.1.

Regards,
Shabeer
mihaela
Posts: 490
Joined: Wed May 20, 2009 2:40 pm

Re: Auto-insertion of p in entry when new table is inserted - WEB AUTHOR

Post by mihaela »

Hi Shabeer,

What you can do is to create a custom insert table operation[1] that inserts the entry elements with paragraph inside.
A second possibility is to create a plugin [2] for Web Author where you can set an ro.sync.ecss.extensions.api.AuthorDocumentFilter [3] to modify all the empty entry elements inserted in the document, to include a paragraph.

[1] Creating and Embedding a Custom Action in the Web Author Interface
[2] Customizing Web Author with Plugins
[3] AuthorDocumentFilter documentation

Best Regards,
Mihaela
Mihaela Calotescu
http://www.oxygenxml.com
cristi_talau
Posts: 496
Joined: Thu Sep 04, 2014 4:22 pm

Re: Auto-insertion of p in entry when new table is inserted - WEB AUTHOR

Post by cristi_talau »

Hello,

Another alternative is to extend the DITA framework [1], and create a new version of InsertTableOperation[2] that also inserts a paragraph inside each cell. The code sample can be found below

Code: Select all

import ro.sync.ecss.extensions.api.ArgumentsMap;
import ro.sync.ecss.extensions.api.AuthorAccess;
import ro.sync.ecss.extensions.api.AuthorOperationException;
import ro.sync.ecss.extensions.api.WebappCompatible;
import ro.sync.ecss.extensions.api.webapp.WebappRestSafe;

@WebappCompatible(false)
@WebappRestSafe
public class MyInsertTableOperation extends InsertTableOperation {
@Override
public void doOperation(AuthorAccess authorAccess, ArgumentsMap args)
throws AuthorOperationException {

ArgumentsMap args2 = new ArgumentsMap() {

@Override
public Object getArgumentValue(String argumentName) {
if (argumentName.equals(CELL_FRAGMENT_ARGUMENT_NAME)) {
return "<p/>";
}
return args.getArgumentValue(argumentName);
}
};
super.doOperation(authorAccess, args2);
}
}
Then, in the "web/framework.js" file of the DITA framework you can replace "ro.sync.ecss.extensions.dita.topic.table.InsertTableOperation" with the fully qualified name of your operation.

Best,
Cristian

[1] https://www.oxygenxml.com/doc/versions/ ... aring.html
[2] https://www.oxygenxml.com/doc/versions/ ... a-api.html
Post Reply