← Back to team overview

zim-wiki team mailing list archive

Re: A makeshift table plugin; breaks undo.

 

I have largely overhauled my table plugin with a new format (less boundary
cases for better stability, cleaner functions, a bit of documentation).

The problem of preserving Undo information persists.



2013/7/8 Klaus-Dieter Bauer <bauer.klaus.dieter@xxxxxxxxx>

> Hello!
>
> I have written a make-shift table plugin, that just helps managing tables
> made from verbatim text (though images and links are possible, but
> currently break the formatting). Basically it looks for a line starting
> with {{| and the earliest line afterwards ending with ||} and realigns
> table contents in between.
>
> However, I found this extremely difficult to do on the level of the
> parsetree and instead extract the source code through
> "page.dump(zim.formats.wiki)", modify the source and write it back with
> "page.parse(...)".
>
> Sadly though, afterwards Undo is not possible.
>
> Is there some way that I can modify the contents of a page without
> breaking Undo?
>
> I have attached the experimental source and a file with example tables for
> reference. (Note: High risk of data loss, it's still pretty buggy).
>
> kind regards, Klaus
>
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2013-07-10T16:21:28+02:00

====== Table ======
Created Wednesday 10 July 2013
                                                            
''{| --------------  -----  ------  -----''
''            Value  Error  Source       ''
''   ==============  =====  ======  =====''
''           Volume  35 Å³  0.3 Å³  ''[[CopyEquations]]
''   Lattice Const.  30 Å    0.1 Å  ''[[Home]]
''              <r>  <r>                 ''
''   --------------  -----  ------  ----- |}''

''{| | Value           Error  Source          ''
''   | ==============  =====  ======  =====  =''
''   | Volume          35 Å³  0.3 Å³  ''[[CopyEquations]]   
''   | Lattice Const.  30 Å   0.1 Å   ''[[Home]]   
''   | save            mode   1       2      3 |}''

''{| | Value           Error  Source       ''
''   | ==============  =====  ======  =====''
''   | Volume          35 Å³  0.3 Å³  ''[[CopyEquations]]
''   | Lattice Const.  30 Å   0.1 Å   ''[[Home]]'' |}''

''{| -------------- | -----  ------  -----''
''   Value          | Error  Source       ''
''   ============== | =====  ======  =====''
''   Volume         | 35 Å³  0.3 Å³  ''[[CopyEquations]]
''   Lattice Const. | 30 Å   0.1 Å   ''[[Home]]
''   -------------- | -----  ------  ----- |}''


''{| l              | rrl   | Value   Error  Source''
''   ============== | ===== | ======  =====  ======''
''   Volume         | 35 Å³ | 0.3 Å³  ''[[CopyEquations]]        
''   Lattice Const. | 30 Å  | 0.1 Å   ''[[Home]]''         |}''

Attachment: tabletrix.py
Description: Binary data


Follow ups

References