I've just added a longer version of this post at the end of #334 
<https://github.com/leo-editor/leo-editor/issues/334>.  I wanted to 
reference those remarks as an acknowledgement of Tom F's contribution.

Tom's importer proposal 
<https://groups.google.com/forum/#!msg/leo-editor/Ct3ZKqTo_KE/78R-I4-UAwAJ> 
was the first to suggest that the importers be organized as a pipeline. At 
first, I dismissed that suggestion. In fact Tom's suggestions have been 
marinating in the back of my mind ever since. Thank you, Tom! Leo's great 
new importers owe a lot to you...

The new Importer class now clearly is a pipeline:

Stage 1: i.run calls the first stage: i.v2_gen_lines. It generates, in a 
single, non-recursive pass, all the output nodes.

Stage 2: i.run then calls the second stage, i.post_pass, which runs a *series 
*of other passes:

def post_pass(self, parent):
    '''Clean up parent and all its descendants.'''
    self.clean_all_headlines(parent)
    self.clean_all_nodes(parent)
    self.unindent_all_nodes(parent)
    # These passes must follow unindent_all_nodes.
    self.promote_trailing_underindented_lines(parent)
    # This probably should be the last pass.
    self.delete_all_empty_nodes(parent)

This organization solves a number of technical problems, and makes it much 
easier to create custom importers.

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 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