diff --git a/0001-mdx_gist-inherit-from-InlineProcessor-work-on-Python.patch b/0001-mdx_gist-inherit-from-InlineProcessor-work-on-Python.patch index c20c8a9..d9f7d19 100644 --- a/0001-mdx_gist-inherit-from-InlineProcessor-work-on-Python.patch +++ b/0001-mdx_gist-inherit-from-InlineProcessor-work-on-Python.patch @@ -1,4 +1,4 @@ -From a0cf60b79fa6e8f84551567a3e5f609e96871db4 Mon Sep 17 00:00:00 2001 +From 6edac30e23d7093f4658b61bb0f467b1b130b3fc Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Tue, 21 Jun 2022 11:01:15 -0700 Subject: [PATCH] mdx_gist: inherit from InlineProcessor, work on Python 3.11 @@ -21,18 +21,20 @@ implement `handleMatch`, which we already do. Our `handleMatch` uses named capture groups, so the change in the number of capture groups in the compiled expression shouldn't matter. So simply switching to inheriting from `InlineProcessor` instead -of `Pattern` should solve the problem. +of `Pattern` (and slightly adjusting the signature and return +values to match what's expected of `InlineProcessor` subclasses) +should solve the problem. We already required Markdown 3.0.0, so this does not mean we require a newer Markdown than before. Signed-off-by: Adam Williamson --- - nikola/plugins/compile/markdown/mdx_gist.py | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) + nikola/plugins/compile/markdown/mdx_gist.py | 17 ++++++++++------- + 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/nikola/plugins/compile/markdown/mdx_gist.py b/nikola/plugins/compile/markdown/mdx_gist.py -index f6ce20a7f..9bbee2ef8 100644 +index f6ce20a7f..2d61d39e0 100644 --- a/nikola/plugins/compile/markdown/mdx_gist.py +++ b/nikola/plugins/compile/markdown/mdx_gist.py @@ -82,13 +82,13 @@ from nikola.utils import get_logger @@ -66,6 +68,29 @@ index f6ce20a7f..9bbee2ef8 100644 def get_raw_gist_with_filename(self, gist_id, filename): """Get raw gist text for a filename.""" +@@ -139,8 +139,11 @@ class GistPattern(Pattern): + + return resp.text + +- def handleMatch(self, m): +- """Handle pattern match.""" ++ def handleMatch(self, m, _): ++ """ ++ Handle pattern match. The third arg is "data", wider ++ context around the match; we don't need it. ++ """ + gist_id = m.group('gist_id') + gist_file = m.group('filename') + +@@ -170,7 +173,7 @@ class GistPattern(Pattern): + warning_comment = etree.Comment(' WARNING: {0} '.format(e.message)) + noscript_elem.append(warning_comment) + +- return gist_elem ++ return (gist_elem, m.start(0), m.end(0)) + + + class GistExtension(MarkdownExtension, Extension): -- 2.37.0.rc1