On Sunday, December 5, 2021 at 4:22:42 PM UTC-6 vitalije wrote:
 
> I don't see what substantial work do you mean is required.

It might be best to use Importer.check and most of the other Importer 
machinery.

At *minimum*, the top-level node of leo/importers/python.py should remain 
the same. (There is no need to define Target = linescanner.Target).

The top-level code (including the importer_dict) is *required *so that 
@auto works. 

To get the benefits of the Importer class, the new python importer should 
be a subclass of the Importer class. The Importer class defines this 
pipeline:

- Stage 0 checks blanks and tabs.  See Importer.check_blanks_and_tabs.
- Stage 1 does the basic importing. You would override this.
- Stage 2 is Import.post_post, which the present the python importer 
(partially?) overrides.
- Stage 3 is Import.finish, which sets text from the vnode dict.
- Stage 4 is Import.check, which does the perfect-import checks and reports 
any errors in a clear format.

If you want to use the pipeline, you *must *use the vnode_dict as follows:

- Init self.vnode_dict to the empty dict.
- Rather than setting p.b directly, the python importer should set 
vnode_dict [p.v] ['lines'] to the list of lines in the node.

*Summary*

You must be aware of how Leo's core connects to the importers. The 
top-level code in leo.plugins.importers.python is *required*.

I'm willing to consider anything that works, but I would like you to 
provide the equivalents of:

- Importer.check_blanks_and_tabs.
- The python importer's post-pass.
- Importer.check. 

The easy way of doing the above is to subclass the Importer base class and 
use the vnode_dict interface. It will be easy: just assign to vnode_dict 
[p.v] ['lines'] rather than p.b.

Edward

-- 
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/95ab5f08-c596-4562-bcc6-a73c7400efecn%40googlegroups.com.

Reply via email to