Fix issue https://github.com/ellson/graphviz/issues/1166.
authorEmden R. Gansner <erg@emdenrg.net>
Sun, 30 Oct 2016 21:26:58 +0000 (17:26 -0400)
committerEmden R. Gansner <erg@emdenrg.net>
Sun, 30 Oct 2016 21:26:58 +0000 (17:26 -0400)
lib/common/emit.c
lib/common/htmltable.c

index e8ad87dfceeda0ff5f2e56c7076fb043c0faf867..09bcd34b5e17c988b5980b91442db25cbc0d0415 100644 (file)
@@ -1984,8 +1984,14 @@ static void emit_node(GVJ_t * job, node_t * n)
 
        emit_begin_node(job, n);
        ND_shape(n)->fns->codefn(job, n);
-       if (ND_xlabel(n) && ND_xlabel(n)->set)
+       if (ND_xlabel(n) && ND_xlabel(n)->set) {
+           obj_state_t *obj = push_obj_state(job);
+           obj->type = NODE_OBJTYPE;
+           obj->u.n = n;
+           obj->emit_state = EMIT_NDRAW;
            emit_label(job, EMIT_NLABEL, ND_xlabel(n));
+           pop_obj_state(job);
+       }
        emit_end_node(job);
     }
 }
index 8962f813463b6b80fb31ef118960be984b2988db..d81e04bc88e64ad8e1c1302f4a78eacdf326fb14 100644 (file)
@@ -545,7 +545,7 @@ static void emit_html_tbl(GVJ_t * job, htmltbl_t * tbl, htmlenv_t * env)
     pts.UR.y += pos.y;
 
     if (doAnchor && !(job->flags & EMIT_CLUSTERS_LAST))
-       anchor = initAnchor(job, env, &tbl->data, pts, &saved, 1);
+       anchor = initAnchor(job, env, &tbl->data, pts, &saved, 0);
     else
        anchor = 0;
 
@@ -582,13 +582,26 @@ static void emit_html_tbl(GVJ_t * job, htmltbl_t * tbl, htmlenv_t * env)
                emit_html_rules(job, cp, env, tbl->data.pencolor, *cells);
        }
 
-       if (tbl->data.border)
+       if (tbl->data.border) {
+           if (anchor) {
+               agxbuf xb;
+               obj_state_t *obj = job->obj;
+               unsigned char buf[SMALLBUF];
+               agxbinit(&xb, SMALLBUF, buf);
+               agxbput(&xb, obj->id);
+               agxbputc(&xb, 'b');
+               char* id = agxbuse(&xb);
+               gvrender_begin_anchor(job,
+                             obj->url, obj->tooltip, obj->target,
+                             id);
+               agxbfree(&xb);
+           }
            doBorder(job, &tbl->data, pts);
-
+       }
     }
 
     if (anchor)
-       endAnchor(job, &saved, 1);
+       endAnchor(job, &saved, 0);
 
     if (doAnchor && (job->flags & EMIT_CLUSTERS_LAST)) {
        if (initAnchor(job, env, &tbl->data, pts, &saved, 0))
@@ -645,7 +658,7 @@ static void emit_html_cell(GVJ_t * job, htmlcell_t * cp, htmlenv_t * env)
     pts.UR.y += pos.y;
 
     if (doAnchor && !(job->flags & EMIT_CLUSTERS_LAST))
-       inAnchor = initAnchor(job, env, &cp->data, pts, &saved, 1);
+       inAnchor = initAnchor(job, env, &cp->data, pts, &saved, 0);
     else
        inAnchor = 0;
 
@@ -675,7 +688,7 @@ static void emit_html_cell(GVJ_t * job, htmlcell_t * cp, htmlenv_t * env)
     }
 
     if (inAnchor)
-       endAnchor(job, &saved, 1);
+       endAnchor(job, &saved, 0);
 
     if (doAnchor && (job->flags & EMIT_CLUSTERS_LAST)) {
        if (initAnchor(job, env, &cp->data, pts, &saved, 0))