I've been prototyping new functionality for Viewrendered3 that would allow 
for non-python code to be executed.  It's working, but it also has some 
limitations.  I'd like suggestions as to whether this functionality will be 
worthwhile or whether it would be too limited.  To execute code blocks, an 
external program is needed.  For example, to execute julia code, julia.exe 
must be installed; for javascript, one option is graal.  The program must 
be able to run using a command line like

julia.exe test1.jl

Here is what the new functionality can do:

   1. Execute code blocks in a node or tree, even if they are not Python 
   code;
   2. Display the resulting stdout and stderr, just as is currently done 
   for Python code;
   3. The paths to external code execution programs are defined in an ini 
   file located in Leo's .leo directory.

Here are the current limitations:

   1.  At present, only available for ReStructured Text.  Should be 
   possible for MD and ASCIIDoc in the future;
   2. All code blocks in the node or tree *must *be for the same code 
   language (e.g., julia);
   3. There is no way to pass arguments to the executing program.  For 
   example, you cannot give a classpath to java.exe.

These are essentially the same limitations as for running Python code in 
VR3.

The ini file must be in a *vr3* subdirectory of the *.leo* directory.  VR3 
reads this file on startup to discover what languages are known and the 
paths to their executables.  Currently, julia and javascript can be set up.

The ini file must have a section like the following:

[executables]
javascript = D:\usr\graalvm-ce-java11-20.0.0\languages\js\bin\js.exe
julia = C:\Users\tom\AppData\Local\Programs\Julia 1.5.3\bin\julia.exe

If any of the possible languages is not specified in the ini file, no error 
is raised; VR3 will simply not try to execute the code for that language 
(and will write a message to Leo's log pane).

One quirk is that some languages may not have a Leo colorizer file.  Julia 
is one of these.  However, the colorizer used by VR3 may still be able to 
colorize it (true for Julia).  In the body frame, Leo tries to colorize the 
code anyway as best it can, which can be a little strange, but in the VR3 
rendering pane, the colorizing will be OK.

So please give me your thoughts about this experimental functionality.  
It's not available for anyone else to play with yet, but I could arrange 
that if anyone wants.


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/cf176ead-1f81-43b4-be2a-9fd8b4f3b38fn%40googlegroups.com.

Reply via email to