Disable indention feature in author mode

Having trouble installing <oXygen/>? Got a bug to report? Post it all here.
Ken
Posts: 6

Disable indention feature in author mode

Thu Dec 18, 2008 5:51 am

Hi,

I understand that in the text mode, if I turn off the indention option, my xml would not get indented, but in author mode, whenever I try to insert a new element, my whole xml get auto indented. I want to preserve my original format of my xml. Is there any way to turn off this auto indention option in author mode???
Dan
Posts: 221

Re: Disable indention feature in author mode

Fri Dec 19, 2008 6:29 pm

When switching to the Text mode (or when saving), the XML is indented in conformity with the rules from the CSS and the xml:space attributes.

If the CSS specifies for an element that is white-space preserve:

elem{
white-space:pre;
}

then all the whitespaces from the element will remain unchanged, so the element won't be indented.
The same is true for elements having the attribute xml:space='preserve'.

Best regards,
Dan Caprioara
Ken
Posts: 6

Re: Disable indention feature in author mode

Tue Dec 23, 2008 5:10 am

If I use preserve space in css for author view, it will affect how my author view will look like. Isn't there a option in format and indent option that disable the indendation feature just like in text view???
Dan
Posts: 221

Re: Disable indention feature in author mode

Tue Dec 23, 2008 4:11 pm

At this time there is no option for disabling the indentation of the documents saved from the author mode.

When an XML file is loaded in the Author mode, all the spaces are normalized, depending on the xml:space attributes and the white-space:pre CSS property. All the whitespaces between elements with the display:block are discarded and the initial indent is lost. When the document is saved, the editor will try to pretty print it in conf. with the rules above and the XML formatting options.

Do you have a problem with the indent size, or with the fact that the editor is saving the document on multiple lines?

For instance, if the loaded document is:

Code: Select all

<block> <block>Some <inline/> and other <inline/></block> </block>


The author mode will save it as (considering indent=2):

Code: Select all

<block>
  <block>Some <inline/> and other <inline/></block>
</block>


Do you need it to be saved as:

1. Indent zero, but with newlines depending on the associated display:block

Code: Select all

<block>
<block>Some <inline/> and other <inline/></block>
</block>


Or as:

2. Indent zero, and no additional newlines?

Code: Select all

<block><block>Some <inline/> and other <inline/></block></block>

Many regards,
Dan
Ken
Posts: 6

Re: Disable indention feature in author mode

Mon Jan 05, 2009 2:02 pm

Hi,

I need it to be save as what it is loaded initally.

Example:
Loaded xml : <block> <block>Some <inline/> and other <inline/></block> </block>
Saved xml : <block> <block>Some <inline/> and other <inline/></block> </block>

Their format should be the same, because after I open up the author mode to edit, it will auto indent for and lastly when I save, the xml file will be indented which I do not want.

Thanks,
Ken
Dan
Posts: 221

Re: Disable indention feature in author mode

Mon Jan 05, 2009 6:35 pm

Thank you for the reply!

This can be solved by implementing a new whitespace policy in oXygen. It should consider the whitespaces between blocks as being significant - but not showing them at all - and keeping them into the document model. This can be done, but it rises other problems.

What would be the desired behavior when inserting a new block? Should the editor insert automatically some spaces before and after the block? What spaces these should be - spaces, tabs, new lines? Or how it would be possible to insert spaces between blocks (if they will not be visible at all)?

That is why I consider the xml:space=preserve to be the correct approach. You will be able to edit/see all that is significant into the document including the whitespaces.

Many regards,
Dan
Monika
Posts: 4

Re: Disable indention feature in author mode

Wed Jan 21, 2009 5:10 pm

Hi,

we work with several authors on the same XML file. Therefore we need to be able to do a diff between two versions that reflects just what has been changed.
The author pretty printer is costing us great efforts to actually find minimal changes since it points out changes in whitespaces between the originally created file and another version that was saved in author mode.

We need to have a two fold solution:
1) optimum format and indent rules that are easy for everybody to just import: I have not found any such topic on how to save format and indent rules to an external file, please hep
2) turn off the pretty printer in author mode since that will hinder us from finding real changes by flooding us with whitespace changes and line breaks. Terrible work.

Can you help, please? xml:spaces="preserve" in the root element of the page makes the document invalid and does not work.

Thanks
Dan
Posts: 221

Re: Disable indention feature in author mode

Thu Jan 22, 2009 10:57 am

Hello Monika,

The number of differences between versions of the same file can be minimized by imposing the same set of formatting options when saving the file, for all the content authors.

oXygen supports options at the project level. So the solution is:

1. Create a project file.
2. Change the settings from:

Options/Preferences/Editor/Format/ and
Options/Preferences/Editor/Format/XML

to match your preferences, and then select the radio button: "Project Options" from each of the two settings page.

