如何在 Graphviz/dot 文件格式中将 Ant 专用目标名称用作 node_ids?
How do I use Ant private target names as node_ids in the Graphviz/dot file format?
我想使用点文件格式和 Graphviz 创建 Ant 任务和依赖关系图。与许多 Ant 脚本一样,它们使用 "private targets"。也就是说,目标名称以破折号 (-
).
开头
我正在做一个任务列表,比如
<target name="foo" depends="-init">
<target name="-init">
然后像这样创建一个点文件(有点冗长,但这不是问题)。
digraph {
foo;
foo -> -init;
-init;
}
我尝试 运行 通过 dot
程序创建一个 .PNG
并且它抱怨 node_id!
中的破折号
> dot -Tpng -o graph.png graph.gv
Error: graph.gv:3: syntax error near line 3
context: >>> - <<< init;
我可以用下划线或其他东西替换所有破折号,但这会扰乱源文件的可搜索性。有什么方法可以转义或编码破折号,以便我可以保持源信息正确吗?
我找不到全面的点文件格式或语言描述。这描述了 AST,但没有定义 node_id
.
的有效值
简直
digraph {
foo;
foo -> "-init";
"-init";
}
或
digraph {
foo;
foo -> init;
init [label="-init"];
}
允许边使用漂亮的短名称
我想使用点文件格式和 Graphviz 创建 Ant 任务和依赖关系图。与许多 Ant 脚本一样,它们使用 "private targets"。也就是说,目标名称以破折号 (-
).
我正在做一个任务列表,比如
<target name="foo" depends="-init">
<target name="-init">
然后像这样创建一个点文件(有点冗长,但这不是问题)。
digraph {
foo;
foo -> -init;
-init;
}
我尝试 运行 通过 dot
程序创建一个 .PNG
并且它抱怨 node_id!
> dot -Tpng -o graph.png graph.gv
Error: graph.gv:3: syntax error near line 3
context: >>> - <<< init;
我可以用下划线或其他东西替换所有破折号,但这会扰乱源文件的可搜索性。有什么方法可以转义或编码破折号,以便我可以保持源信息正确吗?
我找不到全面的点文件格式或语言描述。这描述了 AST,但没有定义 node_id
.
简直
digraph {
foo;
foo -> "-init";
"-init";
}
或
digraph {
foo;
foo -> init;
init [label="-init"];
}
允许边使用漂亮的短名称