Unwanted line breaks

Questions about XML that are not covered by the other forums should go here.
janaostyn
Posts: 1
Joined: Thu Apr 10, 2014 2:44 pm

Unwanted line breaks

Post by janaostyn » Thu Apr 10, 2014 3:02 pm

Hi,

When I look at my topics in Text mode, it seems like oXygen added unnecessary line breaks to the text:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE reference PUBLIC "-//OASIS//DTD DITA Reference//EN" "reference.dtd">
<reference id="reference_ngc_m43_2n" xml:lang="en-gb">
<title>Grilling under the Dome</title>
<refbody>
<section><note type="restriction" id="note_jtb_cbz_ym" product="black">This information only
applies to models <keyword>Optima</keyword> and <keyword>Major</keyword>. Models
<keyword>Basic</keyword> and <keyword>Arena</keyword> cannot be equipped with a
<keyword>Dome</keyword>. </note><note type="restriction" product="color inox">This
information only applies to models <keyword>Optima</keyword> and
<keyword>Major</keyword>. Model <keyword>Arena</keyword> cannot be equipped with a
<keyword>Dome</keyword>. </note>To use your appliance to its full potential, you can
equip it with a <keyword>Dome</keyword>. The <keyword>Dome</keyword> is a half-open,
shell-shaped lid that reflects the heat of the charcoal back onto the food. As a result,
your food is heated from the bottom and from the top. This allows you, amongst others,
to evenly cook large pieces of meat, to prepare beer canned chickens and even to grill
pizzas.<note>Use <keyword>Dome</keyword> 223.0043.000 for model
<keyword>Optima</keyword> and <keyword>Dome</keyword> 223.0050.000 for model
<keyword>Major</keyword>. For more information on the <keyword>Dome</keyword>, refer to
<xref href="http://www.barbecookexperience.com" format="html" scope="external"
>www.barbecook.com</xref>.</note></section>
</refbody>
</reference>
These line breaks cause trouble during translation. Is it possible to remove them?

Thx,

Jana

Radu
Posts: 6498
Joined: Fri Jul 09, 2004 5:18 pm

Re: Unwanted line breaks

Post by Radu » Thu Apr 10, 2014 4:38 pm

Hi Jana,

By default when saving XML documents in the Author visual editing mode Oxygen will add new lines in changed XML elements and break the lines of text after a certain number of characters.
This is covered in more detail here:

http://www.oxygenxml.com/doc/ug-oxygen/ ... dling.html

The obtained XML is equivalent with the original XML because the normalized text is still the same. So I consider this as a bug in the translation software.

Anyway, if you want to inhibit this default behavior you can go to the Oxygen Preferences->Editor / Format page you can check the "Use zero-indent" checkbox + increase the "Line width" value from "100" to a very high number. This will avoid breaking the text lines.

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

Eddie
Posts: 106
Joined: Wed Dec 18, 2013 3:07 am

Re: Unwanted line breaks

Post by Eddie » Thu Mar 26, 2015 7:45 am

Hello,

Is there a maximum value for this setting?
I've tried well past the maximum pre-set value of 1000 and it just seems to keep going.

Cheers,

Eddie

Radu
Posts: 6498
Joined: Fri Jul 09, 2004 5:18 pm

Re: Unwanted line breaks

Post by Radu » Thu Mar 26, 2015 9:32 am

Hi Eddie,

The maximum value for the line width is the maximum integer value possible on the platform, usually something like in the order of two billion characters per line 2147483647.

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

Patrik
Posts: 231
Joined: Thu Nov 28, 2013 9:32 am
Location: Hamburg/Germany
Contact:

Re: Unwanted line breaks

Post by Patrik » Thu Mar 26, 2015 2:29 pm

An alternative would be to add the xml:space attribute with fixed or default value 'preserve' to the schema on the note-element.

For my own document type derived from dita I did this for any element that can contain text content - which are quite a lot. (But I wrote my own xml schema anyway, so it was very easy.)

However, when using the standard dita schema you should really consider an adaption of the transformation - as Radu already mentioned. You'd simply need to use the function normalize-space before interpreting the text content.

Regards,
Patrik

Radu
Posts: 6498
Joined: Fri Jul 09, 2004 5:18 pm

Re: Unwanted line breaks

Post by Radu » Thu Mar 26, 2015 2:58 pm

Hi Patrik,

There seems to be two major use cases when it comes to space-preserving content after it is edited in the Author mode:

1) Some want to have space preserve at block level. So they still want line breaks between paragraphs but they want the actual paragraph content to appear on one line. So they would use a very large line width format setting. Usually they also want zero indent.

2) Others want the entire document on one line. This would mean setting the root element as space preserve either from the CSS, list of space preserve elements or by setting xml:space on the root element.

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

marcus_s
Posts: 8
Joined: Tue Mar 19, 2019 6:52 pm

Re: Unwanted line breaks

Post by marcus_s » Tue Mar 26, 2019 11:13 am

Hi,
I ran into exactly the same problem. I've created plenty of DITA files by using the author mode and the code looks like this:

Code: Select all

           <step>
<cmd>Navigate to the intended <uicontrol>Advanced Logging Settings</uicontrol>
tab.</cmd>
<stepresult>For cluster-wide settings, open <uicontrol>Logging</uicontrol> |
<uicontrol>Cluster Wide Settings</uicontrol> in the System Management
navigation bar, then change to the <uicontrol>Advanced Logging
Settings</uicontrol> tab.<p id="d12e1159">For application server-specific
settings, select the intended application server and open the
<uicontrol>Advanced Logging Settings</uicontrol> tab.</p></stepresult>
</step>
This makes it almost unusable in our translation memory system, since every line is displayed in an individual row.

I already set the line width, but it doesn't change anything for existing files.

Is there any way to clean this up automatically?
I also tried some beautifier tools, but without success so far.

Regards,
Marcus

sorin_carbunaru
Site Admin
Posts: 248
Joined: Mon May 09, 2016 9:37 am

Re: Unwanted line breaks

Post by sorin_carbunaru » Tue Mar 26, 2019 4:49 pm

Hello Marcus,

After setting the desired option values in the "Editor / Format" preferences page, you can call the "Format and Indent Files" action from the "Project" view (see https://www.oxygenxml.com/doc/versions/ ... odes2.html). It can be run on an entire hierarchy of directories.

All the best wishes,
Sorin Carbunaru
oXygen XML

marcus_s
Posts: 8
Joined: Tue Mar 19, 2019 6:52 pm

Re: Unwanted line breaks

Post by marcus_s » Wed Mar 27, 2019 4:38 pm

Worked perfectly. Thanks!

Post Reply