Page 1 of 1

Empty lines in Author mode

Posted: Thu Dec 17, 2015 2:52 pm
by friedemann_bach
Dear Forum,

I have an issue with blank lines which appear the Author mode. I have some data sets that look like this:

Code: Select all


<sectionA>
<subElementA>Content</subElementA>
<subElementA>Content</subElementA>
<subElementA>Content</subElementA>
</sectionA>
<sectionB>
<subElementB>Content</subElementB>
<subElementB>Content</subElementB>
<subElementB>Content</subElementB>
</sectionB>
Now, for the Author mode, I have configured my CSS for both elements exactly in the same way (checked with CSS Inspector), and the elements of both sections are regularly and identically formatted. It still happens in the Author mode that the subElements of sectionB are rendered differently than sectionA: all subElementB are separated by lines that contain whitespace, and in those whitespace lines the cursor appears in vertical position, while sectionA does not display those lines inbetween, and the cursor, if placed between the subElements, appears horizontally. I could not find out how to solve this. Is there any way to influence or predict this behaviour?

Re: Empty lines in Author mode

Posted: Thu Dec 17, 2015 3:29 pm
by Radu
Hi,

Usually in the Author editing mode Oxygen tries to remove whitespaces (including new lines) which occur in the XML between block-level elements.
Usually such a decision is made based on the information from the CSS (for example the CSS can specify that an element is space preserve), information from the schema (DTD, XML Schema or Relax NG schema) associated to the XML (for example the schema can state that a certain element is space preserve) or information coming from the Oxygen Preferences (we have lists of space preserve elements in the Preferences->Editor / Format / XML page.

More about this here:

https://www.oxygenxml.com/doc/versions/ ... t-xml.html

So I'm not sure why this issue occurs in your case. If you can set up a small project with a sample XML, a schema and a CSS you can send it to support@oxygenxml.com and we'll take a look at it.

Regards,
Radu

Re: Empty lines in Author mode

Posted: Thu Dec 17, 2015 4:46 pm
by friedemann_bach
Hi Radu,

thank you very much for your answer. Following your hints, I figured out that this behaviour was caused by the schema: <sectionA> may contain no mixed content, while <sectionB> does. In my CSS, I set white-space to -oxy-trim-when-ws-only on <sectionB>, which solved the problem. Thanks again! :D

Re: Empty lines in Author mode

Posted: Wed Sep 21, 2016 5:47 am
by Graham Hannington
I have the same issue (XML Author 17.1, build 2015102718).

For example, Author mode shows blank lines between <p> elements in <context> elements in DITA task topics.

It's distracting.

The blank lines don't appear in Text mode, and they don't get saved.

I don't want to have to make per-element tweaks to fix this.

Radu, as I think you're aware, I'm using Oxygen packaged in a "workbench" created by a third party. I think this behavior should be fixed at that level; in that package. Can you do something to make that happen? Your thoughts?

Re: Empty lines in Author mode

Posted: Wed Sep 21, 2016 2:17 pm
by Radu
Hi Graham,

I need some screenshots with how the XML looks like in the Text and Author editing modes.
You can also send them via email to support@oxygenxml.com.

Regards,
Radu

Re: Empty lines in Author mode

Posted: Wed Oct 12, 2016 12:13 pm
by friedemann_bach
Hi Radu,

I have another issue concerning this topic. In some documents, the empty lines described above reappear frequently on opening the document, while pressing "F5" always resolves the problem. Is it possible to configure Oxygen Editor in a way that pressing F5 is not necessary? Or, is there a CSS property that should be used in another way to fix this? I use different styles -- maybe it is an issue with reloading the stylesheets?

Re: Empty lines in Author mode

Posted: Wed Oct 12, 2016 2:13 pm
by Radu
Hi Torsten,

If you can provide some samples (XML+CSS) to test with using our support email address support@oxygenxml.com I could try to look into this.

Regards,
Radu

Re: Empty lines in Author mode

Posted: Tue Jun 27, 2017 6:36 pm
by friedemann_bach
Sorry to re-open an old question, but it seems that I have resolved this issue. In my case, I found out that the problem occurs when a style that sets some elements to "display:none" is used. When switching to another style in which those elements are displayed, all these elements and their descendants are set to "white-space:normal", even if it is defined differently in CSS or LESS for a descendant, and the infamous empty lines appear. Using F5, the white-space property of the descendants adopt correctly to the stylesheet definitions and the empty lines disappear. Is this a bug? However, an effective workaround for this problem is to define white-space property for all critical descendants in all styles, even where they are set to "display:none". This worked fine for me so far in Oxygen 18.1.

Re: Empty lines in Author mode

Posted: Wed Jun 28, 2017 9:17 am
by Radu
Hi,

So:
Using F5, the white-space property of the descendants adopt correctly to the stylesheet definitions and the empty lines disappear. Is this a bug?
Oxygen uses information from the associated Schema and CSS to decide if whitespaces between elements can be normalized for display.
But it does this only when the XML is fully loaded (first load or pressing F5 to reload it). It does not do this when changing CSS layers because it's time consuming, it implies changing the loaded content and also because usually layers are used for styling various XML elements differently so it's more lightweight not to do this when changing layers.
So you probably found a good workaround.
By the way, does the edited XML have an associated schema (DTD, XML Schema, Relax NG)? Because if it does usually Oxygen can use the schema to determine such information instead of relying too heavily on the CSS.

Regards,
Radu

Re: Empty lines in Author mode

Posted: Wed Jun 28, 2017 10:42 am
by friedemann_bach
Yes, I also work with Relax NG, and if possible, I try to avoid CDATA in the critical elements. That works fine, too. I am working with a predefined schema (TEI P5), and sometimes it would require complicated changes to prohibit CDATA just to avoid the empty lines. In that case, it is easier to work with CSS/LESS. Thanks you for all your hints, and best regards!