On Tue, Dec 6, 2016 at 1:24 PM, Largo84 <larg...@gmail.com> wrote:

I'm quite rusty when it comes to programming code and writing scripts (my
> last actual programming was 20 years ago in Pascal, never learned Python).
>

​Pascal might have been called state-of-the-art in programming simplicity
back in the day.  However, you should understand *very clearly* that python
​is almost infinitely easier to learn and use than Pascal.​

I wouldn't even know where to start writing a script to go through an
> outline and replace all instances of a block of text with an updated
> version of same
> ​.
>

​As with any learning, you start at the beginning.  Take *safe* baby steps.

I never write a script that changes an outline in one go.  At first, the
script tells me what it *would* replace, and where.  When I am satisfied
that all is well, I make sure everything is backed up first ;-)  Only then
do I run the script so it alters nodes.

It's so  easy to traverse Leo outlines:

   for p in c.all_nodes():
       << do something with p>>

In particular, p.b is the node's body, and p.h is the headline.  You can
use either p.b or p.h as a setter or getter, but do *not* change p itself.

That's enough hints.  Dive into Leo's scripting docs!

So for me (at least for now), I will continue to rely on clones until and
> unless I can find a better alternative. Having said that, I always need to
> be aware of situations where clones can 'bite' (cross-files and @auto... as
> I mentioned in another post). Regards,
>

​Python is way too good a language to ignore.  Don't be afraid of it.

EKR

-- 
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 leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to