"Format and Indent" damages markup

Oxygen general issues.
sampablokuper
Posts: 22
Joined: Tue Apr 08, 2008 1:41 pm

"Format and Indent" damages markup

Post by sampablokuper »

Suppose I have the following code in a <p> element in an XHTML document:

Code: Select all

... blah blah, <a href="a_long_url_linking_to_my_source"><cite>Title of the source I'm citing</cite></a>, blah blah ...
If I use Oxygen's "Format and Indent" function, it ends up as:

Code: Select all

... blah blah, <a
href="a_long_url_linking_to_my_source">
<cite>Title of the source I'm citing</cite>
</a>, blah blah ...
Notice that the original code is marked up so that there is no space between the citation and the comma that follows it. The "Format and Indent" function does not respect this, and inserts whitespace, which comes through when the document is viewed in a browser.

Is there currently a way to use the "Format and Indent" function without it damaging my markup in this way? If not, then I guess this is a bug in Oxygen.

Thanks,

Sam
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Re: "Format and Indent" damages markup

Post by george »

Hi Sam,

You can add either

Code: Select all


xml:space="preserve"
on the a element

or

you can go to Options->Preferences -- Editor -- Format -- XML and add a in the Preserve space elements list. Eventually you can add on the same preference page but in the Strip space elements list an entry containing a/cite that will allow oXygen to break cite content on multiple lines if needed.

Best Regards,
George
George Cristian Bina
sampablokuper
Posts: 22
Joined: Tue Apr 08, 2008 1:41 pm

Re: "Format and Indent" damages markup

Post by sampablokuper »

Thanks, George :)
sampablokuper
Posts: 22
Joined: Tue Apr 08, 2008 1:41 pm

Re: "Format and Indent" damages markup

Post by sampablokuper »

Hi folks,

I've been using Options->Preferences -- Editor -- Format -- XML to change the Preserve space elements list, as George suggested, and although it helps somewhat, I find it creates a different problem: the contents of elements added to this list no longer wrap, so I end up with unreadably long lines.

What I want is for Oxygen to detect, for a given list of elements, series of opening tags or series of closing tags of those elements that have no spaces between them, and to preserve these "lacks of spaces". All else should be indented as usual. In other words, if elem0, elem1, elem2 and elem3 were all elements on this list, this:

Code: Select all

<elem0><elem1 property="foo"><elem2><elem3 property="A very long attribute for the sake of example">An even longer sentence, again, just for the sake of a reasonable demonstration</elem3></elem2></elem1>, which continues here.</elem0>
would be formatted as, when I execute auto format and indent:

Code: Select all

<elem0><elem1 property="foo"><elem2><elem3
property="A very long attribute for the sake of example">An
even longer sentence, again, just for the sake of a reasonable
demonstration</elem3></elem2></elem1>, which continues
here.</elem0>
Now, I realise there is probably some flexibility about where I would specify which elements are in the list of elements to be treated as I've described above. Presumably I could do this in the schema, or in the document (i.e. in each opening tag of the relevant elements), or perhaps in Oxygen's settings.

Given that I'm working with documents into which I'm not permitted to add new kinds of markup, and that the schema I'm using is under similar restrictions, the third option would be best for me for the time being. I would be grateful for advice about how to go about making it work.

Many thanks in advance,

spk
Post Reply