On Aug 11, 5:22 pm, "Edward K. Ream" <[email protected]> wrote:

> Now we come to an interesting design questions.  The present code
> *formats* code properly, but it lacks the "environmental" features of
> the rst3 command.  At present, it doesn't pass code directly to
> docutils or Sphinx, it doesn't deal with @path, etc. So the choice is
> either:
>
> 1. To duplicate lots of rst3 code in the script or
>
> 2. To fold the new code back into the rst3 command.
>
> Neither options is totally pleasing.

Soon after I wrote this I saw the way forward.  I'll create a new
command, called something like code-to-rst, that will be part of
leoRst.py.  It will duplicate all the operational features of the rst3
command.  That is, it will handle all the "details" just as the rst3
command does.

Unlike the rst3 command, the code-to-rst command will generate code
using the much cleaner code in the format-code script.  The intention
will be that @command nodes could create new commands by overriding
one or two of the new methods in leoRst.py.  These user-created
commands could focus just on formatting, leaving all the grungy
details unchanged.

To do this, I may need to create a bit of new "framework" code in
leoPy.leo.  I should be able to do this without disturbing the exiting
code.  That way existing users like TL will not have to worry that the
new stuff will break old input files.

Edward

P.S.  The drawback to this approach will be that it doesn't clean up
the existing code.  But in the absence of proper unit tests it's too
risky to change *anything*.  Better just to leave the code as it is,
and build a simpler structure on top of the old.

I'll deprecate *all* advanced features, but will leave those features
in indefinitely.  I'll also remove the documentation for *all*
advanced features, so that nobody but present users will know about
them.

EKR

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