summaryrefslogtreecommitdiff
path: root/projgraph
diff options
context:
space:
mode:
Diffstat (limited to 'projgraph')
-rwxr-xr-xprojgraph16
1 files changed, 16 insertions, 0 deletions
diff --git a/projgraph b/projgraph
index 2e3b0ca..62c54f2 100755
--- a/projgraph
+++ b/projgraph
@@ -1,10 +1,14 @@
#!/usr/bin/python3
import sys
+import textwrap
import yaml
+LABEL_WIDTH = 20
+
+
unknown = 0
blocked = 1
finished = 2
@@ -113,6 +117,17 @@ def set_status(tasks):
unknown_tasks = find_unknown(tasklist)
+def wrap_labels(tasks):
+ for name in tasks:
+ task = tasks[name]
+ if 'label' in task:
+ label = task['label']
+ if '\n' not in label:
+ label = textwrap.wrap(label, width=LABEL_WIDTH)
+ label = '\n'.join(label)
+ task['label'] = label
+
+
obj = yaml.safe_load(sys.stdin)
ikiwiki = sys.argv[1:] == ['ikiwiki']
@@ -122,6 +137,7 @@ else:
print('digraph "project" {')
tasks = obj.get('tasks', obj)
+wrap_labels(tasks)
set_status(tasks)
for name, task in tasks.items():
print('{} [label="{}"]'.format(name, task['label']))