On Thu, Sep 22, 2011 at 7:11 PM, Offray Vladimir Luna Cárdenas
<[email protected]> wrote:
> The first one is enabling <<section>> markup as in literal programming inside
> reStructuredText trees.
This might be possible, provided that Leo's rst command would search
in a wider context for the section definition.
> So I can clone all chunks of code inside chunks of documentation and create a
> tree-script that contains all chunks, create a derived file and execute it.
Perhaps as the result of your post, I had the vague thought of having
"more executable" documentation. The scripting chapter of LeoDocs.leo
might be called a prototype: it works because Leo's execute-script
command provides the same environment as that discussed in the docs.
More generally, the docs would need some way of setting up environment
in which to execute the docs.
> The second option is to have a similar behavior as Smalltalk, selecting
> pieces of code, may be all the indented code inside a "..sourcecode::"
> directive and a command to execute it.
Leo's execute-script command already does this, but only for an
environment containing c,g,p. Of course your code snippets could set
up their own environment "by hand".
Note: just a few days ago I added an small but versatile feature:
g.app.inScript. The original idea was to allow code to be embedded in
a Leo module that would be skipped during import (g.app.inScript is
False) but could then be executed later as a script. Good for
testing.
But we could use this trick in other ways::
if g.app.inScript:
<< set the environment for the script>>
You could add such "setup" code to scripts, provided that
g.app.inScript is False in your typical environment.
Edward
--
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.