This Leo script converts any part of a Leo outline to vim format::

    '''Convert the selected tree to vimoutliner format.'''

    n = p.level()
    for p in p.self_and_subtree():
        indent = '\t'*(p.level()-n)
        print('%s%s' % (indent,p.h))
        for s in p.b.splitlines(False):
            print('%s: %s' % (indent,s))

There is one problem with this script: it will fail if a headline
starts with a colon.  It should at least give a warning.

Another nit: because print adds a newline, the script will add a
newline at the end of any body text line that doesn't end with a
newline.  Such lines probably can't be represented in vimoutliner
anyway, so adding a trailing newline for each node that needs one is
probably the best that can be done.

The vimoutliner-to-leo script will be more involved.  I'll do that
next.

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.

Reply via email to