src/JsRender/Roo.vala
[app.Builder.js] / src / JsRender / Roo.vala
index 6151b35..2eaba7a 100644 (file)
@@ -87,7 +87,7 @@ namespace JsRender {
         {
             
                                 
-                       print("load Items!");
+                       GLib.debug("load Items!");
                        if (this.tree != null) {
                                return;
                        }
@@ -269,11 +269,16 @@ namespace JsRender {
                                if (kflag == "$") {
                                        continue;
                                }
+                               // skip cms-id nodes...
+                               if (kname == "html" && node.has("cms-id")) { 
+                                       continue;
+                               }
+                               
                                var str = iter.get_value();
                                if (this.doubleStringProps.index_of(kname) > -1) {
                                        print("flag=%s type=%s name=%s : %s\n", kflag,ktype,kname,str);
                                        this.transStrings.set(str,  
-                                               GLib.Checksum.compute_for_string (ChecksumType.MD5, str)
+                                               GLib.Checksum.compute_for_string (ChecksumType.MD5, str.strip())
                                        );
                                        continue;
                                }
@@ -281,7 +286,7 @@ namespace JsRender {
                                if (ktype.down() == "string" && kname[0] == '_') {
                                        print("flag=%s type=%s name=%s : %s\n", kflag,ktype,kname,str);
                                        this.transStrings.set(str,  
-                                               GLib.Checksum.compute_for_string (ChecksumType.MD5, str)
+                                               GLib.Checksum.compute_for_string (ChecksumType.MD5, str.strip())
                                        );
                                        continue;
                                }
@@ -396,6 +401,13 @@ namespace JsRender {
          * 
          * 
          */
+        public override string toSourceCode() 
+        {
+                       this.transStrings = new Gee.HashMap<string,string>();
+                       this.findTransStrings(this.tree);
+                       return this.toSource();
+               }
+         
         public override string toSource()
         {
             // dump the file tree back out to a string.
@@ -411,10 +423,14 @@ namespace JsRender {
             if (top == null) {
                 return "";
             }
-            // get the translatable strings..
             
             
             
+            // get the translatable strings.. = we reload them again so calling methods get the right data...
+            this.transStrings = new Gee.HashMap<string,string>();
+                       this.findTransStrings(this.tree);
+            
+            
             if (top.contains("Dialog")) {
                 return this.toSourceDialog(false);
             }
@@ -453,6 +469,7 @@ namespace JsRender {
                                return "";
                        }
                        var x = new NodeToJs(this.tree, this.doubleStringProps, pad, null);
+                       x.renderer = this;
                        x.cur_line = prefix.split("\n").length;
                        
                        var ret = x.munge();