From 3bb83e7d12686128801c3e677f8f2a1829f15b0f Mon Sep 17 00:00:00 2001 From: Chris Sewell Date: Tue, 23 Apr 2024 14:00:47 +0200 Subject: [PATCH 1/2] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Update=20docutils=20re?= =?UTF-8?q?quirement=20from=20>=3D0.16,<0.21=20to=20>=3D0.18,<0.22?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/tests.yml | 2 +- myst_parser/mdit_to_docutils/base.py | 10 +--------- pyproject.toml | 2 +- tests/test_sphinx/test_sphinx_builds.py | 5 ----- 4 files changed, 3 insertions(+), 16 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b3fcdb61..00c61df4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -70,7 +70,7 @@ jobs: strategy: fail-fast: false matrix: - docutils-version: ["0.17", "0.18", "0.19", "0.20"] + docutils-version: ["0.18", "0.19", "0.20", "0.21"] steps: - name: Checkout source diff --git a/myst_parser/mdit_to_docutils/base.py b/myst_parser/mdit_to_docutils/base.py index 4733dead..e604449b 100644 --- a/myst_parser/mdit_to_docutils/base.py +++ b/myst_parser/mdit_to_docutils/base.py @@ -1918,19 +1918,11 @@ def html_meta_to_nodes( if not data: return [] - try: - meta_cls = nodes.meta - except AttributeError: - # docutils-0.17 or older - from docutils.parsers.rst.directives.html import MetaBody - - meta_cls = MetaBody.meta - output = [] for key, value in data.items(): content = str(value or "") - meta_node = meta_cls(content) + meta_node = nodes.meta(content) meta_node.source = document["source"] meta_node.line = line meta_node["content"] = content diff --git a/pyproject.toml b/pyproject.toml index 27ec721f..01f5816d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,7 +35,7 @@ keywords = [ ] requires-python = ">=3.8" dependencies = [ - "docutils>=0.16,<0.21", + "docutils>=0.18,<0.22", "jinja2", # required for substitutions, but let sphinx choose version "markdown-it-py~=3.0", "mdit-py-plugins~=0.4", diff --git a/tests/test_sphinx/test_sphinx_builds.py b/tests/test_sphinx/test_sphinx_builds.py index b4e7c10d..7e6b13a2 100644 --- a/tests/test_sphinx/test_sphinx_builds.py +++ b/tests/test_sphinx/test_sphinx_builds.py @@ -1,11 +1,6 @@ """Uses sphinx's pytest fixture to run builds. see conftest.py for fixture usage - -NOTE: sphinx 3 & 4 regress against different output files, -the major difference being sphinx 4 uses docutils 0.17, -which uses semantic HTML tags -(e.g. converting `
` to `
`) """ from __future__ import annotations From 7682383c060fe92bc72c196184cf71f04e5483be Mon Sep 17 00:00:00 2001 From: Chris Sewell Date: Tue, 23 Apr 2024 14:02:48 +0200 Subject: [PATCH 2/2] Update tests.yml --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 00c61df4..b0463362 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -75,10 +75,10 @@ jobs: steps: - name: Checkout source uses: actions/checkout@v4 - - name: Set up Python 3.8 + - name: Set up Python 3.9 uses: actions/setup-python@v5 with: - python-version: "3.8" + python-version: "3.9" - name: Install setup run: | python -m pip install --upgrade pip