Don't break long/hyphenated words in RST creation

The textwrap module by default breaks hyphenated words across line
wrapping boundaries, which Sphinx will then reinterpret as
whitespace. Disable this behavior so that hyphenated words will be
moved to the next line rather than broken at their hyphens. Also
disable a related feature which would break lines longer than the
target line length, allowing one-word lines longer than that.

Change-Id: I2ce8dcd4d67b658817857167e218913c75df0bda
This commit is contained in:
Jeremy Stanley 2020-10-13 17:54:46 +00:00
parent b0a7065e03
commit e50bcab88c
1 changed files with 2 additions and 1 deletions

View File

@ -24,7 +24,8 @@ def to_snake_case(d):
def to_paragraphs(d, *args):
for k in args:
if k in d and isinstance(d[k], str):
d[k] = '\n'.join(textwrap.wrap(d[k]))
d[k] = '\n'.join(textwrap.wrap(
d[k], break_long_words=False, break_on_hyphens=False))
def ossa_date_formatter(value):