Owen, can you take some minutes to review it? Thanks!
(If there is interest, I donate this code under the same licence of Reinteract.
BTW, what a wonderfull piece of code!)
--
http://www.advogato.org/person/eopadoan/
Bookmarks: http://del.icio.us/edcrypt
Nice work! I could imagine using this as a "rendering engine" for
displaying structured data resulting from a computation with markup
and formatting.
Can you create:
http://ww.reinteract.org/trac/wiki/Extensions
And list it there?
There's one reason I don't think Reinteract is quite ready to have
this included with the distribution ... it doesn't handle ElementTree
very well. Look at the following sequence (this is in standard Python
interactive mode not in Reinteract, so as not to confuse things)
>>> import xml.etree.ElementTree as ET
>>> e = ET.Element("foo")
>>> import copy
>>> e2 = copy.copy(e)
>>> e.append(ET.Element("bar"))
>>> ET.tostring(e)
'<foo><bar /></foo>'
>>> ET.tostring(e2)
'<foo><bar /></foo>'
So actually, copy.copy() doesn't work as expected on
ElementTree.Element. And if we did work, we'd have a separate set of
problems. Here's what you would get in reinteract:
>>> e = ET.Element("foo")
>>> t = ET.ElementTree(e)
>>> e.append(ET.Element("bar"))
>>> print ET.tostring(e)
<foo><bar /></foo>
>>> print ET.tostring(t.getroot())
<foo></foo>
So, you'd need some ability to tell Reinteract "here's how you handle
xml.etree.ElementTree.Element". Actually, even with a hook like that,
it's still not obvious how to handle ElementTree.Element correctly,
since (unlike a DOM element) it has no parent pointer, so you can't
walk up and figure out what parent elements or element trees to copy.
I certainly expect people to find Reinteract useful in situations
where it can't manage to do the "re-edit" 100% properly, but for now
I'd like to emphasize the things where it can provide a more seamless
experience.
Other than that, the code in rehtml.py looks fine to me. I don't have
a strong opinion on the gtkhtml2 question ... my feeling on extensions
is that they can pull in lots of whacky dependencies (like sox, say
:-), and if those dependencies don't work for someone else, they can
write their own version or submit a patch.
- Owen
The first thing I thought when I saw the screencast was, "wow - It can
help me with my work!"
> Can you create:
>
> http://ww.reinteract.org/trac/wiki/Extensions
>
> And list it there?
Done.
Ok. I haven't noticed this problem, and I will study it a litle more,
as I think it is worth having a good re-edit experience with
Elemetree.Element, if I want to support it at all in the extension.
> Other than that, the code in rehtml.py looks fine to me. I don't have
> a strong opinion on the gtkhtml2 question ... my feeling on extensions
> is that they can pull in lots of whacky dependencies (like sox, say
> :-), and if those dependencies don't work for someone else, they can
> write their own version or submit a patch.
Agreed. Thank you for the feedback!