JSDOC/Packer.js
[gnome.introspection-doc-generator] / JSDOC / Packer.js
index c44fe64..eb482f5 100644 (file)
@@ -460,6 +460,24 @@ Packer.prototype = {
         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];
@@ -470,8 +488,8 @@ Packer.prototype = {
                 continue;
             }
             
-            last = i > 0 ? toks[i-1] : false;
-            next = i+1 < toks.length ? toks[i+1] : false;
+            last = tokfind(i,-1);
+            next = tokfind(i,+1);
             
             // we have to ignore key values on objects
             
@@ -498,9 +516,7 @@ Packer.prototype = {
             
             
         }
-        toks.forEach(function (t) {
-            
-        })
+        
         
         var transfile = minfile + '.lang.trans';
         var transmd5 = minfile + '.lang';
@@ -529,10 +545,11 @@ Packer.prototype = {
             if (!v.length) {
                 continue;
             }
-            File.append(transfile, l + "\n\t" + JSON.stringify(v) + " : " + JSON.stringify(v));
+            File.append(transfile, l + "\n\t\"" + v  + "\" : \"" + v);
             l = ',';
             // strings are raw... - as the where encoded to start with!!!
-            File.append(transmd5, '_T["' + this.md5(ffn + '-' + v) + '"]='+JSON.stringify(v)+";\n");
+            // 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..