0

我有一组降价文件(虚拟实验室笔记本中的实验)将用于生成静态网页,我还想生成一个索引以与它们一起显示它们作为 DAG(有向无环图)的关系)。

到目前为止,每个降价文件都以这样的元数据开头(for exp3.md):

Follows: exp1.md exp2.md

我运行一个脚本来制作所有实验的DOT 语言图:

#!/bin/bash

arrows=$(
  for r in *.md; do
    for l in $(cat "$r" | grep Follows: | cut -d':' -f2); do
      echo "  $l -> $r;"
    done
  done
)

echo "digraph notebook {"
echo "$arrows" | sort | uniq
echo "}"

它像

digraph notebook {
  exp1.md -> exp3.md;
  exp2.md -> exp3.md;
}

但是我还没有找到任何软件可以把它变成一个可点击的图像地图。解决方案可以根据需要变得 hacky!我将亲自使用它并将站点托管在内部实验室网络上。

4

1 回答 1

1

事实证明这并不坏。只需将属性添加到 DOT 图:

digraph notebook {
  exp1 [label="experiment 1",URL="http://example.com/1"]
  exp2 [label="experiment 2",URL="http://example.com/2"]
  exp3 [label="experiment 3",URL="http://example.com/3"]
  exp1 -> exp3;
  exp2 -> exp3;
}

并创建imagemap代码+图像:

dot -Tcmapx graph.dot > graph.html
dot -Tpng   graph.dot > graph.png
于 2013-08-28T22:02:06.233 回答