Changes in etgen

2021-12-23

Released version 1.1.2

2021-12-16

Fix #4401 (cannot import name ‘escape’ from ‘cgi’)

2021-09-02

Move validate_pain001() and its XSD files to lino_xl.lib.finan.

Released version 1.1.1

2020-05-04

Released version 1.1.0

2020-05-01

Fixed two warnings “ResourceWarning: unclosed file <_io.TextIOWrapper name=’…/tests/finan.PaymentOrder-63.xml’ mode=’r’ encoding=’UTF-8’>” caused by etgen.sepa.validate.

New rule for etgen.html.to_rst() : when the value is a string, we now assume that it is raw HTML, which means that we parse it and then process is like normal element tree elements.

2019-10-14

html2rst now digests html and body elemtns and provides clearer error messages for unsupported elements

Released version 1.0.0

Version 0.0.4 (released 2018-03-11)

  • use the ElementTree builder (E) from lxml instead of my own implementation based on xml.etree.ElementTree. Though not the easy way. It has a few consequences (see below).

We cannot use E.tostring() any more because the E defined in lxml.etree doesn’t have that method. My extended version of tostring() is now as a global function in etgen.html.

Old code:

from etgen.html import E
...
E.tostring()

New code:

from etgen.html import E, tostring
...
tostring()

Same problem for E.iselement and E.to_rst and E.raw.

In lxml we don’t have the hack of adding an underscore to attributes like class which are a reserved in Python. We must convert these cases. Before:

return E.li(a, class_="active")

After:

return E.li(a, **{'class': "active"})

Failures saying TypeError: bad argument type: __proxy__(u’ by ‘) are because lxml elements don’t like Django translatable strings. Old code:

return E.div(E.h2(self.actor.label), e)

New code:

return E.div(E.h2(str(self.actor.label)), e)

Another failure was in code which updates existing elements TypeError: update() takes no keyword arguments. Old code:

e.attrib.update(align='right')

New code:

e.set('align', 'right')

Version 0.0.3 (released 2018-02-16)

Version 0.0.2 (released 2018-02-16)

Added package data in etgen/sepa/XSD/*.xsd.

Version 0.0.1 (released 2018-02-16)

The package was born as a repackaging of code which was previously in Lino as the packages lino.utils.xmlgen and lino.utils.html2rst. We moved them out of Lino into an independent package etgen because they might be of use also for projects which don’t use Lino.