Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] cdWriterDocstring - don't word-wrap inside CODE sections #2576

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions docs/python/doxygenlib/cdWriterDocstring.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,17 @@ def __wordWrapDocString(self, lines):
# following lines of a list item are indented at the same
# level. We word wrap the text, but don't break long words
# as we don't want to word wrap code sections.
# Take extra care with doxygen lifted CODE block lines.
textWrapper = textwrap.TextWrapper(width=70, break_long_words=False)
newlines = list(map(textWrapper.fill, newlines))
wrapped_lines = []
for line in newlines:
if line.startswith("CODE_START"): # skip line wrapping on codeblock - manually unwrapped below
wrapped_lines.append(line)
else:
wrapped_lines.append(textWrapper.fill(line))
lines = []
inlistitem = False
for curline in newlines:
for curline in wrapped_lines:
# the textwrap.fill call adds \n's at line breaks
for line in curline.split('\n'):
if line.startswith(" - "):
Expand Down