🐛 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
parent
23d719eff7
commit
0c059bb6d8
3
justfile
3
justfile
|
@ -7,6 +7,7 @@ _map:
|
||||||
recsel game.rec | recfmt '"{{{{name}}": "{{{{id}}", '
|
recsel game.rec | recfmt '"{{{{name}}": "{{{{id}}", '
|
||||||
|
|
||||||
# build dot file
|
# build dot file
|
||||||
|
# TODO: change id to name? or id /and/ name?
|
||||||
_dot:
|
_dot:
|
||||||
#!/usr/bin/env zsh
|
#!/usr/bin/env zsh
|
||||||
echo "digraph {" > dot
|
echo "digraph {" > dot
|
||||||
|
@ -14,7 +15,7 @@ _dot:
|
||||||
| recfmt '{{{{id}} -> {{{{text}}|' \
|
| recfmt '{{{{id}} -> {{{{text}}|' \
|
||||||
| sed -e 's/|/\n\n/g' \
|
| sed -e 's/|/\n\n/g' \
|
||||||
| sed -e '/./{H;$!d;}' -e 'x; s/\n//g; 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 '/{{{{/!d' -e 's/\.$//' \
|
||||||
| sed -e 's/> \(.*\)$/> { \1 };/' \
|
| sed -e 's/> \(.*\)$/> { \1 };/' \
|
||||||
>> dot
|
>> dot
|
||||||
|
|
Loading…
Reference in New Issue