cirsfid-unibo / lime

LIME (Language Independent Markup Editor)
http://lime.cirsfid.unibo.it/
29 stars 14 forks source link

Malformed AkomaNtoso output #54

Closed obujor closed 6 years ago

obujor commented 6 years ago

Sometimes LIME generates wrong document structure and Akn output, it may happen because of strange user iteractions with the editor. The structure is wrong because of the doc node (e.g. act, statement) is at the end of the document instead of at the beginning and it doesn't contain the content of the document.

It's hard to reproduce this, but it could be drag&drop iteractions within editor or trying to select and delete all the content.

Example of bad structure:

<akomaNtoso>
    <mainBody>...</mainBody>
    <statement>
        <meta>...</meta>
    </statement>
</akomaNtoso>

The structure above should be:

<akomaNtoso>
    <statement>
        <meta>...</meta>
        <mainBody>...</mainBody>
    </statement>
</akomaNtoso>

Example document with bad structure generated with LIME: financial implications of the move to Rome.zip

The function involved is probably this: https://github.com/cirsfid-unibo/lime/blob/b80d3bdcdfaf279e846ce23fd1c9d91c77b6468e/packages/lime-core/src/controller/Editor.js#L172

obujor commented 6 years ago

Fixed in #55