From 9a4c22932e62ea6d1c47bf2af3829f23820410bb Mon Sep 17 00:00:00 2001 From: Stephen Mackenzie Date: Wed, 19 Jul 2023 15:55:40 -0400 Subject: [PATCH] [docs] cdWriterDocstring - don't word-wrap inside CODE sections --- docs/python/doxygenlib/cdWriterDocstring.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/python/doxygenlib/cdWriterDocstring.py b/docs/python/doxygenlib/cdWriterDocstring.py index 0bf50695da..d80207d2d2 100644 --- a/docs/python/doxygenlib/cdWriterDocstring.py +++ b/docs/python/doxygenlib/cdWriterDocstring.py @@ -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(" - "):