On Wednesday, January 17, 2018 at 5:30:17 AM UTC-6, vitalije wrote:
>
> Well, obviously we don't agree on what "reasonably" imported code look 
> like. 
>

I have just closed #653 
<https://github.com/leo-editor/leo-editor/issues/653>, relating to the 
jqterm.js.  Notes:

- I did not detect any problem parsing js regex expressions.

- The fix was to i.cut_stack, which now issues a log message without 
crashing when the stack can't be cut back as expected.  This is enough to 
import jqterm.js perfectly.

- js_i.clean_headline is now simpler and more useful.  Imo, it reports the 
minimum useful information about each function.  This is a straightforward 
method.  All contributions gratefully accepted.

- I have just created #655: The js importer could remove @others when a 
node has only one child 
<https://github.com/leo-editor/leo-editor/issues/655>. This is a separate, 
relatively low priority item.  It would improve only a few imported nodes 
in jqterm.js.

Imo, jqterm.js shows how good Leo's present javascript importer is.  It 
handles several js patterns for defining functions, using only the nesting 
level of parens and curly brackets as a guide.  The essential fact is that 
the (complex!) perfect import checks pass.  As a result, a post-pass, as 
envisioned by #655, would be relatively straightforward.

Edward

 

> I have had encountered dozens of js files that *are* imported correctly in 
> terms that they can be written again with the file content unchanged, but 
> they all suffered from creating too many or too few nodes and I had to 
> import them by hand. 
>
> Attached to this message are two files one Leo file trying to import the 
> other js file. Put them in the same folder and try import. It fails, it 
> leaves a lot of created nodes with arguably ugly names. No developer would 
> ever name those nodes like importer does, nor he would structure the tree 
> like that if he were creating that file using Leo from the beginning.  For 
> me, reasonably imported file must be something close to what a developer 
> would have if he wrote the same source file directly in Leo.
>
> So, I can partially agree that current implementation of js importer can 
> import some of the source files, but I personally find those imports 
> useless most of the time. I have to reshape the tree so much that it turned 
> to be more efficient to import whole file in one node and then to extract 
> pieces by hand.
>
> YMMV, Vitalije
>
> PS: it seems that the js file attachment is refused. It can be found on 
> github. I have just renamed it to jqterm.js.
>
> https://raw.githubusercontent.com/jcubic/jquery.terminal/master/js/jquery.terminal.js
>
>

-- 
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 leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
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