On Wednesday, October 5, 2016 at 7:37:38 AM UTC-5, Edward K. Ream wrote:
>
> On Tue, Oct 4, 2016 at 12:44 PM, MichaelM <
> [email protected]> wrote:
>
>>
>> Perhaps I am missing something, but I have not been able to figure out 
>> how to import tab-indented text into Leo as an outline. Using the import 
>> feature results in a single @clean file, rather than breaking the indented 
>> lines into individual nodes. Is there a way to do this?
>>
>
> ​Probably not.  You could file an enhancement request.
>

Belay that.  Rev 3ef9da4d adds  @button import-tab-files to scripts.leo.  
The script imports the file given in the @button node to a Leo outline.

*Notes*

1. The script checks that leading whitespace is either all blanks or all 
tabs throughout the file.  You must fix intermixed blanks and tabs before 
running this script.

2. The script will work with separate_nodes either True or False, but 
setting it to True is probably what you want.  Every line of the file gets 
its own node.  Otherwise, adjacent lines at the same level get put into the 
same node.

3. The code has been tested only where indentation is consistent, say 
always a multiple of 4.  It's possible to imagine weird cases, say an 
indentation of 6 following lines with indentations 4 and 8 respectively.  
Probably something reasonable happens, but no guarantees.

4. This code could be folded into a command that prompts for a command, say 
by using a dialog, but for now the script should suffice for importing 
files.

Please let me know how the script works for you.

Edward

P.S.  The script is similar to the javascript importer, which is why I 
wrote it today.

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 [email protected].
To post to this group, send email to [email protected].
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