From efef056e16fd9848adef3eb7ed2246a0816745c5 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Thu, 7 Apr 2022 12:10:50 +0100 Subject: [PATCH] Add support for click 8.1.x click 8.1.0 changed the behavior of the various stored help strings: Store unprocessed Command.help, epilog and short_help strings. Processing is only done when formatting help text for output. [1] https://click.palletsprojects.com/en/8.1.x/changes/#version-8-1-0 Signed-off-by: Stephen Finucane --- sphinx_click/ext.py | 3 ++- tests/test_formatter.py | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sphinx_click/ext.py b/sphinx_click/ext.py index 4441588..b6bf205 100644 --- a/sphinx_click/ext.py +++ b/sphinx_click/ext.py @@ -1,3 +1,4 @@ +import inspect import re import traceback import warnings @@ -101,7 +102,7 @@ def _write_opts(opts): def _format_help(help_string): - help_string = ANSI_ESC_SEQ_RE.sub('', help_string) + help_string = inspect.cleandoc(ANSI_ESC_SEQ_RE.sub('', help_string)) bar_enabled = False for line in statemachine.string2lines( diff --git a/tests/test_formatter.py b/tests/test_formatter.py index 0cc8651..07b7230 100644 --- a/tests/test_formatter.py +++ b/tests/test_formatter.py @@ -377,7 +377,6 @@ def foobar(): foobar [OPTIONS] - An epilog containing pre-wrapped text. | This is