From c00cfa19ef165b79efd20f34b8ab9b9a9eea9905 Mon Sep 17 00:00:00 2001 From: Jonas van den Berg Date: Tue, 3 Sep 2024 20:01:00 +0200 Subject: [PATCH] Fix changelog generation --- scripts/fix-changelog.py | 8 ++++++-- scripts/generate-release-changelog | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/fix-changelog.py b/scripts/fix-changelog.py index c6f5ed1..01fa555 100644 --- a/scripts/fix-changelog.py +++ b/scripts/fix-changelog.py @@ -12,9 +12,13 @@ for line in sys.stdin: if len(line.strip()) == 0: + state = DEFAULT + print() print() continue - is_bullet_start = line.lstrip()[0] in ('-', '*', '+') + is_bullet_start = line.lstrip()[0] in ('-', '*', '+') \ + and line.lstrip()[1] not in ('-', '*', '+') + # print((is_bullet_start, line)) if state == BULLET and not is_bullet_start: if not linebreak: print(' ', end='') @@ -28,4 +32,4 @@ print(line.rstrip() + (' ' if linebreak else ''), end=('\n' if linebreak else '')) else: state = DEFAULT - print(line) + print(line.rstrip() + ' ', end='') diff --git a/scripts/generate-release-changelog b/scripts/generate-release-changelog index 21d57ac..3d1c848 100644 --- a/scripts/generate-release-changelog +++ b/scripts/generate-release-changelog @@ -11,7 +11,7 @@ VERSION=$1 cd $(dirname $0) mkdir -p out -sed "/^## $VERSION$/,/^## /!d;//d;/^$/d" ../CHANGELOG.md > out/tmp.txt +sed "/^## $VERSION$/,/^## /!d;//d" ../CHANGELOG.md > out/tmp.txt cat out/tmp.txt | python3 fix-changelog.py > out/tmp2.txt cp release-changelog.template.md out/changelog.md sed -e '/`insert:changelog`/ {' -e 'r out/tmp2.txt' -e 'd' -e '}' -i out/changelog.md