diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index db2807a..6ccb4e8 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 }} 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) 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():