From 4088f251e385015fa67266091ee991565752839e Mon Sep 17 00:00:00 2001 From: Adrian Vollmer Date: Sun, 9 Oct 2022 18:07:01 +0200 Subject: [PATCH] Compatibility for Sphinx<=4 and Sphinx>4 --- zundler/sphinxext/__init__.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/zundler/sphinxext/__init__.py b/zundler/sphinxext/__init__.py index eaa117c..bb6bff6 100644 --- a/zundler/sphinxext/__init__.py +++ b/zundler/sphinxext/__init__.py @@ -15,8 +15,13 @@ class ZundlerBuilder(StandaloneHTMLBuilder): name = 'zundler' epilog = "" - def __init__(self, app, env): - super().__init__(app, env) + def __init__(self, app, env=None): + try: + super().__init__(app, env) + except TypeError: + # Sphinx<=4 expects only `app` + super().__init__(app) + self.epilog = ( 'Your self-contained HTML file is now in %s.' % relpath(self.app.original_outdir)