Bug 86846 - EDITING: Add code window to expose and directly edit XML with validation
Summary: EDITING: Add code window to expose and directly edit XML with validation
Status: RESOLVED WONTFIX
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: Other All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: needsDevEval
Depends on:
Blocks: 101772
  Show dependency treegraph
 
Reported: 2014-11-29 12:58 UTC by Dr. Matthias Weisser
Modified: 2016-09-12 10:24 UTC (History)
10 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dr. Matthias Weisser 2014-11-29 12:58:05 UTC
It is possible writing text and formatting this using F11. Also cut & paste from different sources can be done. Unfortunately sometimes the code is getting changed in a way that the behavior of the following text is not as intended. It can be time consuming finding out why this is so. 

If there is a possibiliy there so have a look at the source code format problems can be seen more quickly. They can be changed directly in the code window. 

Such a code window has been used in dream weaver 4. Its very easy using this. The code is much better then. Problems are easy to see and correct. 

The feature request consists of:
Implementation of a code window - may be at the place of the status line. This could be switched on and off. The code where the cursor is will be shown and can be edited. Change of code will be able to see immediately in the normal text.
Comment 1 Jean-Baptiste Faure 2014-12-06 21:34:29 UTC
How do you handle styles in such a code window? I suggest you to have a look at what is really an OpenDocument file. To do that, take some .odt file, rename it as .zip and open it in your preferred archive manager software. The text of your document is managed in content.xml and styles are in styles.xml.

Best regards. JBF
Comment 2 Dr. Matthias Weisser 2014-12-07 10:46:49 UTC
Dear Jean Baptiste. I agree that the code in content.xml looks rather chaotic. But parts of it are quite easy to read and to understand. For example this clearly can be understood:  

<text:p text:style-name="Standard">Vorbemerkung des Verlags:</text:p> 
  <text:p text:style-name="Standard">Dieses Buch dient der Information. Das Gesagte ist nicht als Therapieempfehlung oder Ersatz professioneller medizinischer Behandlung bei gesundheitlichen Beschwerden zu verstehen.</text:p> 
  <text:p text:style-name="P64" /> 
  <text:p text:style-name="P64" /> 
  <text:p text:style-name="P64" /> 
  <text:p text:style-name="P64" /> 

<text:h text:style-name="P323" text:outline-level="2">Besser überleben trotz Krebs</text:h> 
- <text:p text:style-name="Standard">
  Am Ende des zweiten Weltkriegs litten die meisten Krankenhauspatienten an Lungenentzündung. Es dauerte nicht lange, bis sich die Bakterien so weit vermehrt hatten, dass sie von den Lungen ins Blut gelangten. Das Fieber stieg auf 40.5°C. Wenn die Haut dabei trocken und heiß blieb starb das Opfer. Schwitzen bedeutete die Rettung. Die Chance zu überleben lag bei etwa 50%. Fast 100000 Amerikaner starben jedes Jahr, bis dann Hilfe kam durch Penicillin in Form eines weißen Pulvers 
- <text:note text:id="ftn61" text:note-class="footnote">
  <text:note-citation>61</text:note-citation> 
- <text:note-body>
  <text:p text:style-name="Footnote">Becker, Seldon: „The body electric“ S.17f</text:p> 
  </text:note-body>
  </text:note>

For me it would be helpful seeing this in a window and being able to edit. Sometimes its much easier seeing this code instead of clicking through a lot of menues. 

