Page 1 of 1
How to modify built-in code fragments?
Posted: Fri Sep 22, 2023 6:40 pm
by Frank Ralf
Hi,
When adding a new
<hazardstatement> element, Oxygen automatically adds the sub-structure like so:
Code: Select all
<hazardstatement>
<messagepanel>
<typeofhazard></typeofhazard>
<howtoavoid></howtoavoid>
</messagepanel>
</hazardstatement>
How/Where can I modify that code fragment to also include a
<consequence> element?
Best regards,
Frank
Re: How to modify built-in code fragments?
Posted: Mon Sep 25, 2023 9:27 am
by Radu
Hi Frank,
One option if you have a DITA DTD/RNG specialization would be to modify the schema and declare "consequence" as a required child of hazardstatement. Probably now it is declared as an optional child.
Another option would be to have a custom content completion configuration file:
https://www.oxygenxml.com/doc/versions/ ... ually.html
and declare inside it:
Code: Select all
<elementProposals path="hazardstatement" insertElements="hazardstatement consequence"/>
and yet another possibility, replace in the content completion window the "hazardstatement" element with a custom Author action:
https://blog.oxygenxml.com/topics/custo ... etion.html
Regards,
Radu
Re: How to modify built-in code fragments?
Posted: Mon Sep 25, 2023 11:40 am
by Frank Ralf
Hi Radu,
Thanks for the pointers. We don't want to touch the schema because even if we highly recommend to use the "consequence" element, we don't want to make it required. So we will go one of the other routes. I had already thought about the "Author Action" way but had forgotten about the custom content completion configuration file.
Best regards,
Frank
Re: How to modify built-in code fragments?
Posted: Mon Sep 25, 2023 4:55 pm
by Frank Ralf
Hi,
I created a custom configuration file
cc_config_ext.xml as described in
https://www.oxygenxml.com/doc/versions/ ... ually.html with the following content, which does the trick:
Code: Select all
<elementProposals path="messagepanel" insertElements="typeofhazard consequence howtoavoid" />
This creates the desired structure:
Code: Select all
<hazardstatement>
<messagepanel>
<typeofhazard />
<consequence />
<howtoavoid />
</messagepanel>
</hazardstatement>
Thanks again for your kind help!
Frank