|
1 | 1 | #!/usr/bin/env python3 |
2 | 2 | # -*- coding: utf-8 -*- |
3 | 3 | # |
4 | | -# This file is part of snapos |
5 | | -# Copyright (C) 2022 Johannes Pohl |
| 4 | +# This file is part of snapweb |
| 5 | +# Copyright (C) 2022-2025 Johannes Pohl |
6 | 6 | # |
7 | 7 | # This program is free software: you can redistribute it and/or modify |
8 | 8 | # it under the terms of the GNU General Public License as published by |
|
28 | 28 | with open(sys.argv[1], 'r') as file: |
29 | 29 | data = file.read() |
30 | 30 |
|
31 | | - data = re.sub('^\s*# Snapweb changelog *\n*', |
| 31 | + # Remove '# Snapweb changelog' |
| 32 | + data = re.sub(r'^\s*# Snapweb changelog *\n*', |
32 | 33 | '', data, flags=re.MULTILINE) |
33 | | - data = re.sub('^\s*### ([a-zA-Z]+) *\n', |
| 34 | + # Remove Contributors section |
| 35 | + data = re.sub(r'^\s*### Contributors *\n*( *-.*\n)*', |
| 36 | + '', data, flags=re.MULTILINE) |
| 37 | + # Replace '### <text>' with ' * <text>' |
| 38 | + data = re.sub(r'^\s*### ([a-zA-Z]+) *\n', |
34 | 39 | r'\n * \1\n', data, flags=re.MULTILINE) |
35 | | - data = re.sub('^\s*## Version\s+(\S*) *\n', |
| 40 | + # Replace '## Version <ver>' with 'snapcast (<ver>-1) unstable; urgency=medium' |
| 41 | + data = re.sub(r'^\s*## Version\s+(\S*) *\n', |
36 | 42 | r'snapweb (\1-1) unstable; urgency=medium\n', data, flags=re.MULTILINE) |
37 | | - data = re.sub('^\s*-\s*(.*) *\n', r' -\1\n', data, flags=re.MULTILINE) |
38 | | - data = re.sub('^_(.*)_ *\n', r' -- \1\n\n', data, flags=re.MULTILINE) |
| 43 | + # Replace bullets with ' -' |
| 44 | + data = re.sub(r'^\s*-\s*(.*) *\n', r' -\1\n', data, flags=re.MULTILINE) |
| 45 | + data = re.sub(r'^_(.*)_ *\n', r' -- \1\n\n', data, flags=re.MULTILINE) |
39 | 46 |
|
40 | 47 | print(data) |
0 commit comments