Skip to content

Commit

Permalink
0.6.4 - Update add_class interface
Browse files Browse the repository at this point in the history
  • Loading branch information
vkottler committed Mar 22, 2024
1 parent e7f564c commit d4618e9
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion local/variables/package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
major: 0
minor: 6
patch: 3
patch: 4
entry: svgen
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions svgen/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# =====================================
# generator=datazen
# version=3.1.4
# hash=2bfa379dd491847550ef6405489ea06b
# hash=4e1af49f6773895ec34a2d5ceb111420
# =====================================

"""
Expand All @@ -10,4 +10,4 @@

DESCRIPTION = "A tool for working with scalable vector graphics."
PKG_NAME = "svgen"
VERSION = "0.6.3"
VERSION = "0.6.4"
5 changes: 3 additions & 2 deletions svgen/element/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions tests/element/test_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down

0 comments on commit d4618e9

Please sign in to comment.