From: Nicki Křížek Date: Mon, 2 Dec 2024 10:10:01 +0000 (+0100) Subject: gitchangelog: don't break lines on hyphens in relnotes X-Git-Tag: v9.21.3~5^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9b0d0c017315c0850cde5df95609d1d0982c784f;p=thirdparty%2Fbind9.git gitchangelog: don't break lines on hyphens in relnotes When release notes are generated, the text is wrapped and line breaks are inserted into each paragraph (sourced from the commit message's body). Prevent line breaks after hyphens, as these are often used for option names. This makes it possible to easily find the options afterwards. --- diff --git a/contrib/gitchangelog/gitchangelog.py b/contrib/gitchangelog/gitchangelog.py index b466c38c709..7d22fe483d5 100755 --- a/contrib/gitchangelog/gitchangelog.py +++ b/contrib/gitchangelog/gitchangelog.py @@ -561,7 +561,8 @@ def paragraph_wrap(text, regexp="\n\n", separator="\n"): """ regexp = re.compile(regexp, re.MULTILINE) return separator.join( - "\n".join(textwrap.wrap(paragraph.strip())) for paragraph in regexp.split(text) + "\n".join(textwrap.wrap(paragraph.strip(), break_on_hyphens=False)) + for paragraph in regexp.split(text) ).strip() @@ -1514,7 +1515,12 @@ def rest_py(data, opts={}): if opts["include_commit_sha"]: subject += " ``%s``" % commit["commit"].sha1_short - entry = indent("\n".join(textwrap.wrap(subject)), first="- ").strip() + "\n" + entry = ( + indent( + "\n".join(textwrap.wrap(subject, break_on_hyphens=False)), first="- " + ).strip() + + "\n" + ) if commit["body"]: entry += "\n" + indent(commit["body"])