From 1df38a85fdf70a4d19001ca862a3d7d0c05a9214 Mon Sep 17 00:00:00 2001 From: Dmitry Shachnev Date: Sat, 27 Sep 2025 13:39:13 +0300 Subject: [PATCH 1/2] Fix KeyError: 'backrefs' with Docutils 0.22 That attribute is no longer present since this Docutils commit: https://sourceforge.net/p/docutils/code/9684/ Fixes #206. --- sphinx_tabs/tabs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sphinx_tabs/tabs.py b/sphinx_tabs/tabs.py index aa04138..c4000e5 100644 --- a/sphinx_tabs/tabs.py +++ b/sphinx_tabs/tabs.py @@ -66,7 +66,7 @@ def visit(translator, node): attrs.pop("ids") attrs.pop("names") attrs.pop("dupnames") - attrs.pop("backrefs") + attrs.pop("backrefs", None) text = translator.starttag(node, node.tagname, **attrs) translator.body.append(text.strip()) From c87f86cda4c5eb460ad832c4503802beedee3c97 Mon Sep 17 00:00:00 2001 From: Dmitry Shachnev Date: Sat, 27 Sep 2025 17:49:04 +0300 Subject: [PATCH 2/2] Update XML expectations for Docutils 0.22 --- tests/conftest.py | 4 +++ ...ional_assets_html_assets_policy_index_.xml | 26 +++++++++---------- ...al_assets_html_assets_policy_no_tabs1_.xml | 26 +++++++++---------- ...al_assets_html_assets_policy_no_tabs2_.xml | 26 +++++++++---------- .../test_conditional_assets_index_.xml | 26 +++++++++---------- .../test_conditional_assets_no_tabs1_.xml | 26 +++++++++---------- .../test_conditional_assets_no_tabs2_.xml | 26 +++++++++---------- tests/test_build/test_custom_lexer.xml | 4 +-- tests/test_build/test_other_with_assets.xml | 4 +-- tests/test_build/test_rinohtype_pdf.xml | 2 +- 10 files changed, 87 insertions(+), 83 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 1dbf0ad..94075e2 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -2,6 +2,7 @@ import pytest from pathlib import Path from bs4 import BeautifulSoup +import docutils import sphinx from sphinx_tabs.tabs import JS_FILES, CSS_FILES @@ -128,6 +129,9 @@ def read(app, docname="index", resolve=False, regress=False, replace=None): '', "", ) + if docutils.__version_info__ < (0, 22): + text = text.replace('="False"', '="0"') + text = text.replace('linenos="True"', 'linenos="1"') file_regression.check(text, extension=extension) return doctree diff --git a/tests/test_build/test_conditional_assets_html_assets_policy_index_.xml b/tests/test_build/test_conditional_assets_html_assets_policy_index_.xml index 20c4dc9..ff35e60 100644 --- a/tests/test_build/test_conditional_assets_html_assets_policy_index_.xml +++ b/tests/test_build/test_conditional_assets_html_assets_policy_index_.xml @@ -1,6 +1,6 @@ -