In the file from the previous post, there few special regex patterns that 
make js importer fail. If you delete those lines 2595-2613 from 
jquery.terminal.js, importer will successfully import the file. Looking in 
generated tree here are few example nodes:

//headline:if (typeof define === 'function' && define.amd)

//and the content of body is
    if (typeof define === 'function' && define.amd) {
        // AMD. Register as an anonymous module.
        define(['jquery'], factory);
    } else if (typeof module === 'object' && module.exports) {
        // Node/CommonJS
        @others
    }
})(function($, undefined) {
    'use strict';
    // 
-----------------------------------------------------------------------
    // :: Replacemenet for jQuery 2 deferred objects
    // 
-----------------------------------------------------------------------


//or another one
//headline:everyTime: function(interval, label, fn, times, belay)

//and the body

everyTime: function(interval, label, fn, times, belay) {

@others

},

// and in at-others is following code

return this.each(function() {

jQuery.timer.add(this, interval, label, fn, times, belay);

});



If one wants to read and understand function `everyTime`, he must look into 
other node to see what it does. And here is little bit of context around 
that function in source file:
    // 
-----------------------------------------------------------------------
    // :: jQuery Timers
    // 
-----------------------------------------------------------------------
    var jQuery = $;
    jQuery.fn.extend({
        everyTime: function(interval, label, fn, times, belay) {
            return this.each(function() {
                jQuery.timer.add(this, interval, label, fn, times, belay);
            });
        },
        oneTime: function(interval, label, fn) {
            return this.each(function() {
                jQuery.timer.add(this, interval, label, fn, 1);
            });
        },
        stopTime: function(label, fn) {
            return this.each(function() {
                jQuery.timer.remove(this, label, fn);
            });
        }
    });

Arguably, the whole this code can fit nicely in one body. After all it is 
just 20 lines long. Instead Leo importer split this piece of code into 7 
nodes. The worse is that the beginning of the above code that has three 
lines of comment as small heading is placed at the bottom of totally 
unrelated node whose headline is `function dc(n)` and the body is as 
follows:
function dc(n) { return wc(n, '', -1); } /** * Public API * 
$.Storage.set("name", "value") * $.Storage.set({"name1":"value1", 
"name2":"value2", etc}) * $.Storage.get("name") * $.Storage.remove("name") 
*/ var localStorage; if (!hasCookies() && !isLS) { localStorage = {}; 
$.extend({ Storage: { set: wls, get: rls, remove: dls } }); } else { if 
(isLS) { localStorage = window.localStorage; } $.extend({ Storage: { set: 
isLS ? wls : wc, get: isLS ? rls : rc, remove: isLS ? dls : dc } }); } // 
----------------------------------------------------------------------- // 
:: jQuery Timers // 
----------------------------------------------------------------------- var 
jQuery = $; jQuery.fn.extend({ 


Now, if this examples are not enough to prove my point, please show 
imported tree to any js developer and ask him what the code does or if he 
finds that this particular view of source code is better then looking in a 
flat file. 

We may pretend that those are small glitches but, I really doubt that 
anyone will buy it. Leo should be superior tool for studying others people 
code, but when we speak about imported javascript files it fails (IMHO) 
miserably. And I do believe it can be done much better. 

I am sorry to be just criticizing your solution without providing any 
other, and at the moment I really can't do anything more to provide the 
solution. I shared my idea hoping that it would help. When I find more free 
time, hopefully, I will made that idea come true. Also I was hoping that 
once I have this plugin, and start to use it for importing js projects, 
perhaps I would find that some sequence of the above explained commands 
need to be manually repeated over and over until the whole file is 
imported. In that case it would be simple enough to make that sequence of 
steps in one new command or in some kind of recipe for importing files of 
some specific coding style. Perhaps it would lead to a small collection of 
recipes for importing js files depending on code style. Then perhaps, Leo 
could execute several recipes, show the result tree and user just chose 
what recipe suites best for particular project.

 Vitalije

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