Debian Codegraph @

tools/link_issues_CHANGELOG

raw
1 #!/bin/bash
2
3 in=CHANGELOG.md
4
5 # Replace them with Markdown references
6 sed -i -e 's/(\(#[0-9]\+\))/([\1][])/g' "$in"
7
8 # Populate references
9 tr ' ,' '\n\n' < "$in" | sponge | sed -n -e 's/.*(\[#\([0-9]\+\)\]\(\[\]*\)).*/\1/gp' | sort | uniq \
10 | while read issue; do
11 #echo "issue $issue"
12 # remove old one if exists
13 sed -i -e "/^\[#$issue\]:.*/d" "$in"
14 echo "[#$issue]: https://github.com/datalad/datalad/issues/$issue" >> "$in";
15 done