Fix #8004 - try and fix start line / end line cached node output
[roobuilder] / src / JsRender / Roo.vala
index 33f76aa..c6ba188 100644 (file)
@@ -23,8 +23,10 @@ namespace JsRender {
 
  
         
-        public Roo(Project.Project project, string path) {
-            aconstruct( project, path);
+        public Roo(Project.Roo project, string path) 
+        {
+            base( project, path);
             this.xtype = "Roo";
              this.language = "js";
             
@@ -113,7 +115,9 @@ namespace JsRender {
                        this.permname = this.jsonHasOrEmpty(obj, "permname");
                        this.title = this.jsonHasOrEmpty(obj, "title");
                        this.modOrder = this.jsonHasOrEmpty(obj, "modOrder");
-
+                       if (obj.has_member("gen_extended")) { // should check type really..
+                               this.gen_extended = obj.get_boolean_member("gen_extended");
+                       }
                        var bjs_version_str = this.jsonHasOrEmpty(obj, "bjs-version");
                        bjs_version_str = bjs_version_str == "" ? "1" : bjs_version_str;
 
@@ -189,13 +193,19 @@ namespace JsRender {
                        
                }
 
-        
+        public Project.Roo roo_project {
+               set {}  
+               get { 
+                       return (Project.Roo) this.project;
+               }
+       }
+                       
 
         
        public override void saveHTML ( string html )
        {
-               GLib.debug ("SAVEHTML %s\n",  this.project.runhtml);             
-               if (this.project.runhtml == "") {
+               GLib.debug ("SAVEHTML %s\n",  this.roo_project.runhtml);                 
+               if (this.roo_project.runhtml == "") {
                        return;
                }
                 
@@ -247,8 +257,9 @@ namespace JsRender {
                        if (node.props.has_key("* xinclude")) {
                                ret.add(node.props.get("* xinclude").val);
                        }
-                       for (var i =0; i < node.items.size; i++) {
-                               this.findxincludes(node.items.get(i), ret);
+                       var items = node.readItems();
+                       for (var i =0; i < items.size; i++) {
+                               this.findxincludes(items.get(i), ret);
                        }
                        return ret;
                                
@@ -302,7 +313,7 @@ namespace JsRender {
                                var chksum = GLib.Checksum.compute_for_string (ChecksumType.MD5, str.strip());
                                
                                if (this.doubleStringProps.index_of(kname) > -1) {
-                                       GLib.debug("flag=%s type=%s name=%s : %s\n", prop.ptype.to_string(),ktype,kname,str);
+                                       //GLib.debug("flag=%s type=%s name=%s : %s\n", prop.ptype.to_string(),ktype,kname,str);
                                        this.transStrings.set(str,  chksum);
                                        named.set("_" + kname, chksum);
                                        continue;
@@ -323,10 +334,10 @@ namespace JsRender {
                                }
                         }
 
-                       
+                       var items = node.readItems();
                        // iterate children..
-                       for (var i =0; i < node.items.size; i++) {
-                               this.findTransStrings(node.items.get(i) );
+                       for (var i =0; i < items.size; i++) {
+                               this.findTransStrings(items.get(i) );
                        }
                
                                
@@ -395,7 +406,7 @@ namespace JsRender {
                        if (xinc.size > 0 ) {
                                for(var i = 0; i < xinc.size; i++) {
                                        print("check xinclude:  %s\n", xinc.get(i));
-                                       var sf = this.project.getByName(xinc.get(i));
+                                       var sf = this.project.getByRelPath(xinc.get(i));
                                        if (sf == null) {
                                                print("Failed to find file by name?\n");
                                                continue;
@@ -522,17 +533,11 @@ namespace JsRender {
                        if (this.tree == null) {
                                return "";
                        }
-                       var x = new NodeToJs(this.tree, this.doubleStringProps, pad, null);
-                       x.renderer = this;
-                       x.cur_line = prefix.split("\n").length;
-                       
+
+                       var x = new NodeToJs( this,  this.tree,   pad , null, this.doubleStringProps);
+                       x.addMultiLine(prefix, false); 
                        var ret = x.munge();
-                       //var nret = x.ret;
-                       
-                       // output both files.. so we can diff them...
-                       //this.writeFile("/tmp/old.js", ret);
-                       //this.writeFile("/tmp/new.js", nret);                  
-                       return prefix +  ret + suffix;
+                       return  ret + suffix;
                        
                    
                }
@@ -788,6 +793,10 @@ namespace JsRender {
                {
                        return "Roo files do not convert to glade";
                }
+               public   override string language_id() 
+               {
+                       return "javascript";
+               }
      
     }
 }