There is another issue for this which seems to be of value: Bug 34002. For Word there is a tool "CrossEyes" for detecting/fixing problems in code not so easy to be seen without such a tool. Productivity seems to be improved that way.
Comment 3 Robinson Tryon (qubit) 2015-01-03 17:06:29 UTC
(In reply to Dr. Matthias Weisser from comment #0)
> If there is a possibiliy there so have a look at the source code format
> problems can be seen more quickly. They can be changed directly in the code
> window. 

Sounds like you want to add Reveal Codes (bug 34002).

> The feature request consists of:
> Implementation of a code window - may be at the place of the status line.
> This could be switched on and off. The code where the cursor is will be
> shown and can be edited. Change of code will be able to see immediately in
> the normal text.

Ayup.

(In reply to Dr. Matthias Weisser from comment #2)
> There is another issue for this which seems to be of value: Bug 34002.

So is this a dupe of bug 34002, or something different?

Status -> NEEDINFO

(please change status back to UNCONFIRMED after replying)
Comment 4 Dr. Matthias Weisser 2015-01-04 11:22:47 UTC
I agree that Reveal Codes (bug 34002) sounds useful. But this must not be the same implementation as intended here. It might differ.

My feeling is that just having a window showing the "Code" and having the possibility of changing this will be useful as a first step. 

In addition to this - a Reveal Code feature might be implemented. 

So I see 2 steps of implementation:
1. having this window to see and change source code (I would prefer that).
2. having a feature quickly showing formatting like "Reveal Code" and being able to modify easily. A "Crossed Eyes" feature might be of value. I did not work with it until now. So hard to tell for me how convenient this is.

Having implemented point 1 it would be more easy finding out about the code that LO produces and how to influence and change this to a more useful code. So I feel having point 1 implemented would help getting better code.
Comment 5 Robinson Tryon (qubit) 2015-01-11 01:12:55 UTC
(In reply to Dr. Matthias Weisser from comment #4)
> I agree that Reveal Codes (bug 34002) sounds useful. But this must not be
> the same implementation as intended here. It might differ.

Ok

> My feeling is that just having a window showing the "Code" and having the
> possibility of changing this will be useful as a first step. 

Editing the XML directly sounds kind of cool, but I imagine that it will be much harder to do (correctly) than editing HTML by hand. For success, I'd suggest that such an enhancement only be added in conjunction with a validator, to ensure that whatever a user does by hand is confirmed to be correctly formatted before we go back to the WYSIWYG environment.

Status -> NEW
Comment 6 Dr. Matthias Weisser 2015-01-12 10:51:17 UTC
Thank you Robinson !

Yes - editing XML seems to be more complex compared to the html that I am doing manually. Therefore having some help for doing correctly would be appreciated.

Often there are same formats used in a text. Seems to be that LO often does not see that but open up a new format. This makes the code more complex. 

Tools like LaTex are code related - but unfortunately no WYSIWYG feature simultaneously is possible. 

With LO WYSIWYG is there but unfortunately code quickly is getting much bigger than needed causing also trouble not forseen when looking on design. 

Therefore a synthesis of LaTex-like code and instantaneous WYSIWYG would be a good solution.
Comment 7 V Stuart Foote 2015-02-27 15:03:51 UTC
A bit beyond idea of Reveal Codes being exposed during WYSIWYG editing in Writer, as proposed bug 34002 

But it sure would be handy to have direct cursor focused access to the XML components (at least content.xml and styles.xml), that would be generated on document save, available during editing to be able to make document changes  with validation there.

Could see this being a useful UI for all LO modules.
Comment 8 Robinson Tryon (qubit) 2016-08-25 04:44:52 UTC Comment hidden (obsolete)
Comment 9 Regina Henschel 2016-08-29 12:59:36 UTC
The XML code does not exist permanently. LibreOffice is not working directly on the node tree, but it has an internal model. You can save the document to flat ODF, *.fodt e.g. Then you can open that file in an editor and correct it manually where needed.

If the text does not look as you expect, you can remove all direct formatting, then set the cursor in the suspicious area and look in the Style&Formatting dialog, which paragraph and character style is actually applied.
Comment 10 Yousuf Philips (jay) (retired) 2016-09-09 20:28:42 UTC
With Regina's comment, it seems that this isnt something plausible to be done, but it would be useful to get other dev opinions of this.
Comment 11 Michael Stahl (allotropia) 2016-09-12 10:24:59 UTC
an implementation would need to store the document to ODF, then display the various XML files for editing, then import the ODF file again.

there is a problem with the requested validation feature since the ODF schema files are under a license that doesn't allow editing, which means it's not a open source license, so that's a problem for bundling a validator with LO.

also in contrast to HTML, ODF wasn't really designed to be hand-edited.

clearly this feature would work poorly at best and it's a lot of effort so let's just close this WONTFIX.