3. Save the project file and commit it to your versioning system so all the content authors can use it.

4. Load in author mode, make a change and then save all the XML files you are editing currently. In this way all of them will be formatted according to the project settings. Commit them to the repository. When other authors will change the files, only the changed paragraphs will be displayed in your diff tool.

Let me know if you need more help,
Regards,
Dan
Monika
Posts: 4

Re: Disable indention feature in author mode

Thu Jan 22, 2009 3:44 pm

Hi,

thank you for the instructions. Does this mean, however, that we all have to use the Oxygen .xpr format to work with the project? Not all authors want to work with Oxygen, so that will be difficult.
Is there a way to work with project settings without using the .xpr Project?

Also, we work in three different repositories (SVN) since three different books in DocBook are produced. All of the must work with the same project settings so that editors, who are common to all three projects, do not have to change project settings every time.

It would be ideal to be able to save settings independently of the .xpr and then to tell all authors to import them, no matter which project they work in.

Thanks.
Dan
Posts: 221

Re: Disable indention feature in author mode

Thu Jan 22, 2009 4:57 pm

In case all authors use oXygen they should use a common .xpr file, or have the same formatting options.

In case some of the authors are using other tools, I am afraid there is no simple solution. You could try to apply a formatting XSL stylesheet over the XML documents before commiting them to the repository, to ensure a standard format that is not depending on the editing tool.

Regards,
Dan
Monika
Posts: 4

Re: Disable indention feature in author mode

Fri Jan 23, 2009 4:25 pm

Dan, thanks again. I tried to follow you instructions: created project-specific settings and saved them to the .xpr. Then I loaded one of the files in editor mode, formatted with the project-specific rules, switched to author mode, made a change in a sentence, saved. Opened the file up again in editor mode and the format was destroyed again by some default formatting.

Am I doing something wrong or does the author mode formatting simply override my project-specific settings?
Dan
Posts: 221

Re: Disable indention feature in author mode

Fri Jan 23, 2009 4:37 pm

The author mode formats the XML taking also into account the CSS display rules. For instance two consecutive elements having inline display will be placed on the same line. The formatting action from the text editing mode does not take this kind of information into account, so the results may differ.

We are using internally for documentation the Author mode of oXygen. We imposed a simple rule. Before commiting the files, we simply save them from the Author mode, even if they were modified in Text (we switch to Author and save).

Anyway, we will try to make the formatting to be consistent across Text and Author editing modes.

Many regards,
Dan
Monika
Posts: 4

Re: Disable indention feature in author mode

Fri Jan 23, 2009 4:42 pm

Hi,

I thought so. Could you give us an estimate when such harmonization would be available? We have been looking for diffing tools but also have not had any luck.
Since we are trying to make Oxygen a company-wide standard, it would greatly help to provide a good solution for this very common problem.

Thanks
Dan
Posts: 221

Re: Disable indention feature in author mode

Mon Jan 26, 2009 11:12 am

Hello,

It is scheduled for 10.3. (probably in the summer months)
Regards,
Dan
Radu
Posts: 5226

Re: Disable indention feature in author mode

Mon Aug 16, 2010 3:46 pm

Hi,

Starting from Oxygen 11.2 by default the Author page only formats and indents the newly inserted/modified XML content leaving the unchanged content intact. Also, both the Author and Text pages take into account information from the associated schema when format and indent is applied.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
jelovirt
Posts: 85
Location: Helsinki, Finland

Re: Disable indention feature in author mode

Thu Jun 28, 2012 9:57 am

Using version 14 and if I change a single word in author mode (DITA shortdesc element), the XML is indented. Is there a preference to disable this?

The problem is that when Git diffs become difficult to read when the actual change is only a single word, but the whole element content gets intended and whitespace-normalized. Even if I use Oxygen Diff with Git, seeing the difference is difficult.
Radu
Posts: 5226

Re: Disable indention feature in author mode

Thu Jun 28, 2012 10:24 am

Hi Jarno,

The default behavior of Oxygen, specified in the Preferences->"Editor / Edit modes / Author" page is to "Format and indent - only the modified content".
So if this option is checked for you only the edited shortdesc should be indented and line wrapped when you save the topic.

We do not have an option to entirely preserve all spaces in the XML document.
If you want to avoid Oxygen making hard line wraps, in the Preferences Editor / Format page you could increase the line width to a very large value.
If you want to keep all spaces untouched, in the page Editor / Format / XML you could add the topic element to the Preserve space list or mark it as "white-space:pre" from the CSS used for rendering:

OXYGEN_INSTALL_DIR/frameworks/dita/css_classed/dita.css

What we do with our user guide to avoid such problems is that all of us are working on it using an SVN-shared project ".xpr" which has fixed indent and line width options saved in it (you can save Preference pages at project level).

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

Return to “Common Problems”

Who is online

Users browsing this forum: No registered users and 2 guests