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.
(cherry picked from commit
9b0d0c017315c0850cde5df95609d1d0982c784f)
"""
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()
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"])