Page 1 of 1
Author mode - reformatting during save
Posted: Tue Aug 25, 2009 1:20 pm
by honyk
Hello,
I am quite confused with autoformat when saving document in Author mode. In my docbook document (v4.4) there is bookinfo element with title, releaseinfo and corpname elements. If file is opened in text mode and Format and Indent action is applied, bookinfo, title, releaseinfo and corname elements are on separate lines. If view is switched into Author mode, slight change is made and this document is saved, all four elements are 'inline', i.e. one follows another, they are not on separate lines. In css style all these elements are specified as blocks and I really don't know by what this is driven - I've thought it is according 'display' property in css style (inline/block). It is interesting that other elements in bookinfo like address and legalnotice behaves properly. Is there any explanation of this?
Thanks in advance.
Jan
Re: Author mode - reformatting during save
Posted: Tue Aug 25, 2009 3:13 pm
by sorin_ristache
Hello,
honyk wrote:In css style all these elements are specified as blocks and I really don't know by what this is driven - I've thought it is according 'display' property in css style (inline/block).
Do you use Oxygen 10.3? The DocBook elements
releaseinfo and
corpname have
display:inline. In what CSS did you see that they are specified as block?
The display property is applied when saving the document or when switching to Text mode.
honyk wrote:If view is switched into Author mode, slight change is made and this document is saved, all four elements are 'inline', i.e. one follows another, they are not on separate lines.
I am sorry, I cannot reproduce the problem. After a save in Author mode or after a switch from Author mode to Text mode the elements are not on the same line as you see below. I have the maximum length limit for a line of text set to 1000 characters.
Code: Select all
<book>
<bookinfo><title>Book Template Title</title>
<releaseinfo>Some info.</releaseinfo>
<corpname>Corp name.</corpname>
<address>The address.</address><legalnotice>
<para>Legal notice.</para>
</legalnotice><author>
<firstname>Author First Name</firstname>
<surname>Author Last Name</surname>
</author></bookinfo>
<part>
<title>First Part </title>
<chapter>
<title>Chapter Title</title>
<sect1>
<title>Section1 Title</title>
<para>Text modif.</para>
</sect1>
</chapter>
</part>
</book>
What do you have inside
bookinfo after save or switch to Text mode?
Regards,
Sorin
Re: Author mode - reformatting during save
Posted: Tue Aug 25, 2009 4:48 pm
by honyk
There must be some mistake on my side, but I can't locate it. This is result after saving your source in Author mode:
Code: Select all
<book>
<bookinfo><title>Book Template Title</title><releaseinfo>Some info.</releaseinfo><corpname>Corp
name.</corpname>
<address>The address.</address><legalnotice>
<para>Legal notice.</para>
</legalnotice><author>
<firstname>Author First Name</firstname>
<surname>Author Last Name</surname>
</author></bookinfo>
<part>
<title>First Part </title>
<chapter>
<title>Chapter Title</title>
<sect1>
<title>Section1 Title</title>
<para>Text modif.</para>
</sect1>
</chapter>
</part>
</book>
And here is code after Format & Indent of source (after switching saved document from Author mode):
Code: Select all
<book>
<bookinfo>
<title>Book Template Title</title>
<releaseinfo>Some info.</releaseinfo>
<corpname>Corp name.</corpname>
<address>The address.</address>
<legalnotice>
<para>Legal notice.</para>
</legalnotice>
<author>
<firstname>Author First Name</firstname>
<surname>Author Last Name</surname>
</author>
</bookinfo>
<part>
<title>First Part </title>
<chapter>
<title>Chapter Title</title>
<sect1>
<title>Section1 Title</title>
<para>Text modif.</para>
</sect1>
</chapter>
</part>
</book>
This second result is exactly what is defined in my css (I've modified original css and set some inline elements to be displayed as block). For example releaseinfo element is specified there twice:
Code: Select all
line 2583:
releaseinfo {
display: inline;
}
line 3850:
releaseinfo {
display: block;
}
This kind of overriding is used several times and it works properly. If the first part (inline specification) is commented, the result is the same.
Is css inline/block settings really used for saving in Author mode?
Re: Author mode - reformatting during save
Posted: Tue Aug 25, 2009 5:18 pm
by sorin_ristache
honyk wrote:(I've modified original css and set some inline elements to be displayed as block). For example releaseinfo element is specified there twice:
Code: Select all
line 2583:
releaseinfo {
display: inline;
}
line 3850:
releaseinfo {
display: block;
}
This kind of overriding is used several times and it works properly. If the first part (inline specification) is commented, the result is the same.
Is css inline/block settings really used for saving in Author mode?
You have to look at the
bookinfo element. If it has
display:block the save action of Author mode applied this CSS property correctly.
Regards,
Sorin
Re: Author mode - reformatting during save
Posted: Tue Aug 25, 2009 5:40 pm
by honyk
'bookinfo' and 'bookinfo > title' have both set display:block. It is strange

Re: Author mode - reformatting during save
Posted: Wed Aug 26, 2009 10:41 am
by honyk
I've restored css to original one. It works better, but there is also one difference in bookinfo/title. In your example at the top title is just after bookinfo element while in css all titles are specified as block:
Code: Select all
title,
subtitle,
titleabbrev {
color:#002244;
background-color:inherit;
display:block;
margin:0.3em 0;
}
I think some my changes of css make it worse, but I suspect it is Oxygen who doesn't process css file properly...
Re: Author mode - reformatting during save
Posted: Wed Aug 26, 2009 2:30 pm
by sorin_ristache
honyk wrote:I've restored css to original one. It works better, but there is also one difference in bookinfo/title.
Do you get different formatting in Text mode inside
bookinfo when you switch from Author mode to Text mode and the default CSS (no customizations) of the DocBook document type (that comes with Oxygen) is associated with the XML document? What formatting do you get?
honyk wrote:I think some my changes of css make it worse, but I suspect it is Oxygen who doesn't process css file properly...
Do you mean Author mode does not display the XML document as specified in the CSS associated with the XML document? Please give an example. If you load the same XML file with the same CSS in a Web browser it is displayed in the same way.
Regards,
Sorin
Re: Author mode - reformatting during save
Posted: Wed Aug 26, 2009 3:29 pm
by honyk
I probably don't know mechanism of wrapping elements during saving well. I've thought if element is specified in css as block, it will always begin on separate line (be wrapped). What I am trying to express is if bookinfo > title is defined as block element, why it is saved in form of
instead of
Code: Select all
<bookinfo>
<title>My title</title>
I am surprised, that if Format & Indent action is performed, title is on separate line, but if then small change is made in Author mode and such document is saved, title is again just after bookinfo element (the first case above).
Visually everything is correct in Author mode, title is really on separate line. My question is all about source appearance after save from Author mode and difference between this and Format & Indent result.
Re: Author mode - reformatting during save
Posted: Wed Aug 26, 2009 5:57 pm
by sorin_ristache
The difference is that when the document is saved in Author mode the CSS display property of the parent element is also important. Element bookinfo has display:block; and does not have a preserve white-space property so the spaces are stripped but because bookinfo has some inline child elements the formatting (inserting newline between bookinfo and title) is not done. Inline elements must be preserved. Maybe we should set in the default CSS for DocBook documents all child elements of bookinfo with display:block so that bookinfo can be formatted as in Text mode.
Regards,
Sorin
Re: Author mode - reformatting during save
Posted: Wed Aug 26, 2009 6:33 pm
by honyk
Dear Sorin,
thank you very much for this answer, it helped me lot in my understanding this problem. Now it is clear as day. I think it is not necessary to set all bookinfo elements into block, some of them are better inline. Important for me is the fact that we should insist on saving our document in Author mode, or in Text mode, but without previous applying Format & Indent action. With these rules we can eliminate changes not related to the content itself if Diff between both versions is applied.
Thanks again for your patience.
Jan