Skip to content

Commit

Permalink
v3.4.0b1
Browse files Browse the repository at this point in the history
  • Loading branch information
laurensvalk committed Nov 28, 2023
1 parent 5bf7de0 commit 0e90b93
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 8 additions & 3 deletions doc/common/extensions/blockimg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -51,5 +54,7 @@ def run(self):
return nodes


def setup(app):
def setup(apparg):
global app
app = apparg
app.add_directive("blockimg", BlockImageDirective)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <team@pybricks.com>"]
maintainers = ["Laurens Valk <laurens@pybricks.com>", "David Lechner <david@pybricks.com>" ]
Expand Down

0 comments on commit 0e90b93

Please sign in to comment.