On Wed, Mar 11, 2009 at 10:37 PM, Ville M. Vainio <[email protected]> wrote:
> There is also an annoying logical glitch - select_h is "one step too
> far" in traversal, which will surely trip people expecting precise
> selection of one node, as opposed to its children. Stay tuned, and
> don't try it yet ;-).
Clarification:
The surprising behaviour happens because select_h is actually 2
operations rolled into one:
1. match headline in poslist, giving nodelist L
2. return new nodelist that is all the children of nodes in L
The step 2 is what allows select_h to be chained (because it
progresses). However, for last step in chain, the user probably
doesn't want to get list of children so that he can operate on the
nodes directly.
"Explicit is better than implicit", so select should probably be split
to 2 parts that are called explicitly:
- children() => return list of all children of every node in nodelist.
- filter_h / filter_b => filter the nodes by h / p.
So the chaining would be:
c.find_h('@thin leoApp.py').children().filter_h('dump').children().
I just pushed a new version where at least find_h and find_b make
sense, but consider select_h as nonexistent still :-). select_b
currently works, but the name is misleading. The real name for current
behaviour would be filter_b.
--
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
-~----------~----~----~----~------~----~------~--~---