Question about Format and Indent

Questions about XML that are not covered by the other forums should go here.
Eddie
Posts: 106
Joined: Wed Dec 18, 2013 3:07 am

Question about Format and Indent

Post by Eddie »

Hello,

We have some (DITA) files which have nested <ul>s.
We want to display them as they are, which is like this:

Code: Select all


        <ul>
<li>List 1, Item 1.
<ul>
<li>List 2, Item 1.</li>
<li>List 2, Item 2.</li>
</ul>
</li>
<li>List 1, Item 2.</li>
But oXygen's Format and Indent moves the second <ul> up onto the end of the previous line and inserts a space, like this:

Code: Select all


        <ul>
<li>List 1, Item 1. <ul>
<li>List 2, Item 1.</li>
<li>List 2, Item 1.</li>
</ul> </li>
<li>List 1, Item 2.</li>
Is it possible to either modify Format and Indent so that the former layout is preserved or at least prevent that space being inserted?

(We have problems with formatting generally because we have files created in different editors. We're trying to come up with a single formatting that will be (relatively) easy to maintain whatever the file is edited in.)

I've tried fiddling around with the format settings, but so far, without success.

Cheers,

Eddie.
Radu
Posts: 9046
Joined: Fri Jul 09, 2004 5:18 pm

Re: Question about Format and Indent

Post by Radu »

Hi Eddie,

In the Preferences->Editor / Format / XML page there is an Indent inline elements checkbox which by default is checked. You probably unchecked it in your side, which leads to the behavior you mentioned.

In this particular case Oxygen considers based on the DITA DTDs that the <li> element has mixed content (allows both text content and tags) and thus considers the <ul> an inline tag inside it.
Whenever in an inline context if Oxygen finds spaces (or line breaks) between elements (like the space between the end </ul> and the end </li>) it will never remove them completely because it considers that at least one space must remain there, considering the space significant in mixed content.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Eddie
Posts: 106
Joined: Wed Dec 18, 2013 3:07 am

Re: Question about Format and Indent

Post by Eddie »

Hello Radu,
Thanks for the reply.

You're right, I have tried this with "Indent Inline Settings" cleared.
Just to be sure, can you confirm that the following is the correct behaviour?

Cheers,
Eddie.

Original. (Ideally, we'd like it to stay this way after formatting.)

Code: Select all


        <ul>
<li>List 1, Item 1.
<ul>
<li>List 2, Item 1.</li>
<li>List 2, Item 1.</li>
</ul>
</li>
<li>List 1, Item 2.</li>
</ul>
Ctrl+Shift+P with "Indent Inline Settings" checked.

Code: Select all


        <ul>
<li>List 1, Item 1. <ul>
<li>List 2, Item 1.</li>
<li>List 2, Item 1.</li>
</ul>
</li>
<li>List 1, Item 2.</li>
</ul>
Ctrl+Shift+P with "Indent Inline Settings" cleared.

Code: Select all


        <ul>
<li>List 1, Item 1. <ul>
<li>List 2, Item 1.</li>
<li>List 2, Item 1.</li>
</ul> </li>
<li>List 1, Item 2.</li>
</ul>
Radu
Posts: 9046
Joined: Fri Jul 09, 2004 5:18 pm

Re: Question about Format and Indent

Post by Radu »

Hi Eddie,

Right, exactly, it's also explained in our user's manual:

http://www.oxygenxml.com/doc/ug-editor/ ... t-xml.html

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