On Mon, 17 Oct 2011 13:34:28 -0700 (PDT)
ilkosta <[email protected]> wrote:

> 
> 
> On 17 Ott, 14:48, Kent Tenney <[email protected]> wrote:
> >             for pos in this_c.all_positions():
> >                 if pos.get_UNL() == unl:
> >                     this_c.setCurrentPosition(pos)
> >                     this_c.redraw()
> >                     break
> 
> sorry, I'm a newbee, but is correct?
> for pos in this_c.all_positions():
>     if pos.get_UNL().split("#")[1] == unl:
>         this_c.setCurrentPosition(pos)
>         [...]
> 

Really it depends how unl was calculated in the first place.  If the
value of unl comes from a straight call to p.get_UNL() then that's what
you want to compare it to the next time around.

I think you're point is, what is the UNL, only the part after the '#',
or the whole thing?  For inter-file UNLs, it has to be the whole thing
- it's basically and URL or URI with special interpretation of the
fragment part.

If you really wanted to deal with only the post '#' part, you could use 
foo.split('#', 1) to make sure it only splits on the first #, keeping
any others in the fragment, which must have come from headlines with
'#' in them.

The p.get_UNL() function, which is about 2 weeks old I think, gives you
the whole URI, "/path/to/some/file.leo#node-->subnode" by default,
unless you call it as p.get_UNL(False).

Cheers -Terry 

-- 
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.

Reply via email to