Skip to content

Commit aa851a3

Browse files
authored
Merge pull request #30 from hoefling/enable-directive-regex-flags
Respect directive regex flags
2 parents cceaeab + 3e332ee commit aa851a3

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

.github/workflows/tests.yml

+6-4
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ on:
88

99
jobs:
1010
build:
11-
12-
runs-on: ubuntu-latest
1311
strategy:
1412
matrix:
15-
python-version: [3.6, 3.7, 3.8, 3.9, '3.10', '3.11']
16-
13+
os: [ubuntu-latest]
14+
python-version: [3.7, 3.8, 3.9, '3.10', '3.11']
15+
include:
16+
- os: ubuntu-20.04
17+
python-version: 3.6
18+
runs-on: ${{ matrix.os }}
1719
steps:
1820
- uses: actions/checkout@v2
1921
- name: Set up Python ${{ matrix.python-version }}

docstring_to_markdown/rst.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ def looks_like_rst(value: str) -> bool:
339339
if (section + '\n' + '-' * len(section) + '\n') in value:
340340
return True
341341
for directive in RST_DIRECTIVES:
342-
if re.search(directive.pattern, value):
342+
if re.search(directive.pattern, value, directive.flags):
343343
return True
344344
# allow "text::" or "text ::" but not "^::$" or "^:::$"
345345
return bool(re.search(r'(\s|\w)::\n', value) or '\n>>> ' in value)

tests/test_rst.py

+1
Original file line numberDiff line numberDiff line change
@@ -837,6 +837,7 @@ def test_looks_like_rst_recognises_rst():
837837
assert looks_like_rst('the following code::\n\n\tcode')
838838
assert looks_like_rst('See Also\n--------\n')
839839
assert looks_like_rst('.. versionadded:: 0.1')
840+
assert looks_like_rst('Description.\n\n:param spam: eggs.\n')
840841

841842

842843
def test_looks_like_rst_ignores_plain_text():

0 commit comments

Comments
 (0)