On Sunday, August 27, 2023 at 5:44:23 AM UTC-5 Edward K. Ream wrote:

PR #3515 <https://github.com/leo-editor/leo-editor/pull/3515> contains 
preliminary work improving Leo's python importer.


This PR has now been merged into devel.
 

*Packaging*


Moving the RIC postposs into the base Importer class would clarify the 
code. It's too easy to forget that the RIC postpass exists!


I have chosen to leave RIC.postpass where it is because it contains 
language-independent code. 

Alas, the RIC postpass knows the base path of each imported file. The 
importer classes do not. Passing such data to the importer classes might 
constitute a breaking api change.


Aha: everything should be relative to the *outline's* directory, that is 
os.path.dirname(c.fileName()). This information *is* available to each 
importer class, but it seemed cleaner to leave the postpass in the RIC 
class.

However, the PR does add Importer.postpass as a hook for language-dependent 
adjustments. The Python_Importer class overrides i.postpass to move 
docstrings to more favorable location. The docstring for i.postpass reminds 
readers that RIC.postpass happens last.
 

*Strategy*


c.recursiveImport probably should require relative @path directives.


Yes, it does. Moreover, the 'dir_' kwarg to c.recursiveImport can be a 
relative path. 
 

*Summary*


Experiments will show whether enforcing the directory constraint makes 
sense. 


Being clear that all directories must be sub-directories of the outline 
directory (or the outline directory itself) clarified many issues. The PR 
also does a lot more careful testing of assumptions.

The PR is a step forward. If I find other problems I'll create new issues.

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/235099a4-4fd6-46a4-b6c2-a7f77c8c0a87n%40googlegroups.com.

Reply via email to