Question about Format and Indent

Questions about XML that are not covered by the other forums should go here.
Eddie
Posts: 89

Question about Format and Indent

Fri Apr 03, 2015 10:36 am

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: 5213

Re: Question about Format and Indent

Fri Apr 03, 2015 11:13 am

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: 89

Re: Question about Format and Indent

Mon Apr 06, 2015 2:42 am

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: 5213

Re: Question about Format and Indent

Mon Apr 06, 2015 8:48 am

Hi Eddie,

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

http://www.oxygenxml.com/doc/ug-editor/index.html#topics/preferences-editor-format-xml.html

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

Return to “General XML Questions”

Who is online

Users browsing this forum: No registered users and 1 guest