Putting <> in label of an HTML table
I'm using tablels in GraphViz, and need to include <>
symbols in the label.
A regular table is fine:
a_node [
shape=plaintext;
label=<
<table border="0" cellborder="1" cellspacing="0">
<tr><td port='usr1' bgcolor="white">/user1 </td></tr>
<tr><td port='usr2' bgcolor="white">/user2 </td></tr>
<tr><td port='usr3' bgcolor="white">/... </td></tr>
<tr><td port='usrN' bgcolor="white">/userN </td></tr>
</table>
>
];
But when I try changing the last cell to contain the <>
as part of its HTML label, GV doesn't like it:
a_node [
shape=plaintext;
label=<
<table border="0" cellborder="1" cellspacing="0">
<tr><td port='usr1' bgcolor="white">/user1 </td></tr>
<tr><td port='usr2' bgcolor="white">/user2 </td></tr>
<tr><td port='usr3' bgcolor="white">/... </td></tr>
<tr><td port='usrN' bgcolor="white">/user<N> </td></tr>
</table>
>
];
"Error: Unknown HTML element on line 6.
Not really a surprise, the parser is trying to interpret the <N>
as a HTML.
Double quotes don't help.
Single quotes don't help.
Back quotes don't help.
Escaping the <> with a backslash gives the same error as ASCII or HTML codes below.
OK... ASCII Codes it is.
a_node [
shape=plaintext;
label=<
<table border="0" cellborder="1" cellspacing="0">
<tr><td port='usr1' bgcolor="white">/user1 </td></tr>
<tr><td port='usr2' bgcolor="white">/user2 </td></tr>
<tr><td port='usr3' bgcolor="white">/... </td></tr>
<tr><td port='usrN' bgcolor="white">/user<N> </td></tr>
</table>
>
];
Error: not well-formed (invalid token) in line 6 I tried various combinations here... adding spaces, pruning the leading 0, as I expected they failed consistently.
OK... HTML codes then.
a_node [
shape=plaintext;
label=<
<table border="0" cellborder="1" cellspacing="0">
<tr><td port='usr1' bgcolor="white">/user1 </td></tr>
<tr><td port='usr2' bgcolor="white">/user2 </td></tr>
<tr><td port='usr3' bgcolor="white">/... </td></tr>
<tr><td port='usrN' bgcolor="white">/user< N > </td></tr>
</table>
>
];
Error: not well-formed (invalid token) in line 6
My search in the documentation didn't turn anything up, but I'd not bet that the search string didn't get munged.
My search on stackoverflow didn't turn up anything -probably the closest was general string formatting https://stackoverflow.com/questions/24859937/format-string-in-graphviz
A wider web search didn't find what I was after.
I'm using Graphviz 3.28 on Windows.
Anyone have a suggestion?