Closed AdamWill closed 2 years ago
One option might be to switch GistPattern
to inherit from InlineProcessor
(or a subclass of it) instead of Pattern
, as InlineProcessor
doesn't 'wrap' the pattern when compiling it. I am not sure what the overall implications of that would be, though.
OK, yeah, I think just inheriting from InlineProcessor
instead should work. Testing that now.
Environment
Python Version: 3.11
Nikola Version: 8.2.2 (and git master, this code has not changed)
Operating System: Fedora Rawhide
Description:
Nikola will not work with Python 3.11. Here's a simplification of something
nikola/plugins/compile/markdown/mdx_gist.py
does:The original code does
GistPattern(GIST_RST_RE)
, andGistPattern
inherits frommarkdown.inlinepatterns.Pattern
, and that class's__init__()
doesre.compile(r"^(.*?)%s(.*)$" % pattern)
wherepattern
is the arg passed in.If you run that test script on Python 3.10, you get a warning:
On Python 3.11, this warning has been turned into a fatal error:
The problematic bit of
GIST_RST_RE
is the(?m)
at the start, which is trying to set multiline mode. If you drop that the error goes away, but of course I'm not sure if that is the appropriate fix or would cause other problems. I can't offhand see an easy way to fix this while preserving the multiline mode setting though.