and add support for 'tooltip="xxx"' as an alias for title.
return 0;
}
+static int titlefn(htmldata_t * p, char *v)
+{
+ p->title = strdup(v);
+ return 0;
+}
+
static int portfn(htmldata_t * p, char *v)
{
p->port = strdup(v);
{"href", (attrFn) hreffn},
{"port", (attrFn) portfn},
{"target", (attrFn) targetfn},
+ {"title", (attrFn) titlefn},
+ {"tooltip", (attrFn) titlefn},
{"valign", (attrFn) valignfn},
{"width", (attrFn) widthfn},
};
{"port", (attrFn) portfn},
{"rowspan", (attrFn) rowspanfn},
{"target", (attrFn) targetfn},
+ {"title", (attrFn) titlefn},
+ {"tooltip", (attrFn) titlefn},
{"valign", (attrFn) valignfn},
{"width", (attrFn) widthfn},
};
static void doAnchorStart(GVC_t * gvc, htmldata_t * data, void *obj)
{
- gvrender_begin_anchor(gvc, data->href, "", data->target);
+ gvrender_begin_anchor(gvc, data->href, data->title, data->target);
}
static void doAnchorEnd(GVC_t * gvc)
free(dp->href);
free(dp->port);
free(dp->target);
+ free(dp->title);
free(dp->bgcolor);
}
char *href; /* pointer to an external resource */
char *port;
char *target;
+ char *title;
char *bgcolor;
char *pencolor;
signed char space;
static void doHTMLdata(htmldata_t * dp, point p, void *obj)
{
- char *url, *target;
+ char *url, *target, *title;
pointf p1, p2;
+ int havetitle=0;
if ((url = dp->href) && url[0]) {
if (!(target = dp->target) || !target[0]) {
target = "";
}
+ if ((title = dp->title) && title[0]) {
+ havetitle++;
+ switch (agobjkind(obj)) {
+ case AGGRAPH:
+ title = strdup_and_subst_graph(title, (graph_t *) obj);
+ break;
+ case AGNODE:
+ title = strdup_and_subst_node(title, (node_t *) obj);
+ break;
+ case AGEDGE:
+ title = strdup_and_subst_edge(title, (edge_t *) obj);
+ break;
+ }
+ }
+ else {
+ title = "";
+ }
p1.x = p.x + dp->box.LL.x;
p1.y = p.y + dp->box.LL.y;
p2.x = p.x + dp->box.UR.x;
p2.y = p.y + dp->box.UR.y;
- map_output_rect(p1, p2, url, target, "", 0);
+ map_output_rect(p1, p2, url, target, "", title);
free(url);
+ if (havetitle)
+ free(title);
}
}