Inhibit line breaks in element attribute and force to generate end tag for empty element

Post here questions and problems related to editing and publishing DITA content.
tmakita
Posts: 114
Joined: Fri Apr 08, 2011 7:58 am

Inhibit line breaks in element attribute and force to generate end tag for empty element

Post by tmakita »

Here are very important requests from one of my big user. The user uses Git as their DITA store because he hates CCMS infrastructure. He checkout the topics by theme and apply Java batch processing to remove Oxygen tracking change processing instruction. After that he push the result to the remote and in the next stage, he merges it to master branch.
The problem is that the topics in the branch are normalized as the result of above batch processing. This sometimes causes merge conflict with other merge results.
  • Line breaks (or white spaces) inside the element are removed even if Oxygen insert them.
  • Empty elements are normalized such as <p/>
Their requests are summarized into two points.
  • How to force Oxygen not to insert white-spaces in the element start tag?
  • How to avoid empty tags and force Oxygen to produce start tag and end tag?
Here is example of <image> authoring. There are line-breaks inside image start tag. We do want to remove unconditionally in Oxygen setting.

Code: Select all

<fig>
    <title>Fig that contains images</title>
    <figgroup>
        <image placement="break"
            href="images_%E5%9F%BA%E6%9C%AC%E8%A8%AD%E8%A8%88%E6%9B%B8%E2%91%A0/2014-05-06-09.08.52.jpg"
            width="300" align="center" id="image_jdh_4hv_12c">
            <alt></alt>
        </image>
    </figgroup>
</fig>
Hope someone respond this question!
--
/*--------------------------------------------------
Toshihiko Makita
Development Group. Antenna House, Inc. Ina Branch
Web site:
http://www.antenna.co.jp/
http://www.antennahouse.com/
--------------------------------------------------*/
Radu
Posts: 9343
Joined: Fri Jul 09, 2004 5:18 pm

Re: Inhibit line breaks in element attribute and force to generate end tag for empty element

Post by Radu »

Hi Toshihiko,
What do you mean by "and apply Java batch processing to remove Oxygen tracking change processing instruction"?
Do you mean the client applies an Oxygen specific action? If so what is this action? Or does the client apply their own batch processing?
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
tmakita
Posts: 114
Joined: Fri Apr 08, 2011 7:58 am

Re: Inhibit line breaks in element attribute and force to generate end tag for empty element

Post by tmakita »

What do you mean by "and apply Java batch processing to remove Oxygen tracking change processing instruction"?
Do you mean the client applies an Oxygen specific action? If so what is this action? Or does the client apply their own batch processing?
Sorry insufficient explanation. As you mentioned "Java batch processing" is their own processing done by GitLab CI processing.
--
/*--------------------------------------------------
Toshihiko Makita
Development Group. Antenna House, Inc. Ina Branch
Web site:
http://www.antenna.co.jp/
http://www.antennahouse.com/
--------------------------------------------------*/
Radu
Posts: 9343
Joined: Fri Jul 09, 2004 5:18 pm

Re: Inhibit line breaks in element attribute and force to generate end tag for empty element

Post by Radu »

Hi Toshihiko,

So coming back to the questions:
How to force Oxygen not to insert white-spaces in the element start tag?
How to avoid empty tags and force Oxygen to produce start tag and end tag?
Is the fact they are using a custom Github action which changes files related to Oxygen in any way?
Or is the question more about how Oxygen serializes the XML documents when saving them in the Author visual editor mode? If so there are a bunch of format and indent settings in the Oxygen Preferences->"Editor / Format / XML" page, for example "Expand empty elements". And also in the "Editor / Edit Modes / Author / Serialization" page.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
tmakita
Posts: 114
Joined: Fri Apr 08, 2011 7:58 am

Re: Inhibit line breaks in element attribute and force to generate end tag for empty element

Post by tmakita »

If so there are a bunch of format and indent settings
Thank you I will try it!
--
/*--------------------------------------------------
Toshihiko Makita
Development Group. Antenna House, Inc. Ina Branch
Web site:
http://www.antenna.co.jp/
http://www.antennahouse.com/
--------------------------------------------------*/
tmakita
Posts: 114
Joined: Fri Apr 08, 2011 7:58 am

