From 03e7d6a8fdcfb0ef51254413e494997f7ae7e5f9 Mon Sep 17 00:00:00 2001 From: "oleg.hoefling" Date: Mon, 20 Mar 2023 16:28:07 +0100 Subject: [PATCH 1/4] chore: add test to reproduce the issue Signed-off-by: oleg.hoefling --- tests/test_rst.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_rst.py b/tests/test_rst.py index 5a81949..93f89ac 100644 --- a/tests/test_rst.py +++ b/tests/test_rst.py @@ -837,6 +837,7 @@ def test_looks_like_rst_recognises_rst(): assert looks_like_rst('the following code::\n\n\tcode') assert looks_like_rst('See Also\n--------\n') assert looks_like_rst('.. versionadded:: 0.1') + assert looks_like_rst('Description.\n\n:param spam: eggs.\n') def test_looks_like_rst_ignores_plain_text(): From 437e1141da367ea12ace20d103ebe1e98f4772b5 Mon Sep 17 00:00:00 2001 From: "oleg.hoefling" Date: Mon, 20 Mar 2023 16:30:28 +0100 Subject: [PATCH 2/4] fix: include directive flags in regex search Signed-off-by: oleg.hoefling --- docstring_to_markdown/rst.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docstring_to_markdown/rst.py b/docstring_to_markdown/rst.py index 42e2bc9..174f9de 100644 --- a/docstring_to_markdown/rst.py +++ b/docstring_to_markdown/rst.py @@ -339,7 +339,7 @@ def looks_like_rst(value: str) -> bool: if (section + '\n' + '-' * len(section) + '\n') in value: return True for directive in RST_DIRECTIVES: - if re.search(directive.pattern, value): + if re.search(directive.pattern, value, directive.flags): return True # allow "text::" or "text ::" but not "^::$" or "^:::$" return bool(re.search(r'(\s|\w)::\n', value) or '\n>>> ' in value) From 592eb5e30081f2cd6701850aac658784f250c17c Mon Sep 17 00:00:00 2001 From: "oleg.hoefling" Date: Mon, 20 Mar 2023 18:30:39 +0100 Subject: [PATCH 3/4] ensure ci for 3.6 runs on older ubuntu version that still supports 3.6 installation Signed-off-by: oleg.hoefling --- .github/workflows/tests.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index db2807a..bd37430 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,12 +8,14 @@ on: jobs: build: - - runs-on: ubuntu-latest strategy: matrix: - python-version: [3.6, 3.7, 3.8, 3.9, '3.10', '3.11'] - + os: ubuntu-latest + python-version: [3.7, 3.8, 3.9, '3.10', '3.11'] + include: + - os: ubuntu-20.04 + python-version: 3.6 + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} From 3e332ee6d27ff3d7f1716272ba0b09bf49beb16b Mon Sep 17 00:00:00 2001 From: "oleg.hoefling" Date: Mon, 20 Mar 2023 21:51:02 +0100 Subject: [PATCH 4/4] ci: fix wrong parameter enumeration in matrix configuration Signed-off-by: oleg.hoefling --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index bd37430..6ccb4e8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,7 +10,7 @@ jobs: build: strategy: matrix: - os: ubuntu-latest + os: [ubuntu-latest] python-version: [3.7, 3.8, 3.9, '3.10', '3.11'] include: - os: ubuntu-20.04