Formatting the element content if preserving of white spaces

<oXygen/> general issues.
honyk
Posts: 166

Formatting the element content if preserving of white spaces

Wed Apr 29, 2009 5:34 pm

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

Re: Formatting the element content if preserving of white spaces

Wed Apr 29, 2009 5:39 pm

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

Re: Formatting the element content if preserving of white spaces

Wed Apr 29, 2009 5:53 pm

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

Re: Formatting the element content if preserving of white spaces

Thu Apr 30, 2009 8:26 am

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

Re: Formatting the element content if preserving of white spaces

Thu Apr 30, 2009 5:16 pm

Yes, it worked perfectly. Thanks a lot.

Return to “Other Issues”

Who is online

Users browsing this forum: No registered users and 5 guests