Skip to content

Commit

Permalink
py311 compatibility
Browse files Browse the repository at this point in the history
python 3.11 prevents use of global flags not at the start
of the regex. Mistune does something with the regex that
conflicts with the use of a global flag (even at the start
of the regex) and pre-compiling does not work. Instead
of using DOTALL use [\w\W].
  • Loading branch information
braingram committed Jul 7, 2023
1 parent 94eab05 commit 1ced3c9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .github/workflows/sphinx_asdf_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ jobs:
strategy:
matrix:
include:
- name: Python 3.11 Tests
python-version: "3.11"
os: ubuntu-latest
toxenv: py311

- name: Python 3.10 Tests
python-version: "3.10"
os: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion sphinx_asdf/md2rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ def md2rst(content):
converter = mistune.create_markdown(renderer=renderer)
INLINE_MATH_PATTERN = r"\$\$?(?!\s)(?P<math_text>.+?)(?!\s)(?<!\\)\$\$?"
converter.inline.register("inline_math", INLINE_MATH_PATTERN, parse_inline_math, before="link")
BLOCK_MATH_PATTERN = r"(?s)\$\$(?P<math_text>.*?)\$\$"
BLOCK_MATH_PATTERN = r"\$\$(?P<math_text>[\w\W]*?)\$\$"
converter.block.register("block_math", BLOCK_MATH_PATTERN, parse_block_math, before="list")
return converter(content)

0 comments on commit 1ced3c9

Please sign in to comment.