On Mon, 28 Jul 2014 15:46:27 -0500 "Edward K. Ream" <[email protected]> wrote:
> On Mon, Jul 28, 2014 at 10:50 AM, 'Terry Brown' via leo-editor > <[email protected]> wrote: [snip] > > In addition to that, I think there should be an alternative level > > in the API where the signature is something like: > > I'm not really following you here. > > > Two languages which seem like they'd be easier to handle this way > > are LaTeX and ctext. [snip] > > You are welcome to override BaseScanner.scan (or any of its helpers) > if you like ;-) That way you have complete control over the scanning > process. > > However, the real "excitement" comes in the code generation phase. > This code creates the Leo outline. It's complex because it must be > very careful about indentation and whitespace. I'm not looking for excitement ;-) I'm looking for Leo to say "here's the filename, here's the node to stick the subtree in, now make the subtree". Well, ok, I guess that would be exciting for the flexibility it offers :-) I thought maybe just over-riding .run() would do it, but I'm getting something wrong: .../leo/git/leo-editor/leo/plugins/importers/test.py: from basescanner import BaseScanner class TestScanner(BaseScanner): def __init__(self, *args, **kwargs): print 'ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ' return BaseScanner.__init__(self, *args, **kwargs) def run(self,s,parent,parse_body=False,prepass=False): print 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' return True def scan (self,s,parent,parse_body=False): print 'YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY' return True importer_dict = { '@auto': ['@auto-test',], 'class': TestScanner, 'extensions': ['.txt',], } the modules being loaded because if I add a syntax error it dies, but none of the XYZ strings are ever printed. My test .leo has a @auto-test ~/r/foo.txt node, but it behaves just like an @auto node, the file does get loaded, if the code above was active, I assume it wouldn't be loaded. I tried .txxt as an extension in both places to, same result (in case .txt was conflicting with something). Cheers -Terry -- 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 http://groups.google.com/group/leo-editor. For more options, visit https://groups.google.com/d/optout.
