JSDOC/Packer.vala
authorAlan Knowles <alan@roojs.com>
Mon, 2 Nov 2015 09:30:45 +0000 (17:30 +0800)
committerAlan Knowles <alan@roojs.com>
Mon, 2 Nov 2015 09:30:45 +0000 (17:30 +0800)
JSDOC/Packer.vala

index a876cb7..6a81d27 100644 (file)
@@ -343,7 +343,7 @@ namespace JSDOC
                     
                
                
-               },
+               }
     /**
      * Core packing routine  for a file
      * 
@@ -411,130 +411,8 @@ namespace JSDOC
         
          
     },
+     
     
-    timerPrint: function (str) {
-        var ntime = new Date() * 1;
-        var tdif =  ntime -this.timer;
-        this.timer = ntime;
-        print('['+tdif+']'+str);
-    },
-    
-    /**
-     * 
-     * Translation concept...
-     * -> replace text strings with _T....
-     * -> this file will need inserting at the start of the application....
-     * -> we need to generate 2 files, 
-     * -> a reference used to do the translation, and the _T file..
-     *
-     *
-     * We store the trsum on the token...
-     * 
-     */
-    
-    writeTranslateFile : function(fn, minfile, toks) 
-    {
-        
-        var map = {};  // 'string=> md5sum'
-        var _this = this;
-        var t, last, next;
-        
-        
-        var tokfind =  function (j,dir) {
-            while (1) {
-                if ((dir < 0) && (j < 0)) {
-                    return false;
-                }
-                if ((dir > 0) && (j >= toks.length)) {
-                    return false;
-                }
-                j += dir;
-                if (toks[j].type != 'WHIT') {
-                    return toks[j];
-                }
-            }
-            return false;
-            
-        }
-        
-        
-        for (var i=0;i<toks.length;i++) {
-            
-            t = toks[i];
-            if (t.type != 'STRN') {
-                continue;
-            }
-            if (t.name != 'DOUBLE_QUOTE') {
-                continue;
-            }
-            
-            last = tokfind(i,-1);
-            next = tokfind(i,+1);
-            
-            // we have to ignore key values on objects
-            
-            // defined by
-            // last == '{' or ',' and
-            // next == ':'
-            
-            if (next &&
-                next.type == 'PUNC' &&
-                next.data == ':' && 
-                last && 
-                last.type == 'PUNC' &&
-                (last.data == ',' || last.data == '{')
-            ){
-                continue; // found object key... - we can not translate these
-            }
-                
-            var sval = t.data.substring(1,t.data.length-1);
-            var ffn = fn.substring(_this.prefix.length);
-            
-            t.trsum = _this.md5(ffn + '-' + sval);
-            map[sval] = t.trsum;
-            
-            
-            
-        }
-        
-        
-        var transfile = minfile + '.lang.trans';
-        var transmd5 = minfile + '.lang';
-        print("writeTranslateFile "  + transfile);
-        var i = 0;
-        var v = '';
-        if (File.exists(transfile)) {
-            File.remove(transfile);
-        }
-        if (File.exists(transmd5)) {
-            File.remove(transmd5);
-        }
-        for(v in map) { i++; break };
-        if (!i ) {
-            return; // no strings in file...
-        }
-        var ffn = fn.substring(this.prefix.length);
-         
-         
-        File.write(transfile, "\n'" + ffn  + "' : {");
-        var l = '';
-        var _tout = {}
-         
-        File.write(transmd5, '');
-        for(v in map) {
-            if (!v.length) {
-                continue;
-            }
-            File.append(transfile, l + "\n\t\"" + v  + "\" : \"" + v +"\"");
-            l = ',';
-            // strings are raw... - as the where encoded to start with!!!
-            // so we should not need to encode them again.. - just wrap with "
-            File.append(transmd5, '_T["' + this.md5(ffn + '-' + v) + '"]="'+v+"\";\n");
-        }
-        File.append(transfile, "\n},"); // always one trailing..
-        
-         
-    },
     md5 : function (string)
     {