Re: Inhibit line breaks in element attribute and force to generate end tag for empty element

Post by tmakita »

"Expanding empty elements" works fine.

Code: Select all

<p></p>
But I cannot find any option setting to disable inserting line breaks inside element start.

Code: Select all

<image align="center"
         href="images_%E5%9F%BA%E6%9C%AC%E8%A8%AD%E8%A8%88%E6%9B%B8%E2%91%A0/2014-09-18-12.41.41.jpg"
         id="image_md5_wxv_12c" placement="break" width="250">
         <alt></alt>
</image>
Do you have any solution?
--
/*--------------------------------------------------
Toshihiko Makita
Development Group. Antenna House, Inc. Ina Branch
Web site:
http://www.antenna.co.jp/
http://www.antennahouse.com/
--------------------------------------------------*/
Radu
Posts: 9343
Joined: Fri Jul 09, 2004 5:18 pm

Re: Inhibit line breaks in element attribute and force to generate end tag for empty element

Post by Radu »

Hi Toshihiko,

I do not have a solution which would not generate possible side effects.
In the Preferences->"Editor / Edit Modes / Author / Schema-Aware" page there is a setting "Schema aware normalization, format and indent" checked by default. This means Oxygen looks at the DTD or XML Schema attached to the topic when serializing XML content. This means that for example it detects <image> being element-only which means Oxygen considers that it can add indentation and line breaks inside it without any problems.
If this setting would be unchecked, this would generate various changes in the way in which Oxygen serializes the XML content. So I do not suggest unchecking this setting.
How about if we turn the problem around and ask the people who created the batch processing GitHub action to keep the XML document as close as possible to how it was when saved in Oxygen?

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
tmakita
Posts: 114
Joined: Fri Apr 08, 2011 7:58 am

Re: Inhibit line breaks in element attribute and force to generate end tag for empty element

Post by tmakita »

This means that for example it detects <image> being element-only which means Oxygen considers that it can add indentation and line breaks inside it without any problems.
I found next setting works like a charm!
Image
The authoring result.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
<topic id="topic_dtp_hhv_12c">
<title>Image Authoring Test</title>
<body>
<fig>
<title>Fig that contains images</title>
<figgroup>
<image align="center" href="images_%E5%9F%BA%E6%9C%AC%E8%A8%AD%E8%A8%88%E6%9B%B8%E2%91%A0/2014-05-06-09.08.52.jpg" id="image_jdh_4hv_12c" placement="break" width="300">
<alt></alt>
</image>
<image align="center" href="images_%E5%9F%BA%E6%9C%AC%E8%A8%AD%E8%A8%88%E6%9B%B8%E2%91%A0/2014-09-18-12.41.41.jpg" id="image_md5_wxv_12c" placement="break" width="250">
<alt></alt>
</image>
<image align="center" href="images_%E5%9F%BA%E6%9C%AC%E8%A8%AD%E8%A8%88%E6%9B%B8%E2%91%A0/20141117_141540.jpg" id="image_pln_m4w_12c" placement="break" width="250"></image>
</figgroup>
</fig>
<p>P after image.</p>
<p></p>
<p></p>
<fig id="fig_owy_v4w_12c">
<title>2つ目のFig</title>
<figgroup>
<image align="center" href="images_%E5%9F%BA%E6%9C%AC%E8%A8%AD%E8%A8%88%E6%9B%B8%E2%91%A0/2013-05-18-14.31.04.jpg" id="image_lvz_y4w_12c" placement="break" width="250">
<alt></alt>
</image>
</figgroup>
</fig>
</body>
</topic>
I will consult with the user whether this setting is acceptable for them.
Thank you for your suggestion.
Regards,
Attachments
2025-01-16_New.png
2025-01-16_New.png (62.4 KiB) Viewed 244 times
--
/*--------------------------------------------------
Toshihiko Makita
Development Group. Antenna House, Inc. Ina Branch
Web site:
http://www.antenna.co.jp/
http://www.antennahouse.com/
--------------------------------------------------*/
Post Reply