Now here's a slight "distraction":
I experimented with creating a "direct" recursive data structure for leo trees.
It's pretty simple (who needs Haskell & friends when we have python):
def p_to_obj(p):
return [p.h, p.b, p.gnx, [p_to_obj(po) for po in p.children_iter()]]
Yes, I removed utf8 encoding to keep it more elegant ;-).
The whole snippet is somewhat like this:
http://pastebin.com/f6a30f859
It creates a python object like this:
http://pastebin.com/f17a3a285
(list of p,h,gnx, children...)
Now, the interesting part. This can be directly encoded as Yaml, to
render the rather readable:
http://pastebin.com/f3d750af3
The part that needs work is the body text, it should probably be
improvable by using "block scalars".
This idea is related to my "jsonification" refactoring suggestion a
while ago. If functions like read code emitted stuff that p_to_obj
returns, the yaml structure could be used to debug / trace the data
(but still in machine-readable form). This could also be used to
communicate outline structure so that it can be both read, and copy
pasted from emails to real tree structure.
No need to take any action regarding this email. Just a food for
thought, perhaps for inspiration...
--
Ville M. Vainio
http://tinyurl.com/vainio
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/leo-editor?hl=en
-~----------~----~----~----~------~----~------~--~---