Formatting the element content if preserving of white spaces

Oxygen general issues.
honyk
Posts: 176
Joined: Wed Apr 29, 2009 4:55 pm

Formatting the element content if preserving of white spaces

Post by honyk »

Hello Everyone,

if there are used literal elements in my DocBook document I would expect their content untouched if Format and Indent button is pressed. If content is too long and contains spaces, it is wrapped. As in the next processing of literal element content the white spaces are preserved, there are unwanted spaces in the output.

Can be such behaviour changed somehow or I must avoid using Format button?

The following change of default docbook.css style to

Code: Select all

literal {
font-family:monospace;
white-space:pre; // this line was added
}
doesn't automatically wrap literal content if it is edited in visual mode (so it could be default docbook setting I think), but there is no influence on the result of Format and Indent button.

Is there any solution. Do I something wrong?
Thanks in advance.

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

Re: Formatting the element content if preserving of white spaces

Post by Radu »

Hi Jan,

This should do it:

Code: Select all


literal {
font-family:monospace;
white-space:pre-wrap; // wraps visually but does not format and indent
}
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
honyk
Posts: 176
Joined: Wed Apr 29, 2009 4:55 pm

Re: Formatting the element content if preserving of white spaces

Post by honyk »

Thanks for quick reply. I've tested it but without success - it seems like the same bahaviour as using 'pre' value. Switching from visual to source mode keeps line not wrapped, but after Format function it still gets wrapped. I hope we understand one to another.
Radu
Posts: 9049
Joined: Fri Jul 09, 2004 5:18 pm

Re: Formatting the element content if preserving of white spaces

Post by Radu »

Hi,

Sorry for the misunderstanding.
So you are pressing the "Format and Indent" button and want the "literal" tag content to be preserved.
Just go to the Options->Preferences->Format->XML page. There is a list of "Preserve space elements" and you can add "literal" or any other Docbook tag name as an entry there. After that, "Format and Indent" should not touch "literal" anymore.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
honyk
Posts: 176
Joined: Wed Apr 29, 2009 4:55 pm

Re: Formatting the element content if preserving of white spaces

Post by honyk »

Yes, it worked perfectly. Thanks a lot.
Post Reply