src/JsRender/Node.vala
authorAlan Knowles <alan@roojs.com>
Tue, 17 Feb 2015 07:44:30 +0000 (15:44 +0800)
committerAlan Knowles <alan@roojs.com>
Tue, 17 Feb 2015 07:44:30 +0000 (15:44 +0800)
src/JsRender/Node.vala

index 5328abb..aeb8d84 100644 (file)
@@ -382,7 +382,7 @@ public class JsRender.Node : Object {
                if (Node.gen == null) {
                        Node.gen = new Json.Generator();
                        gen.pretty =  true;
-                       gen.indent = 4;
+                       gen.indent = 1;
                }
                var n = new Json.Node(Json.NodeType.OBJECT);
                n.set_object(this.toJsonObject () );
@@ -506,7 +506,14 @@ public class JsRender.Node : Object {
                
                if (this.has("layout")) { txt += ("<i>" + GLib.Markup.escape_text(this.get("layout")) + "</i>"); }
                if (this.has("title"))   { txt += ("<b>" + GLib.Markup.escape_text(this.get("title")) + "</b>"); }
-               if (this.has("html"))    { txt += ("<b>" + GLib.Markup.escape_text(this.get("html")) + "</b>"); }
+               if (this.has("html") && this.get("html").length > 0)     { 
+                       var ht = this.get("html").split("\n");
+                       if (ht.length > 1) {
+                               txt += ("<b>" + GLib.Markup.escape_text(ht[0]) + "...</b>");
+                       } else { 
+                               txt += ("<b>" + GLib.Markup.escape_text(this.get("html")) + "</b>");
+                       }
+               }
                if (this.has("label"))   { txt += ("<b>" + GLib.Markup.escape_text(this.get("label"))+ "</b>"); }
                if (this.has("header"))   { txt += ("<b>" + GLib.Markup.escape_text(this.get("header")) + "</b>"); }
                if (this.has("legend"))  { txt += ("<b>" + GLib.Markup.escape_text(this.get("legend")) + "</b>"); }