🐛 fix regex

the regex for building the DOT text was too greedy! in cases where there
were more than two branches in a given text, it would only match the
first branch and the second branch. because of how greedy it was.

so hopefully this should fix that. at least, graph.png looks correct to
me now.
main
dozens 4 months ago
parent 23d719eff7
commit 0c059bb6d8
  1. 3
      justfile

@ -7,6 +7,7 @@ _map:
recsel game.rec | recfmt '"{{{{name}}": "{{{{id}}", '
# build dot file
# TODO: change id to name? or id /and/ name?
_dot:
#!/usr/bin/env zsh
echo "digraph {" > dot
@ -14,7 +15,7 @@ _dot:
| recfmt '{{{{id}} -> {{{{text}}|' \
| sed -e 's/|/\n\n/g' \
| sed -e '/./{H;$!d;}' -e 'x; s/\n//g; G;' \
| sed -e 's/}}.*{{{{/}} {{{{/g' -e 's/> [^{]* {{{{/> {{{{/' \
| sed -e 's/}}[^{]*{{{{/}} {{{{/g' -e 's/> [^{]* {{{{/> {{{{/' \
| sed -e '/{{{{/!d' -e 's/\.$//' \
| sed -e 's/> \(.*\)$/> { \1 };/' \
>> dot

Loading…
Cancel
Save