From 2b1f161005d3b3d5ebe2fbf2d92606a575786781 Mon Sep 17 00:00:00 2001 From: Laurens Valk Date: Tue, 28 Nov 2023 14:31:13 +0100 Subject: [PATCH] v3.4.0b1 --- CHANGELOG.md | 5 +++++ doc/common/extensions/blockimg.py | 11 ++++++++--- pyproject.toml | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c7e83d5e..17f8d985 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ ## Unreleased +## 3.4.0b1 - 2023-11-28 + +### Changed +- Include first batch of block coding images. + ## 3.3.0 - 2023-11-24 ### Changed diff --git a/doc/common/extensions/blockimg.py b/doc/common/extensions/blockimg.py index 490d6c48..9cd63f4f 100644 --- a/doc/common/extensions/blockimg.py +++ b/doc/common/extensions/blockimg.py @@ -6,7 +6,6 @@ from docutils.nodes import image, paragraph from pathlib import Path -SPHINX_DOC = "main" SPHINX_IMAGE_PATH = "blockimg" SVG_SCALE = 0.9 @@ -22,6 +21,10 @@ def get_svg_size(file_path): return float(width), float(height) +# Global variable to store the app object +app = None + + class BlockImageDirective(Image): option_spec = Image.option_spec.copy() option_spec["stack"] = directives.flag @@ -30,7 +33,7 @@ def run(self): # Adjust the image path file_name = self.arguments[0] + ".svg" self.arguments[0] = "/" + SPHINX_IMAGE_PATH + "/" + file_name - path = Path(os.getcwd()) / SPHINX_DOC / SPHINX_IMAGE_PATH / file_name + path = Path(app.srcdir) / SPHINX_IMAGE_PATH / file_name # Set it to the scaled SVG size unless width explicitly set. if self.options.get("width") is None: @@ -51,5 +54,7 @@ def run(self): return nodes -def setup(app): +def setup(apparg): + global app + app = apparg app.add_directive("blockimg", BlockImageDirective) diff --git a/pyproject.toml b/pyproject.toml index fd1536b0..0f562266 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "pybricks" -version = "3.3.0" +version = "3.4.0b1" description = "Documentation and user-API stubs for Pybricks MicroPython" authors = ["The Pybricks Authors "] maintainers = ["Laurens Valk ", "David Lechner " ]