On Mon, 1 Apr 2013 01:30:05 -0300
Haroldo Stenger <[email protected]> wrote:

> 2013/4/1 Terry Brown <[email protected]>
> 
> > On Sun, 31 Mar 2013 23:28:22 -0300
> > Haroldo Stenger <[email protected]> wrote:
> > When you execute a script from a Leo outline, `c` is the context
> > variable for just that outline, and `g` is the global variable for that
> > session.  So there's only one g, but c is different for each outline.
> >
> 
> Thanks a lot.
> 
> I'm particularly Leo-active today, so I'll continue asking things if you
> agree :-)
> 
> Supose I have a body, with any text.
> I want to decompose the body in many @others bodies, based on some marks I
> put in the text (not specially any standard markup). f.i., I'd like avery
> paragraph (double newline) to separate the body to a different node. does
> it exist as a current function?

This script:
--- cut here ---
paras = c.p.b.split('\n\n')

for para in paras:

    nd = c.p.insertAsLastChild()
    nd.h = para.split('\n')[0][:20]  # first 20 char. of first line
    nd.b = para

c.redraw()
--- cut here ---
chops itself up into paras in child nodes

I assume you've found the script-button button, which will add a button
'foo' to execute a script defined in the node selected when the
script-button button is pressed, so that later you can execute that
script on whatever node's selected when the foo button's pressed.
You'd need that if you want the above to slice up nodes other than
itself :-)

Cheers -Terry

> thanks and best,
> 
> Haroldo
> 

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/leo-editor?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to