diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 44932a3..bef59ed 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -69,7 +69,7 @@ jobs: - run: | mk python-release owner=vkottler \ - repo=svgen version=0.6.3 + repo=svgen version=0.6.4 if: | matrix.python-version == '3.11' && matrix.system == 'ubuntu-latest' diff --git a/README.md b/README.md index f67b997..826510b 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,11 @@ ===================================== generator=datazen version=3.1.4 - hash=9032a8122f42767cd7546b44a632c4c3 + hash=e21b336d2e615b1fdad0bb7a28fc9fb8 ===================================== --> -# svgen ([0.6.3](https://pypi.org/project/svgen/)) +# svgen ([0.6.4](https://pypi.org/project/svgen/)) [![python](https://img.shields.io/pypi/pyversions/svgen.svg)](https://pypi.org/project/svgen/) ![Build Status](https://github.com/vkottler/svgen/workflows/Python%20Package/badge.svg) diff --git a/local/variables/package.yaml b/local/variables/package.yaml index edd7d3f..8b03069 100644 --- a/local/variables/package.yaml +++ b/local/variables/package.yaml @@ -1,5 +1,5 @@ --- major: 0 minor: 6 -patch: 3 +patch: 4 entry: svgen diff --git a/pyproject.toml b/pyproject.toml index 8a3cb84..b93b407 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta:__legacy__" [project] name = "svgen" -version = "0.6.3" +version = "0.6.4" description = "A tool for working with scalable vector graphics." readme = "README.md" requires-python = ">=3.10" diff --git a/svgen/__init__.py b/svgen/__init__.py index c83f5ad..23561fe 100644 --- a/svgen/__init__.py +++ b/svgen/__init__.py @@ -1,7 +1,7 @@ # ===================================== # generator=datazen # version=3.1.4 -# hash=2bfa379dd491847550ef6405489ea06b +# hash=4e1af49f6773895ec34a2d5ceb111420 # ===================================== """ @@ -10,4 +10,4 @@ DESCRIPTION = "A tool for working with scalable vector graphics." PKG_NAME = "svgen" -VERSION = "0.6.3" +VERSION = "0.6.4" diff --git a/svgen/element/__init__.py b/svgen/element/__init__.py index 09acc07..13069d2 100644 --- a/svgen/element/__init__.py +++ b/svgen/element/__init__.py @@ -60,12 +60,13 @@ def __init__( self.children: List[Element] = children - def add_class(self, data: str) -> None: + def add_class(self, *data: str) -> None: """Add a class string.""" raw = self["class"] classes = set(raw.split()) - classes.add(data) + for item in data: + classes.add(item) self["class"] = " ".join(classes) def __setitem__(self, tag: str, value: AttributeValue) -> None: diff --git a/tests/element/test_element.py b/tests/element/test_element.py index 97fc217..bf7fdcd 100644 --- a/tests/element/test_element.py +++ b/tests/element/test_element.py @@ -25,6 +25,10 @@ def test_element_class(): elem = Element(tag="div") assert elem["class"] == "" + elem.add_class("a", "b") + val = elem["class"] + assert val in {"a b", "b a"} + def test_element_basic(): """Test the element interface."""